SmartTester
2.0.0
Smart Tester is unit testing and regression testing framework used for testing SmartCGMS system.
|
#include <SecondaryUnitTesters.h>
Public Member Functions | |
MetricUnitTester (const GUID &guid, const std::wstring &libraryPath) | |
void | executeAllTests () override |
Every derived class has to override this method to execute all tests. | |
void | loadEntity () override |
Loads tested entity. Has to be implemented by derived classes. | |
HRESULT | shutDownTest () override |
Every derived class has to override the test shutdown mechanism. | |
HRESULT | identityTest () |
HRESULT | symmetryTest () |
HRESULT | triangleInequalityTest () |
![]() | |
EntityUnitTester (const GUID &entityGuid) | |
bool | isEntityLoaded () const noexcept |
CDynamic_Library & | getEntityLib () noexcept |
const GUID & | getEntityGuid () const noexcept |
void | loadEntityLibrary () |
const wchar_t * | getEntityName (const std::string &symbolName) |
![]() | |
void | executeTest (const std::wstring &testName, const std::function< HRESULT(void)> &test) |
Additional Inherited Members | |
![]() | |
void | setEntityLib (const std::wstring &libPath) |
void | setLibraryPath (const std::wstring &libraryPath) noexcept |
const std::wstring & | getLibraryPath () const |
scgms::IMetric * | getTestedEntity () noexcept |
void | setTestedEntity (scgms::IMetric *entity) |
void | runTest (const std::function< HRESULT()> &test) override |
We need special behavior of the test execution sequence, so we override this method. More... | |
![]() | |
std::mutex | m_testMutex |
std::condition_variable | m_testCv |
HRESULT | m_lastTestResult = S_OK |
Class for testing scgms::IMetric interface.
HRESULT tester::MetricUnitTester::identityTest | ( | ) |
Every metric has to meet the identity requirement - if calculated and reference values are equal, calculated metric has to be zero. (d(a,a)=0). This test checks whether the tested metric meets this requirement or not.
Metric must have an identity trait - if calculated value = reference value => metric must be 0
HRESULT tester::MetricUnitTester::symmetryTest | ( | ) |
Every metric has to meet symmetry requirement - calculated metric from two values has to be equal when first is passed as reference value and second is passed as calculated value and when passed in reversed order. (d(a,b)=d(b,a)). This test checks, whether the tested metric meets this requirement or not.
Resetting so we have the same starting conditions
Metric must have a symmetry trait - d(a,b) must be equal to d(b,a)
HRESULT tester::MetricUnitTester::triangleInequalityTest | ( | ) |
Every metric has to meet triangle inequality requirement - calculated metric with values A and C has to be less or equal to the sum of calculated metrics with values A and B, and B and C. (d(a,c)<=d(a,b)+d(b,c)). This test checks whether the metric meets this requirement or not.
Epsilon for comparing doubles