SmartTester  2.0.0
Smart Tester is unit testing and regression testing framework used for testing SmartCGMS system.
SecondaryUnitTesters.h
1 //
2 // Author: markovd@students.zcu.cz
3 //
4 
5 #ifndef SMARTTESTER_SECONDARYUNITTESTERS_H
6 #define SMARTTESTER_SECONDARYUNITTESTERS_H
7 
8 
9 #include <iface/SolverIface.h>
10 #include <iface/ApproxIface.h>
11 #include "GenericUnitTester.h"
12 
13 namespace tester {
14 
18  class MetricUnitTester : public EntityUnitTester<scgms::IMetric> {
19  public: // public methods
20  MetricUnitTester(const GUID& guid, const std::wstring& libraryPath);
21  void executeAllTests() override;
22  void loadEntity() override;
23  HRESULT shutDownTest() override;
24 
30  HRESULT identityTest();
31 
38  HRESULT symmetryTest();
39 
46  HRESULT triangleInequalityTest();
47 
48  private: // private methods
50  double calculateMetric(const std::vector<double>& times, const std::vector<double>& reference, const std::vector<double>& calculated);
51  };
52 
56  class ApproximatorUnitTester : public EntityUnitTester<scgms::IApproximator> {
57  private: // private attributes
59  static constexpr std::size_t s_signalValuesCount = 10;
61  static constexpr std::array<double, s_signalValuesCount> s_times { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0};
63  static constexpr std::array<double, s_signalValuesCount> s_levels { 2.0, 4.0, 8.0, 16.0, 32.0, 64.0, 128.0, 256.0, 512.0, 1024.0};
64  public: // public methods
65  ApproximatorUnitTester(const GUID& guid, const std::wstring& libraryPath);
66  void loadEntity() override;
67  void executeAllTests() override;
68  HRESULT shutDownTest() override;
69 
70  HRESULT middleTimeApproximationTest();
71 
72  HRESULT middleTimeDerivativeApproximationTest();
73 
74  private: // private methods
75  HRESULT calculateApproximations(const std::size_t derivativeOrder = 0);
76  };
77 }
78 
79 
80 #endif //SMARTTESTER_SECONDARYUNITTESTERS_H
tester::MetricUnitTester::executeAllTests
void executeAllTests() override
Every derived class has to override this method to execute all tests.
Definition: SecondaryUnitTesters.cpp:14
tester::MetricUnitTester::symmetryTest
HRESULT symmetryTest()
Definition: SecondaryUnitTesters.cpp:41
tester::MetricUnitTester::loadEntity
void loadEntity() override
Loads tested entity. Has to be implemented by derived classes.
Definition: SecondaryUnitTesters.cpp:89
tester::MetricUnitTester::triangleInequalityTest
HRESULT triangleInequalityTest()
Definition: SecondaryUnitTesters.cpp:64
tester::ApproximatorUnitTester::shutDownTest
HRESULT shutDownTest() override
Every derived class has to override the test shutdown mechanism.
Definition: SecondaryUnitTesters.cpp:234
tester::ApproximatorUnitTester
Definition: SecondaryUnitTesters.h:56
tester::MetricUnitTester::identityTest
HRESULT identityTest()
Definition: SecondaryUnitTesters.cpp:23
tester::MetricUnitTester
Definition: SecondaryUnitTesters.h:18
tester::ApproximatorUnitTester::loadEntity
void loadEntity() override
Loads tested entity. Has to be implemented by derived classes.
Definition: SecondaryUnitTesters.cpp:190
tester::MetricUnitTester::shutDownTest
HRESULT shutDownTest() override
Every derived class has to override the test shutdown mechanism.
Definition: SecondaryUnitTesters.cpp:112
tester::ApproximatorUnitTester::executeAllTests
void executeAllTests() override
Every derived class has to override this method to execute all tests.
Definition: SecondaryUnitTesters.cpp:140
tester::EntityUnitTester
Definition: GenericUnitTester.h:139