forked from AmbaPant/mantid
-
Notifications
You must be signed in to change notification settings - Fork 1
/
PointVariancesTest.h
43 lines (36 loc) · 1.51 KB
/
PointVariancesTest.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
// 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 <cxxtest/TestSuite.h>
#include "MantidHistogramData/PointStandardDeviations.h"
#include "MantidHistogramData/PointVariances.h"
using namespace Mantid;
using namespace HistogramData;
class PointVariancesTest : public CxxTest::TestSuite {
public:
// This pair of boilerplate methods prevent the suite being created statically
// This means the constructor isn't called when running other tests
static PointVariancesTest *createSuite() { return new PointVariancesTest(); }
static void destroySuite(PointVariancesTest *suite) { delete suite; }
void test_has_correct_mixins() {
PointVariances data;
TS_ASSERT_THROWS_NOTHING(UNUSED_ARG(
(dynamic_cast<detail::VarianceVectorOf<PointVariances, HistogramDx, PointStandardDeviations> &>(data))));
}
void test_construct_default() {
const PointVariances points{};
TS_ASSERT(!points);
}
void test_conversion_identity() {
const PointVariances variances{1.0, 4.0, 9.0};
const PointStandardDeviations sigmas(variances);
const PointVariances result(sigmas);
TS_ASSERT_EQUALS(result[0], variances[0]);
TS_ASSERT_EQUALS(result[1], variances[1]);
TS_ASSERT_EQUALS(result[2], variances[2]);
}
};