Compare commits

..

No commits in common. "1c7245213e8f618444d8b92226a10a38fcfcc60f" and "1d7727e9ff877f7ad4068ab768f99636bf72e8b4" have entirely different histories.

2 changed files with 6 additions and 28 deletions

View File

@ -15,5 +15,5 @@ loop:
jmp loop
out:
mov rax, rdi
mov rax, rcx
ret

View File

@ -20,7 +20,7 @@ void test_int(int expected_value, int value)
void test_str(const char *expected_value, const char *value)
{
if (strcmp(expected_value, value))
if (strcmp(expected_value, value) == 0)
printf("[FAILED] %s != %s", expected_value, value);
else
printf("[OK]");
@ -46,35 +46,13 @@ void multiple_test_int_2(int (*normal_func)(const char *, const char *), int (*o
}
}
void multiple_test_strcpy(int (*own_func)(char *, const char *), const char * const *values)
{
char tmp[4096];
for (size_t i = 0; values[i] != NULL; i++)
{
printf("test: %s", values[i]);
test_int(strcpy(tmp, values[i]), own_func(tmp, values[i]));
test_str(values[i], tmp);
printf("\n");
}
}
int main()
{
printf("STRLEN\n");
const char *strlen_tests[] = {"yo", "", "bonjour", "co\0fgf", NULL};
multiple_test_int(strlen, ft_strlen, strlen_tests);
printf("\n");
printf("STRCMP\n");
const char *strcmp_tests[][2] = {{"w", "z"}, {"bonjour", "bonjour"}, {"", ""}, {"bonjour", "salut"}, {"co\0fgf", "co\0fgf"}, NULL};
multiple_test_int_2(strcmp, ft_strcmp, strcmp_tests);
printf("\n");
multiple_test_int(&strlen, ft_strlen, strlen_tests);
printf("STRCPY\n");
const char *strcpy_tests[] = {"yo", "", "bonjour", "co\0fgf", NULL};
multiple_test_strcpy(ft_strcpy, strcpy_tests);
printf("\n");
const char *strcmp_tests[][2] = {{"w", "z"}, {"bonjour", "bonjour"}, {"", ""}, {"bonjour", "salut"}, {"co\0fgf", "co\0fgf"}, NULL};
multiple_test_int_2(&strcmp, ft_strcmp, strcmp_tests);
}