-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_task00.c
More file actions
45 lines (41 loc) · 1.4 KB
/
Copy pathtest_task00.c
File metadata and controls
45 lines (41 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include "tests.h"
/**
* test - TASK0 tests.
*
* Return: 0 if all tests are successful, 1 otherwise.
*/
bool test(void)
{
int len__printf = 0, len_sprintf = 0;
bool failed = 0;
PRINTF_TEST_TEMPLATE("Let's print a simple sentence.\n");
PRINTF_TEST_TEMPLATE("%c", 'S');
PRINTF_TEST_TEMPLATE("A char inside a sentence: %c. Did it work?\n", 'F');
PRINTF_TEST_TEMPLATE(
"Let'see if the cast is correctly done: %c. Did it work?\n", 48);
PRINTF_TEST_TEMPLATE("%s", "This sentence is retrieved from va_args!\n");
PRINTF_TEST_TEMPLATE(
"Complete the sentence: You %s nothing, Jon Snow.\n", (char *)0);
PRINTF_TEST_TEMPLATE(
"%c%cth %s%s a%cg%s: Y%sou %s no%ching%s Snow.%c", 'W', 'i', "some ",
"more", 'r', "s", "", "know", 't', ", Jon", '\n');
PRINTF_TEST_TEMPLATE("%%");
PRINTF_TEST_TEMPLATE("Should print a single percent sign: %%\n");
PRINTF_TEST_TEMPLATE(
"%s%c%c%c%s%%%s%c", "Loading ", '.', '.', '.', " 99", " Please wait",
'\n');
PRINTF_TEST_TEMPLATE("css%ccs%scscscs", 'T', "Test");
PRINTF_TEST_TEMPLATE("%c", '\0');
PRINTF_TEST_TEMPLATE("%");
PRINTF_TEST_TEMPLATE("%!\n");
PRINTF_TEST_TEMPLATE("%K\n");
PRINTF_TEST_TEMPLATE("Percent end space:% ");
PRINTF_TEST_TEMPLATE("Percent end newline:%\n");
PRINTF_TEST_TEMPLATE("Percent end paren:%(");
PRINTF_TEST_TEMPLATE("%\t");
PRINTF_TEST_TEMPLATE("%\r");
PRINTF_TEST_TEMPLATE("%\v");
if (!failed)
PRINT_TESTS_PASS_TEXT();
return (failed);
}