forked from npshub/mantid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TofEventTest.h
52 lines (42 loc) · 1.49 KB
/
TofEventTest.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
43
44
45
46
47
48
49
50
51
52
// 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 "MantidTypes/Event/TofEvent.h"
#include <cmath>
#include <cxxtest/TestSuite.h>
using Mantid::Types::Event::TofEvent;
using std::size_t;
using std::vector;
//==========================================================================================
class TofEventTest : public CxxTest::TestSuite {
private:
TofEvent e;
public:
// This pair of boilerplate methods prevent the suite being created statically
// This means the constructor isn't called when running other tests
static TofEventTest *createSuite() { return new TofEventTest(); }
static void destroySuite(TofEventTest *suite) { delete suite; }
TofEventTest() { e = TofEvent(123, 456); }
void testInit() {
TS_ASSERT_EQUALS(e.tof(), 123);
TS_ASSERT_EQUALS(e.pulseTime(), 456);
}
void testAssign() {
TofEvent e2;
e2 = e;
TS_ASSERT_EQUALS(e2.tof(), 123);
TS_ASSERT_EQUALS(e2.pulseTime(), 456);
}
void testConstructors() {
TofEvent e2 = TofEvent(e);
TS_ASSERT_EQUALS(e2.tof(), 123);
TS_ASSERT_EQUALS(e2.pulseTime(), 456);
TofEvent e3 = TofEvent(890.234, 321);
TS_ASSERT_EQUALS(e3.tof(), 890.234);
TS_ASSERT_EQUALS(e3.pulseTime(), 321);
}
};