@@ -17,7 +17,7 @@ std::string UnitTestBase::name() {
1717void UnitTestBase::compareS (bool &bTestSuccess, const std::string &sPoint ,
1818 const std::string &sValue , const std::string &sExpected ) {
1919 if (sValue != sExpected ) {
20- WSJCppLog::err (TAG, sPoint + " , expeceted '" + sExpected + " ', but got '" + sValue + " '" );
20+ WSJCppLog::err (TAG, " { " + sPoint + " } Expected '" + sExpected + " ', but got '" + sValue + " '" );
2121 bTestSuccess = false ;
2222 }
2323}
@@ -26,7 +26,18 @@ void UnitTestBase::compareS(bool &bTestSuccess, const std::string &sPoint,
2626
2727bool UnitTestBase::compareN (bool &bTestSuccess, const std::string &sPoint , int nValue, int nExpected) {
2828 if (nValue != nExpected) {
29- WSJCppLog::err (TAG, " {" + sPoint + " } Expeceted '" + std::to_string (nExpected) + " ', but got '" + std::to_string (nValue) + " '" );
29+ WSJCppLog::err (TAG, " {" + sPoint + " } Expected '" + std::to_string (nExpected) + " ', but got '" + std::to_string (nValue) + " '" );
30+ bTestSuccess = false ;
31+ return false ;
32+ }
33+ return true ;
34+ }
35+
36+ // ---------------------------------------------------------------------
37+
38+ bool UnitTestBase::compareD (bool &bTestSuccess, const std::string &sPoint , double nValue, double nExpected) {
39+ if (nValue != nExpected) {
40+ WSJCppLog::err (TAG, " {" + sPoint + " } Expected '" + std::to_string (nExpected) + " ', but got '" + std::to_string (nValue) + " '" );
3041 bTestSuccess = false ;
3142 return false ;
3243 }
@@ -37,7 +48,7 @@ bool UnitTestBase::compareN(bool &bTestSuccess, const std::string &sPoint, int n
3748
3849void UnitTestBase::compareB (bool &bTestSuccess, const std::string &sPoint , bool bValue, bool bExpected) {
3950 if (bValue != bExpected) {
40- WSJCppLog::err (TAG, sPoint + " , expeceted '" + (bExpected ? " true" : " false" ) + " ', but got '" + (bValue ? " true" : " false" ) + " '" );
51+ WSJCppLog::err (TAG, " { " + sPoint + " } Expected '" + (bExpected ? " true" : " false" ) + " ', but got '" + (bValue ? " true" : " false" ) + " '" );
4152 bTestSuccess = false ;
4253 }
4354}
@@ -48,7 +59,7 @@ std::vector<UnitTestBase*> *g_pUnitTests = NULL;
4859
4960void UnitTests::initGlobalVariables () {
5061 if (g_pUnitTests == NULL ) {
51- // WSJCppLog ::info(std::string(), "Create handlers map");
62+ // Log ::info(std::string(), "Create handlers map");
5263 g_pUnitTests = new std::vector<UnitTestBase*>();
5364 }
5465}
@@ -69,7 +80,7 @@ void UnitTests::addUnitTest(const std::string &sTestName, UnitTestBase* pUnitTes
6980 WSJCppLog::err (sTestName , " Already registered" );
7081 } else {
7182 g_pUnitTests->push_back (pUnitTest);
72- // WSJCppLog ::info(sCmd, "Registered");
83+ // Log ::info(sCmd, "Registered");
7384 }
7485}
7586
0 commit comments