GCC Code Coverage Report


Directory: ./
File: tmp_project/PhoenixString/TESTS/TEST_ERASE_FIRST_LAST_CHARS/main.cpp
Date: 2024-07-27 10:53:27
Exec Total Coverage
Lines: 35 35 100.0%
Branches: 114 114 100.0%

Line Branch Exec Source
1
2 /***************************************
3 Auteur : Pierre Aubert
4 Mail : pierre.aubert@lapp.in2p3.fr
5 Licence : CeCILL-C
6 ****************************************/
7
8 #include <iostream>
9 #include "phoenix_assert.h"
10 #include "phoenix_check.h"
11 #include "string_function.h"
12
13 ///Check the erase first chars
14 /** @param testName : name of the test
15 * @param strExpr : string to be parsed to get a MathExpr
16 * @param strReference : reference string
17 * @return true is both strings are equal, false otherwise
18 */
19 4 bool checkEraseFirstChars(const std::string & testName, const std::string & strExpr, const std::string & strReference){
20
2/2
✓ Branch 2 taken 4 times.
✓ Branch 5 taken 4 times.
8 std::string strErase(eraseFirstCharsInStr(strExpr, " \t\n"));
21
4/4
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
✓ Branch 10 taken 4 times.
8 return phoenix_check(testName + "("+strExpr+")", strErase, strReference);
22 4 }
23
24 ///Check the erase last chars
25 /** @param testName : name of the test
26 * @param strExpr : string to be parsed to get a MathExpr
27 * @param strReference : reference string
28 * @return true is both strings are equal, false otherwise
29 */
30 4 bool checkEraseLastChars(const std::string & testName, const std::string & strExpr, const std::string & strReference){
31
2/2
✓ Branch 2 taken 4 times.
✓ Branch 5 taken 4 times.
8 std::string strErase(eraseLastCharsInStr(strExpr, " \t\n"));
32
4/4
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
✓ Branch 10 taken 4 times.
8 return phoenix_check(testName + "("+strExpr+")", strErase, strReference);
33 4 }
34
35 ///Check the erase first last chars
36 /** @param testName : name of the test
37 * @param strExpr : string to be parsed to get a MathExpr
38 * @param strReference : reference string
39 * @return true is both strings are equal, false otherwise
40 */
41 4 bool checkEraseFirstLastChars(const std::string & testName, const std::string & strExpr, const std::string & strReference){
42
2/2
✓ Branch 2 taken 4 times.
✓ Branch 5 taken 4 times.
8 std::string strErase(eraseFirstLastChars(strExpr, " \t\n"));
43
4/4
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
✓ Branch 10 taken 4 times.
8 return phoenix_check(testName + "("+strExpr+")", strErase, strReference);
44 4 }
45
46 ///Test string erase first chars
47 1 void testBaseEraseFirstChars(){
48
8/8
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 14 taken 1 times.
✓ Branch 18 taken 1 times.
✓ Branch 22 taken 1 times.
✓ Branch 25 taken 1 times.
✓ Branch 28 taken 1 times.
1 phoenix_assert(checkEraseFirstChars("Erase first chars 1", "one thing", "one thing"));
49
8/8
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 14 taken 1 times.
✓ Branch 18 taken 1 times.
✓ Branch 22 taken 1 times.
✓ Branch 25 taken 1 times.
✓ Branch 28 taken 1 times.
1 phoenix_assert(checkEraseFirstChars("Erase first chars 2", " one thing", "one thing"));
50
8/8
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 14 taken 1 times.
✓ Branch 18 taken 1 times.
✓ Branch 22 taken 1 times.
✓ Branch 25 taken 1 times.
✓ Branch 28 taken 1 times.
1 phoenix_assert(checkEraseFirstChars("Erase first chars 3", "one thing ", "one thing "));
51
8/8
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 14 taken 1 times.
✓ Branch 18 taken 1 times.
✓ Branch 22 taken 1 times.
✓ Branch 25 taken 1 times.
✓ Branch 28 taken 1 times.
1 phoenix_assert(checkEraseFirstChars("Erase first chars 4", " one thing ", "one thing "));
52 1 }
53
54 ///Test string erase last chars
55 1 void testBaseEraseLastChars(){
56
8/8
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 14 taken 1 times.
✓ Branch 18 taken 1 times.
✓ Branch 22 taken 1 times.
✓ Branch 25 taken 1 times.
✓ Branch 28 taken 1 times.
1 phoenix_assert(checkEraseLastChars("Erase last chars 1", "one thing", "one thing"));
57
8/8
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 14 taken 1 times.
✓ Branch 18 taken 1 times.
✓ Branch 22 taken 1 times.
✓ Branch 25 taken 1 times.
✓ Branch 28 taken 1 times.
1 phoenix_assert(checkEraseLastChars("Erase last chars 2", " one thing", " one thing"));
58
8/8
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 14 taken 1 times.
✓ Branch 18 taken 1 times.
✓ Branch 22 taken 1 times.
✓ Branch 25 taken 1 times.
✓ Branch 28 taken 1 times.
1 phoenix_assert(checkEraseLastChars("Erase last chars 3", "one thing ", "one thing"));
59
8/8
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 14 taken 1 times.
✓ Branch 18 taken 1 times.
✓ Branch 22 taken 1 times.
✓ Branch 25 taken 1 times.
✓ Branch 28 taken 1 times.
1 phoenix_assert(checkEraseLastChars("Erase last chars 4", " one thing ", " one thing"));
60 1 }
61
62 ///Test string erase first last chars
63 1 void testBaseEraseFirstLastChars(){
64
8/8
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 14 taken 1 times.
✓ Branch 18 taken 1 times.
✓ Branch 22 taken 1 times.
✓ Branch 25 taken 1 times.
✓ Branch 28 taken 1 times.
1 phoenix_assert(checkEraseFirstLastChars("Erase first last chars 1", "one thing", "one thing"));
65
8/8
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 14 taken 1 times.
✓ Branch 18 taken 1 times.
✓ Branch 22 taken 1 times.
✓ Branch 25 taken 1 times.
✓ Branch 28 taken 1 times.
1 phoenix_assert(checkEraseFirstLastChars("Erase first last chars 2", " one thing", "one thing"));
66
8/8
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 14 taken 1 times.
✓ Branch 18 taken 1 times.
✓ Branch 22 taken 1 times.
✓ Branch 25 taken 1 times.
✓ Branch 28 taken 1 times.
1 phoenix_assert(checkEraseFirstLastChars("Erase first last chars 3", "one thing ", "one thing"));
67
8/8
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 14 taken 1 times.
✓ Branch 18 taken 1 times.
✓ Branch 22 taken 1 times.
✓ Branch 25 taken 1 times.
✓ Branch 28 taken 1 times.
1 phoenix_assert(checkEraseFirstLastChars("Erase first last chars 4", " one thing ", "one thing"));
68 1 }
69
70 1 int main(int argc, char** argv){
71 1 testBaseEraseFirstChars();
72 1 testBaseEraseLastChars();
73 1 testBaseEraseFirstLastChars();
74 1 return 0;
75 }
76
77
78