| Line |
Branch |
Exec |
Source |
| 1 |
|
|
/* |
| 2 |
|
|
** EPITECH PROJECT, 2024 |
| 3 |
|
|
** zappy/ai/utils |
| 4 |
|
|
** File description: |
| 5 |
|
|
** PrintColor.cpp |
| 6 |
|
|
*/ |
| 7 |
|
|
|
| 8 |
|
|
#include "PrintColor.hpp" |
| 9 |
|
|
|
| 10 |
|
3 |
void printColor(const std::string &message, const std::string &color) |
| 11 |
|
|
{ |
| 12 |
|
3 |
std::cout << color << message << COLOR_RESET; |
| 13 |
|
3 |
} |
| 14 |
|
|
|
| 15 |
|
✗ |
void printKeyValueColored(const std::string &key, const std::string &value) |
| 16 |
|
|
{ |
| 17 |
|
✗ |
printKeyValueColored(key, value, PRINT_STATE_INFO); |
| 18 |
|
✗ |
} |
| 19 |
|
1 |
void printKeyValueColored(const std::string &key, const std::string &value, PRINT_STATE state) |
| 20 |
|
|
{ |
| 21 |
|
1 |
std::string color = ""; |
| 22 |
|
|
|
| 23 |
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 |
if (state == PRINT_STATE_INFO) |
| 24 |
|
|
color = BRIGHT_WHITE; |
| 25 |
|
✗ |
else if (state == PRINT_STATE_WARNING) |
| 26 |
|
|
color = YELLOW; |
| 27 |
|
✗ |
else if (state == PRINT_STATE_SUCESS) |
| 28 |
|
|
color = GREEN; |
| 29 |
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
|
2 |
printColor(key + ": ", YELLOW); |
| 30 |
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
2 |
printColor(value + "\n", color); |
| 31 |
|
1 |
} |
| 32 |
|
|
|