forked from npshub/mantid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CPUTimerTest.h
33 lines (29 loc) · 1.1 KB
/
CPUTimerTest.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
// 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/System.h"
#include "MantidKernel/Timer.h"
#include <cxxtest/TestSuite.h>
#include "MantidKernel/CPUTimer.h"
using namespace Mantid::Kernel;
class CPUTimerTest : public CxxTest::TestSuite {
public:
/** Since timer tests are difficult to make reliable,
* simple tests for not throwing only.
*/
void test_throws_nothing() {
TS_ASSERT_THROWS_NOTHING(CPUTimer timer1;)
CPUTimer tim1;
TS_ASSERT_THROWS_NOTHING(tim1.reset();)
TS_ASSERT_THROWS_NOTHING(tim1.elapsedCPU();)
TS_ASSERT_THROWS_NOTHING(tim1.elapsedCPU(true);)
TS_ASSERT_THROWS_NOTHING(tim1.elapsedCPU(false);)
TS_ASSERT_THROWS_NOTHING(tim1.CPUfraction();)
TS_ASSERT_THROWS_NOTHING(tim1.CPUfraction(true);)
TS_ASSERT_THROWS_NOTHING(tim1.CPUfraction(false);)
}
};