Line | Branch | Exec | Source |
---|---|---|---|
1 | /* | ||
2 | ** EPITECH PROJECT, 2023 | ||
3 | ** my_printf | ||
4 | ** File description: | ||
5 | ** The functions for precise an int | ||
6 | */ | ||
7 | /** | ||
8 | * @file precise_it_int.c | ||
9 | * @brief The file containing the precise_it_int function | ||
10 | * @author Nicolas TORO | ||
11 | */ | ||
12 | |||
13 | #include "myprintf.h" | ||
14 | |||
15 | 135 | void precise_it_int(char *str_finale, | |
16 | formating_t *formating, size_t nb) | ||
17 | { | ||
18 | 135 | int precision = formating->id_nb; | |
19 | |||
20 |
4/4✓ Branch 0 taken 134 times.
✓ Branch 1 taken 1 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 132 times.
|
135 | if (precision != 0 && my_strlen(str_finale) < precision) { |
21 | 2 | my_revstr(str_finale); | |
22 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 2 taken 2 times.
|
7 | for (int i = my_strlen(str_finale); i < precision; i++) { |
23 | 5 | my_strcat(str_finale, "0"); | |
24 | } | ||
25 | 2 | my_revstr(str_finale); | |
26 |
3/4✓ Branch 0 taken 1 times.
✓ Branch 1 taken 132 times.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
133 | } else if (precision == 0 && nb == '\0') { |
27 | 1 | str_finale[0] = '\0'; | |
28 | } | ||
29 | 135 | } | |
30 |