diff --git a/CppUTestSteps b/CppUTestSteps index 65bbece5..1c8385be 160000 --- a/CppUTestSteps +++ b/CppUTestSteps @@ -1 +1 @@ -Subproject commit 65bbece58e848e202a4756686d0c013d7fa56e70 +Subproject commit 1c8385be6c0b2b3a562ae0faf8ebc309429e5d7c diff --git a/application/components/COM/Com.h b/application/components/COM/Com.h index 8d6eb4c2..201646ab 100644 --- a/application/components/COM/Com.h +++ b/application/components/COM/Com.h @@ -1,6 +1,5 @@ // ============================================================ // class Com implements I_Com -// - currently without functionality // ============================================================ // created by Manfred Sorgo diff --git a/specification/codebase/Mem.h b/specification/codebase/Mem.h index dc59c158..e2648ba1 100644 --- a/specification/codebase/Mem.h +++ b/specification/codebase/Mem.h @@ -32,10 +32,10 @@ class Mem return std::memcmp(c1, c2, N); } - // compare two objects - template - inline static auto cmp(const T& c1, const T& c2) - { - return std::memcmp(&c1, &c2, sizeof(T)); - } + // // compare two objects + // template + // inline static auto cmp(const T& c1, const T& c2) + // { + // return std::memcmp(&c1, &c2, sizeof(T)); + // } }; diff --git a/testing/coverage.md b/testing/coverage.md index 7866860d..ccb518da 100644 --- a/testing/coverage.md +++ b/testing/coverage.md @@ -14,43 +14,28 @@ It's available for Windows and Linux. Bullseye is not for free - but they provide a free trial period. -Sample (and very outdated) text summary output: +Sample text summary output: ``` -Source Function Coverage C/D Coverage ----------------- ----------------- ---------------- -Com.h 3 / 3 = 100% 0 / 0 -Dispatcher.cpp 7 / 7 = 100% 20 / 20 = 100% -Dispatcher.h 1 / 1 = 100% 0 / 0 -I_Array.h 3 / 3 = 100% 18 / 18 = 100% -LCR_Hub.cpp 4 / 4 = 100% 4 / 4 = 100% -LCR_Hub.h 1 / 1 = 100% 0 / 0 -LCR_Provider.cpp 1 / 1 = 100% 15 / 15 = 100% -LCR_Provider.h 3 / 3 = 100% 0 / 0 -LCR_X.cpp 9 / 9 = 100% 37 / 37 = 100% -LCR_X.h 7 / 7 = 100% 0 / 0 -Loader.cpp 1 / 1 = 100% 0 / 0 -Loader.h 1 / 1 = 100% 0 / 0 -Log.h 2 / 2 = 100% 0 / 0 -Mem.h 4 / 4 = 100% 0 / 0 -NtpArray.cpp 1 / 1 = 100% 0 / 0 -NtpArray.h 4 / 4 = 100% 0 / 0 -SIG_Hub.cpp 4 / 4 = 100% 4 / 4 = 100% -SIG_Hub.h 1 / 1 = 100% 0 / 0 -SIG_Provider.cpp 1 / 1 = 100% 16 / 16 = 100% -SIG_Provider.h 3 / 3 = 100% 0 / 0 -SIG_X.cpp 18 / 18 = 100% 93 / 93 = 100% -SIG_X.h 9 / 9 = 100% 0 / 0 -StackArray.cpp 1 / 1 = 100% 0 / 0 -StackArray.h 26 / 26 = 100% 2 / 2 = 100% -TSW.cpp 7 / 7 = 100% 22 / 22 = 100% -TSW.h 1 / 1 = 100% 0 / 0 -TSW_Hub.cpp 4 / 4 = 100% 4 / 4 = 100% -TSW_Hub.h 1 / 1 = 100% 0 / 0 -TSW_Provider.cpp 1 / 1 = 100% 12 / 12 = 100% -TSW_Provider.h 3 / 3 = 100% 0 / 0 -coding.h 1 / 1 = 100% 0 / 0 ----------------- ----------------- ---------------- -Total 133 / 133 = 100% 247 / 247 = 100% +Directory Function Coverage C/D Coverage +------------------------------- ----------------- ---------------- +application/components/ 135 / 135 = 100% 311 / 312 = 99% +application/components/BAS/ 26 / 26 = 100% 35 / 35 = 100% +application/components/BAS/src/ 1 / 1 = 100% 10 / 10 = 100% +application/components/COM/ 32 / 32 = 100% 79 / 80 = 98% +application/components/COM/src/ 31 / 31 = 100% 79 / 80 = 98% +application/components/LCR/ 17 / 17 = 100% 40 / 40 = 100% +application/components/LCR/src/ 11 / 11 = 100% 40 / 40 = 100% +application/components/SIG/ 33 / 33 = 100% 95 / 95 = 100% +application/components/SIG/src/ 24 / 24 = 100% 95 / 95 = 100% +application/components/SYS/ 15 / 15 = 100% 40 / 40 = 100% +application/components/SYS/src/ 13 / 13 = 100% 40 / 40 = 100% +application/components/TSW/ 12 / 12 = 100% 22 / 22 = 100% +application/components/TSW/src/ 8 / 8 = 100% 22 / 22 = 100% +specification/ 6 / 6 = 100% 0 / 0 +specification/codebase/ 3 / 3 = 100% 0 / 0 +specification/ifs/ 3 / 3 = 100% 0 / 0 +------------------------------- ----------------- ---------------- +Total 141 / 141 = 100% 311 / 312 = 99% ``` For details see [bullseye html report](http://dstw.sorgo.de/bullseye/) diff --git a/testing/testenv/testlib/TestLib.h b/testing/testenv/testlib/TestLib.h index 4f155835..f2b029fb 100644 --- a/testing/testenv/testlib/TestLib.h +++ b/testing/testenv/testlib/TestLib.h @@ -27,15 +27,15 @@ namespace test return Mem::cmp(n1.chars, n2.chars) == 0; } - inline bool operator==(const ComData& d1, const ComData& d2) - { - return Mem::cmp(d1, d2) == 0; - } + // inline bool operator==(const ComData& d1, const ComData& d2) + // { + // return Mem::cmp(d1, d2) == 0; + // } - inline bool operator==(const ComTele& t1, const ComTele& t2) - { - return Mem::cmp(t1, t2) == 0; - } + // inline bool operator==(const ComTele& t1, const ComTele& t2) + // { + // return Mem::cmp(t1, t2) == 0; + // } // avoid "not used" warning template diff --git a/testing/tests/moduletests/BAS/BAS_01.cpp b/testing/tests/moduletests/BAS/BAS_01.cpp index eda5ad16..7de5b172 100644 --- a/testing/tests/moduletests/BAS/BAS_01.cpp +++ b/testing/tests/moduletests/BAS/BAS_01.cpp @@ -179,8 +179,13 @@ namespace test { public: const Key key; - const int data[5]; - inline Cont(int k, int d=0) : key(k), data{d, d, d, d, d} { ++cnt; } + const int cdata[5]; + int vdata[5]; + inline Cont(int k, int d=0) : + key(k), + cdata{d, d, d, d, d}, + vdata{0, 0, 0, 0, 0} + { ++cnt; } inline ~Cont() { --cnt; } inline static UINT32 count() { return cnt; } NODEF(Cont) @@ -206,7 +211,7 @@ namespace test protected: inline int getKey(const Cont& cont) const final { - return cont.data[0]; + return cont.cdata[0]; } }; @@ -289,7 +294,11 @@ namespace test const PosRes res2 = cxi.find(n); L_CHECK_TRUE(res2.valid); const Cont& c2 = cxi.at(res2); - L_CHECK_EQUAL(n, c2.data[0]); + L_CHECK_EQUAL(n, c2.cdata[0]); + + // coverage: non const at position + Cont& c3 = mxi.at(res2.pos); + c3.vdata[0] = 123; } ENDSTEPS() diff --git a/testing/tests/moduletests/SYS/SYS_01.cpp b/testing/tests/moduletests/SYS/SYS_01.cpp index cdafc85d..665f9a3e 100644 --- a/testing/tests/moduletests/SYS/SYS_01.cpp +++ b/testing/tests/moduletests/SYS/SYS_01.cpp @@ -26,15 +26,15 @@ namespace test m_Log().expectLog(COMP_SYS, RET_ERR_STARTUP); } - void wrongSize(int dev) + void wrongSize(int dev, const UINT32 n = 1) { std::ofstream os(fname, std::ios::binary); - constexpr static const UINT32 nums[] = { 1, 1, 1, 1 }; + const UINT32 nums[] = { n, n, n, n }; os.write(reinterpret_cast(nums), 4 * sizeof(UINT32)); - constexpr static const size_t wSize = sizeof(ProjItem) * 4; + const size_t wSize = sizeof(ProjItem) * n * 4 + sizeof(ComSetup) + dev; - for (size_t n = 0; n < wSize + dev; ++n) + for (size_t n = 0; n < wSize; ++n) { os << ' '; } @@ -66,6 +66,13 @@ namespace test data.dump(fname); rdr.read(fname); CHECK_N_CLEAR() + + STEP(2) + const ComSetup& cs = rdr.getComSetup(); + L_CHECK_EQUAL(tcpPortFld, cs.portFld) + L_CHECK_EQUAL(tcpPortGui, cs.portGui) + L_CHECK_EQUAL(tcpPortCtrl, cs.portCtrl) + L_CHECK_EQUAL(tcpTimeout, cs.timeout) } // test type: equivalence class test @@ -94,6 +101,11 @@ namespace test // too large wrongSize(+1); CHECK_N_CLEAR() + + STEP(3) + // no data + wrongSize(0, 0); + CHECK_N_CLEAR() } // test type: equivalence class test diff --git a/testing/tests/moduletests/TSW/TSW_01.cpp b/testing/tests/moduletests/TSW/TSW_01.cpp index 05d5c646..e42e6ddb 100644 --- a/testing/tests/moduletests/TSW/TSW_01.cpp +++ b/testing/tests/moduletests/TSW/TSW_01.cpp @@ -161,5 +161,9 @@ namespace test STEP(2) m_Log().expectLog(COMP_TSW, RET_ERR_MATCH); FLD(PARAM_UNKNOWN); + + STEP(3) + // coverage + L_CHECK_EQUAL(TYPE_TSW, mSUT.type()) } }