GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: tmp_project/StringUtils/TESTS/TEST_COLOR/main.cpp Lines: 72 72 100.0 %
Date: 2024-12-09 15:30:52 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
	textColor("1");
17
1
	textColorCerr("1");
18
1
	std::cout << termDefault() << std::endl;
19
1
	clearTerminal();
20
1
	std::cout << termDefault() << std::endl;
21

1
	std::cout << termBlack() <<"Black" << termDefault() << std::endl;
22

1
	std::cout << termBlink() <<"Blink" << termDefault() << std::endl;
23

1
	std::cout << termBright() <<"Bright" << termDefault() << std::endl;
24

1
	std::cout << termBlue() <<"Blue" << termDefault() << std::endl;
25

1
	std::cout << termCyan() << "Cyan" << termDefault() << std::endl;
26

1
	std::cout << termGreen() << "Green" << termDefault() << std::endl;
27

1
	std::cout << termNegative() << "Negative" << termDefault() << std::endl;
28

1
	std::cout << termPositive() << "Positive" << termDefault() << std::endl;
29

1
	std::cout << termPurple() << "Purple" << termDefault() << std::endl;
30

1
	std::cout << termRed() << "Red" << termDefault() << std::endl;
31

1
	std::cout << termUnderlined() << "Underlined" << termDefault() << std::endl;
32

1
	std::cout << termWhite() << "White" << termDefault() << std::endl;
33

1
	std::cout << termYellow() << "Yellow" << termDefault() << std::endl;
34
35

1
	std::cout << termBBlack() << "Black background" << termDefault() << std::endl;
36

1
	std::cout << termBBlue() << "Blue background" << termDefault() << std::endl;
37

1
	std::cout << termBCyan() << "Cyan background" << termDefault() << std::endl;
38

1
	std::cout << termBGreen() << "Green background" << termDefault() << std::endl;
39

1
	std::cout << termBPurple() << "Purple background" << termDefault() << std::endl;
40

1
	std::cout << termBRed() << "Red background" << termDefault() << std::endl;
41

1
	std::cout << termBWhite() << "White background" << termDefault() << std::endl;
42

1
	std::cout << termBYellow() << "Yellow background" << termDefault() << std::endl;
43
44

1
	std::cout << "testStringColor : nbRowTerminal = " << getNbRowTerminal()<<", NbColTerminal = " << getNbColTerminal()  << std::endl;
45
46
1
	printDelire("Print a lot of color in the same text but I think this is quite useless");
47
1
	std::cout << termDefault() << std::endl;
48
49
1
	printAllCol("col all Print text of full", '=', "Some right text");
50
1
	printAll("cout all Print text of full", '=', "Some right text");
51
1
	printAllCerr("Cerr Print text of full", '=', "Some right text");
52
1
	printAllColCerr("Cerr col all Print text of full", '=', "Some right text");
53
54
1
	std::vector<PTerminalStyle> vecStyle;
55
1
	vecStyle.push_back(NONE);
56
1
	vecStyle.push_back(BRIGHT);
57
1
	vecStyle.push_back(UNDERLINED);
58
1
	vecStyle.push_back(BLINK);
59
1
	vecStyle.push_back(NEGATIVE);
60
1
	vecStyle.push_back(POSITIVE);
61
1
	vecStyle.push_back(BLACK);
62
1
	vecStyle.push_back(RED);
63
1
	vecStyle.push_back(GREEN);
64
1
	vecStyle.push_back(YELLOW);
65
1
	vecStyle.push_back(BLUE);
66
1
	vecStyle.push_back(PURPLE);
67
1
	vecStyle.push_back(CYAN);
68
1
	vecStyle.push_back(WHITE);
69
1
	vecStyle.push_back(BBLACK);
70
1
	vecStyle.push_back(BRED);
71
1
	vecStyle.push_back(BGREEN);
72
1
	vecStyle.push_back(BYELLOW);
73
1
	vecStyle.push_back(BBLUE);
74
1
	vecStyle.push_back(BPURPLE);
75
1
	vecStyle.push_back(BCYAN);
76
1
	vecStyle.push_back(BWHITE);
77
78
23
	for(std::vector<PTerminalStyle>::iterator it(vecStyle.begin()); it != vecStyle.end(); ++it){
79
22
		printColor("Some text", *it);
80
44
		std::string str = colorString("Some cout text", *it);
81
22
		std::cout << "With string : " << str << std::endl;
82
22
		printColorCerr("Some cerr text", *it);
83
22
		std::cout << std::endl;
84
22
		textColor(*it);
85
22
		textColorCerr(*it);
86
22
		std::cout << termDefault() << std::endl;
87
	}
88

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