Skip to content

Commit 65648d6

Browse files
committed
unit_tests.cpp part of this package
1 parent 365ba32 commit 65648d6

14 files changed

+36
-10
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ addons:
1717
# Build steps
1818
script:
1919
- ./build_simple.sh
20-
- cd unit-tests
20+
- cd unit-tests.wsjcpp
2121
- ./build_simple.sh
2222
- ./unit-tests
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,17 @@ bool UnitTestBase::compareN(bool &bTestSuccess, const std::string &sPoint, int n
3535

3636
// ---------------------------------------------------------------------
3737

38+
bool UnitTestBase::compareD(bool &bTestSuccess, const std::string &sPoint, double nValue, double nExpected) {
39+
if (nValue != nExpected) {
40+
WSJCppLog::err(TAG, " {" + sPoint + "} Expeceted '" + std::to_string(nExpected) + "', but got '" + std::to_string(nValue) + "'");
41+
bTestSuccess = false;
42+
return false;
43+
}
44+
return true;
45+
}
46+
47+
// ---------------------------------------------------------------------
48+
3849
void UnitTestBase::compareB(bool &bTestSuccess, const std::string &sPoint, bool bValue, bool bExpected) {
3950
if (bValue != bExpected) {
4051
WSJCppLog::err(TAG, sPoint + ", expeceted '" + (bExpected ? "true" : "false") + "', but got '" + (bValue ? "true" : "false") + "'");
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ class UnitTestBase {
1616

1717
void compareS(bool &bTestSuccess, const std::string &sPoint, const std::string &sValue, const std::string &sExpected);
1818
bool compareN(bool &bTestSuccess, const std::string &sPoint, int nValue, int nExpected);
19+
bool compareD(bool &bTestSuccess, const std::string &sPoint, double nValue, double nExpected);
1920
void compareB(bool &bTestSuccess, const std::string &sPoint, bool bValue, bool bExpected);
2021

2122
private:
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ list (APPEND WSJCPP_INCLUDE_DIRS "../src")
2020
list (APPEND WSJCPP_INCLUDE_DIRS "src")
2121

2222

23-
list (APPEND WSJCPP_SOURCES "./src/main.cpp")
24-
list (APPEND WSJCPP_SOURCES "./src/unit_tests.h")
25-
list (APPEND WSJCPP_SOURCES "./src/unit_tests.cpp")
23+
list (APPEND WSJCPP_SOURCES "../src/unit_tests_main.cpp")
24+
list (APPEND WSJCPP_SOURCES "../src/unit_tests.h")
25+
list (APPEND WSJCPP_SOURCES "../src/unit_tests.cpp")
2626
list (APPEND WSJCPP_SOURCES "./src/unit_test_core_extract_filename.h")
2727
list (APPEND WSJCPP_SOURCES "./src/unit_test_core_extract_filename.cpp")
2828
list (APPEND WSJCPP_SOURCES "./src/unit_test_core_normalize_path.h")

unit-tests/src/unit_test_core_extract_filename.cpp renamed to unit-tests.wsjcpp/src/unit_test_core_extract_filename.cpp

File renamed without changes.
File renamed without changes.

unit-tests/src/unit_test_core_normalize_path.cpp renamed to unit-tests.wsjcpp/src/unit_test_core_normalize_path.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
REGISTRY_UNIT_TEST(UnitTestCoreNormalizePath)
77

88
UnitTestCoreNormalizePath::UnitTestCoreNormalizePath()
9-
: UnitTestBase("UnitTestFallenNormalizePath") {
9+
: UnitTestBase("UnitTestCoreNormalizePath") {
1010
//
1111
}
1212

0 commit comments

Comments
 (0)