blob: 44b567aca99bc47444124e56a3864460acb5f2e9 (
plain)
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
|
#include "../libft.h"
#include "test_utils.h"
#include <ctype.h>
static void
_s_test_func (const char *name, int (*ft) (int), int (*libc) (int))
{
int i;
int ok;
ok = 1;
for (i = -1; i <= 255; i++)
{
if (ft (i) != libc (i))
{
printf (" FAIL %s(%d): ft=%d libc=%d\n", name, i, ft (i), libc (i));
_s_fail++;
ok = 0;
}
}
if (ok)
{
printf (" PASS %s (all -1..255)\n", name);
_s_pass++;
}
}
int
main (void)
{
printf ("=== case functions ===\n");
_s_test_func ("ft_toupper", ft_toupper, toupper);
_s_test_func ("ft_tolower", ft_tolower, tolower);
_s_print_results ();
return (_s_fail != 0);
}
|