Directory: | ./ |
---|---|
File: | TESTS/TEST_SPLIT/main.cpp |
Date: | 2025-03-14 11:49:29 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 14 | 14 | 100.0% |
Branches: | 20 | 20 | 100.0% |
Line | Branch | Exec | Source |
---|---|---|---|
1 | /*************************************** | ||
2 | Auteur : Pierre Aubert | ||
3 | Mail : pierre.aubert@lapp.in2p3.fr | ||
4 | Licence : CeCILL-C | ||
5 | ****************************************/ | ||
6 | |||
7 | #include "phoenix_assert.h" | ||
8 | #include "data_stream_check_value.h" | ||
9 | #include "convertToString.h" | ||
10 | #include "phoenix_clock_mock.h" | ||
11 | |||
12 | ///Test the mock split function | ||
13 | /** @param vecInput : input vector | ||
14 | * @param offsetPart : offset of part to split | ||
15 | * @param sizePart : size of the part to be extracted | ||
16 | * @param vecExpectedResult : expected results | ||
17 | * @return true if the output of the function is correct, false otherwise | ||
18 | */ | ||
19 | 2 | bool testMockSplitCall(const VecTime & vecInput, size_t offsetPart, size_t sizePart, VecTime & vecExpectedResult){ | |
20 | 2 | VecTime vecMessage; | |
21 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | splitVecTime(vecMessage, vecInput, offsetPart, sizePart); |
22 |
7/7✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
✓ Branch 13 taken 2 times.
✓ Branch 16 taken 2 times.
✓ Branch 19 taken 2 times.
|
4 | return checkValue("splitVecMessage(offsetPart = "+valueToString(offsetPart)+", sizePart = "+valueToString(sizePart)+")", vecMessage, vecExpectedResult); |
23 | 2 | } | |
24 | |||
25 | ///Test mock split | ||
26 | 1 | void testMockSplit(){ | |
27 | 1 | VecTime vecMessage, vecExpectedResult; | |
28 |
5/5✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
|
1 | phoenix_assert(testMockSplitCall(vecMessage, 0lu, 1lu, vecExpectedResult)); |
29 | |||
30 |
1/1✓ Branch 1 taken 1 times.
|
1 | vecMessage.push_back(1l); |
31 |
5/5✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
|
1 | phoenix_assert(testMockSplitCall(vecMessage, 0lu, 0lu, vecExpectedResult)); |
32 | 1 | } | |
33 | |||
34 | |||
35 | 1 | int main(int argc, char** argv){ | |
36 | 1 | testMockSplit(); | |
37 | 1 | return 0; | |
38 | } | ||
39 | |||
40 |