Directory: | ./ |
---|---|
File: | tmp_project/PhoenixString/TESTS/TEST_COLOR/main.cpp |
Date: | 2024-07-27 10:53:27 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 73 | 73 | 100.0% |
Branches: | 202 | 202 | 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 "phoenix_assert.h" | ||
9 | #include <iostream> | ||
10 | #include <vector> | ||
11 | #include "string_color.h" | ||
12 | |||
13 | ///Test the color | ||
14 | 1 | void testStringColor(){ | |
15 | 1 | bool b(true); | |
16 |
1/1✓ Branch 1 taken 1 times.
|
1 | textColor("1"); |
17 |
1/1✓ Branch 1 taken 1 times.
|
1 | textColorCerr("1"); |
18 |
3/3✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
✓ Branch 7 taken 1 times.
|
1 | std::cout << termDefault() << std::endl; |
19 |
1/1✓ Branch 1 taken 1 times.
|
1 | clearTerminal(); |
20 |
3/3✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
✓ Branch 7 taken 1 times.
|
1 | std::cout << termDefault() << std::endl; |
21 |
6/6✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
✓ Branch 7 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
|
1 | std::cout << termBlack() <<"Black" << termDefault() << std::endl; |
22 |
6/6✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
✓ Branch 7 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
|
1 | std::cout << termBlink() <<"Blink" << termDefault() << std::endl; |
23 |
6/6✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
✓ Branch 7 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
|
1 | std::cout << termBright() <<"Bright" << termDefault() << std::endl; |
24 |
6/6✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
✓ Branch 7 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
|
1 | std::cout << termBlue() <<"Blue" << termDefault() << std::endl; |
25 |
6/6✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
✓ Branch 7 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
|
1 | std::cout << termCyan() << "Cyan" << termDefault() << std::endl; |
26 |
6/6✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
✓ Branch 7 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
|
1 | std::cout << termGreen() << "Green" << termDefault() << std::endl; |
27 |
6/6✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
✓ Branch 7 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
|
1 | std::cout << termNegative() << "Negative" << termDefault() << std::endl; |
28 |
6/6✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
✓ Branch 7 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
|
1 | std::cout << termPositive() << "Positive" << termDefault() << std::endl; |
29 |
6/6✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
✓ Branch 7 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
|
1 | std::cout << termPurple() << "Purple" << termDefault() << std::endl; |
30 |
6/6✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
✓ Branch 7 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
|
1 | std::cout << termRed() << "Red" << termDefault() << std::endl; |
31 |
6/6✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
✓ Branch 7 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
|
1 | std::cout << termUnderlined() << "Underlined" << termDefault() << std::endl; |
32 |
6/6✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
✓ Branch 7 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
|
1 | std::cout << termWhite() << "White" << termDefault() << std::endl; |
33 |
6/6✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
✓ Branch 7 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
|
1 | std::cout << termYellow() << "Yellow" << termDefault() << std::endl; |
34 | |||
35 |
6/6✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
✓ Branch 7 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
|
1 | std::cout << termBBlack() << "Black background" << termDefault() << std::endl; |
36 |
6/6✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
✓ Branch 7 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
|
1 | std::cout << termBBlue() << "Blue background" << termDefault() << std::endl; |
37 |
6/6✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
✓ Branch 7 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
|
1 | std::cout << termBCyan() << "Cyan background" << termDefault() << std::endl; |
38 |
6/6✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
✓ Branch 7 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
|
1 | std::cout << termBGreen() << "Green background" << termDefault() << std::endl; |
39 |
6/6✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
✓ Branch 7 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
|
1 | std::cout << termBPurple() << "Purple background" << termDefault() << std::endl; |
40 |
6/6✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
✓ Branch 7 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
|
1 | std::cout << termBRed() << "Red background" << termDefault() << std::endl; |
41 |
6/6✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
✓ Branch 7 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
|
1 | std::cout << termBWhite() << "White background" << termDefault() << std::endl; |
42 |
6/6✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
✓ Branch 7 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
|
1 | std::cout << termBYellow() << "Yellow background" << termDefault() << std::endl; |
43 | |||
44 |
7/7✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
✓ Branch 7 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
✓ Branch 19 taken 1 times.
|
1 | std::cout << "testStringColor : nbRowTerminal = " << getNbRowTerminal()<<", NbColTerminal = " << getNbColTerminal() << std::endl; |
45 | |||
46 |
2/2✓ Branch 2 taken 1 times.
✓ Branch 5 taken 1 times.
|
1 | printDelire("Print a lot of color in the same text but I think this is quite useless"); |
47 |
3/3✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
✓ Branch 7 taken 1 times.
|
1 | std::cout << termDefault() << std::endl; |
48 | |||
49 |
3/3✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 9 taken 1 times.
|
1 | printAllCol("col all Print text of full", '=', "Some right text"); |
50 |
3/3✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 9 taken 1 times.
|
1 | printAll("cout all Print text of full", '=', "Some right text"); |
51 |
3/3✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 9 taken 1 times.
|
1 | printAllCerr("Cerr Print text of full", '=', "Some right text"); |
52 |
3/3✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 9 taken 1 times.
|
1 | printAllColCerr("Cerr col all Print text of full", '=', "Some right text"); |
53 | |||
54 | 1 | std::vector<PTerminalStyle> vecStyle; | |
55 |
1/1✓ Branch 1 taken 1 times.
|
1 | vecStyle.push_back(NONE); |
56 |
1/1✓ Branch 1 taken 1 times.
|
1 | vecStyle.push_back(BRIGHT); |
57 |
1/1✓ Branch 1 taken 1 times.
|
1 | vecStyle.push_back(UNDERLINED); |
58 |
1/1✓ Branch 1 taken 1 times.
|
1 | vecStyle.push_back(BLINK); |
59 |
1/1✓ Branch 1 taken 1 times.
|
1 | vecStyle.push_back(NEGATIVE); |
60 |
1/1✓ Branch 1 taken 1 times.
|
1 | vecStyle.push_back(POSITIVE); |
61 |
1/1✓ Branch 1 taken 1 times.
|
1 | vecStyle.push_back(BLACK); |
62 |
1/1✓ Branch 1 taken 1 times.
|
1 | vecStyle.push_back(RED); |
63 |
1/1✓ Branch 1 taken 1 times.
|
1 | vecStyle.push_back(GREEN); |
64 |
1/1✓ Branch 1 taken 1 times.
|
1 | vecStyle.push_back(YELLOW); |
65 |
1/1✓ Branch 1 taken 1 times.
|
1 | vecStyle.push_back(BLUE); |
66 |
1/1✓ Branch 1 taken 1 times.
|
1 | vecStyle.push_back(PURPLE); |
67 |
1/1✓ Branch 1 taken 1 times.
|
1 | vecStyle.push_back(CYAN); |
68 |
1/1✓ Branch 1 taken 1 times.
|
1 | vecStyle.push_back(WHITE); |
69 |
1/1✓ Branch 1 taken 1 times.
|
1 | vecStyle.push_back(BBLACK); |
70 |
1/1✓ Branch 1 taken 1 times.
|
1 | vecStyle.push_back(BRED); |
71 |
1/1✓ Branch 1 taken 1 times.
|
1 | vecStyle.push_back(BGREEN); |
72 |
1/1✓ Branch 1 taken 1 times.
|
1 | vecStyle.push_back(BYELLOW); |
73 |
1/1✓ Branch 1 taken 1 times.
|
1 | vecStyle.push_back(BBLUE); |
74 |
1/1✓ Branch 1 taken 1 times.
|
1 | vecStyle.push_back(BPURPLE); |
75 |
1/1✓ Branch 1 taken 1 times.
|
1 | vecStyle.push_back(BCYAN); |
76 |
1/1✓ Branch 1 taken 1 times.
|
1 | vecStyle.push_back(BWHITE); |
77 | |||
78 |
2/2✓ Branch 4 taken 22 times.
✓ Branch 5 taken 1 times.
|
23 | for(std::vector<PTerminalStyle>::iterator it(vecStyle.begin()); it != vecStyle.end(); ++it){ |
79 |
2/2✓ Branch 3 taken 22 times.
✓ Branch 6 taken 22 times.
|
22 | printColor("Some text", *it); |
80 |
2/2✓ Branch 3 taken 22 times.
✓ Branch 6 taken 22 times.
|
44 | std::string str = colorString("Some cout text", *it); |
81 |
3/3✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
✓ Branch 7 taken 22 times.
|
22 | std::cout << "With string : " << str << std::endl; |
82 |
2/2✓ Branch 3 taken 22 times.
✓ Branch 6 taken 22 times.
|
22 | printColorCerr("Some cerr text", *it); |
83 |
1/1✓ Branch 1 taken 22 times.
|
22 | std::cout << std::endl; |
84 |
1/1✓ Branch 2 taken 22 times.
|
22 | textColor(*it); |
85 |
1/1✓ Branch 2 taken 22 times.
|
22 | textColorCerr(*it); |
86 |
3/3✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
✓ Branch 7 taken 22 times.
|
22 | std::cout << termDefault() << std::endl; |
87 | 22 | } | |
88 |
4/4✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
|
1 | phoenix_assert(b); |
89 | 1 | } | |
90 | |||
91 | 1 | int main(int argc, char** argv){ | |
92 | 1 | testStringColor(); | |
93 | 1 | return 0; | |
94 | } | ||
95 | |||
96 | |||
97 |