forked from npshub/mantid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TaskTest.h
42 lines (36 loc) · 1.08 KB
/
TaskTest.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Mantid Repository : https://github.com/mantidproject/mantid
//
// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
// NScD Oak Ridge National Laboratory, European Spallation Source,
// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
// SPDX - License - Identifier: GPL - 3.0 +
#pragma once
#include "MantidKernel/Task.h"
#include "MantidKernel/Timer.h"
#include <cxxtest/TestSuite.h>
#include <memory>
using namespace Mantid::Kernel;
namespace TaskTestNamespace {
int my_check_value = 0;
}
/** A custom implementation of Task */
class MyTask : public Task {
public:
void run() override { TaskTestNamespace::my_check_value = 123; }
};
class TaskTest : public CxxTest::TestSuite {
public:
void test_run() {
MyTask t;
TaskTestNamespace::my_check_value = 0;
TS_ASSERT_DIFFERS(TaskTestNamespace::my_check_value, 123);
t.run();
TS_ASSERT_EQUALS(TaskTestNamespace::my_check_value, 123);
}
void test_mutex() {
MyTask t;
auto mut = std::make_shared<std::mutex>();
t.setMutex(mut);
TS_ASSERT_EQUALS(mut, t.getMutex());
}
};