creation du main de testing et du test de abs

This commit is contained in:
hugogogo
2021-08-10 16:40:52 +02:00
parent bcbe2086f5
commit d8aaada7fc
91 changed files with 4430 additions and 159 deletions

24
testing/srcs/test_abs.c Normal file
View File

@@ -0,0 +1,24 @@
#include "libftest.h"
void compare(int i, int ans)
{
if (ft_abs(i) != ans)
{
RED ft_printf("error: "); COLOREND
ft_printf("ft_abs(%i)", i);
RED ft_printf(" gives "); COLOREND
ft_printf("%i", ft_abs(i));
RED ft_printf(" instead of "); COLOREND
ft_printf("%i\n", ans);
}
}
void test_abs(void)
{
compare(-1, 1);
compare(0, 0);
compare(-0, 0);
compare(-1000, 1000);
compare(-2147483648, 2147483648);
compare(2147483647, 2147483647);
}