SmartTester  2.0.0
Smart Tester is unit testing and regression testing framework used for testing SmartCGMS system.
Public Member Functions | List of all members
tester::MetricUnitTester Class Reference

#include <SecondaryUnitTesters.h>

Inheritance diagram for tester::MetricUnitTester:
Inheritance graph
[legend]
Collaboration diagram for tester::MetricUnitTester:
Collaboration graph
[legend]

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 ()
 
- Public Member Functions inherited from tester::EntityUnitTester< scgms::IMetric >
 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)
 
- Public Member Functions inherited from tester::TestRunner
void executeTest (const std::wstring &testName, const std::function< HRESULT(void)> &test)
 

Additional Inherited Members

- Protected Member Functions inherited from tester::EntityUnitTester< scgms::IMetric >
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...
 
- Protected Attributes inherited from tester::TestRunner
std::mutex m_testMutex
 
std::condition_variable m_testCv
 
HRESULT m_lastTestResult = S_OK
 

Detailed Description

Class for testing scgms::IMetric interface.

Member Function Documentation

◆ identityTest()

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.

Returns
S_OK if metric meets identity requirement, otherwise E_FAIL

Metric must have an identity trait - if calculated value = reference value => metric must be 0

◆ symmetryTest()

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.

Returns
S_OK if metric meets symmetry requirement, otherwise E_FAIL

Resetting so we have the same starting conditions

Metric must have a symmetry trait - d(a,b) must be equal to d(b,a)

◆ triangleInequalityTest()

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.

Returns
S_OK if metric meets triable inequality requirement, otherwise E_FAIL

Epsilon for comparing doubles


The documentation for this class was generated from the following files: