#include #include "../include/libasm.h" #include "string.h" void test_int(size_t expected_value, size_t value) { if (expected_value != value) printf("[FAILED] %zu != %zu", expected_value, value); else printf("[OK]"); } void test_str(const char *expected_value, const char *value) { if (strcmp(expected_value, value) == 0) printf("[FAILED] %s != %s", expected_value, value); else printf("[OK]"); } void test_int(size_t expected_value, size_t value) { if (expected_value != value) printf("[FAILED] %zu != %zu", expected_value, value); else printf("[OK]"); } void multiple_test_int(size_t (*normal_func)(const char*), size_t (*own_func)(const char*), const char **values) { for (size_t i = 0; values[i] != NULL; i++) { printf("test: %s ", values[i]); test_int(normal_func(values[i]), own_func(values[i])); printf("\n"); } } int main() { const char *strlen_tests[] = {"yo", "", "bonjour", "co\0fgf", NULL}; multiple_test_int(&strlen, ft_strlen, strlen_tests); const char *strlen_tests[][2] = {{"bonjour", "bonjour"}, {"", ""}, {"bonjour", "salut"}, {"co\0fgf", "co\0fgf"}, {}, NULL}; multiple_test_int(&strlen, ft_strlen, strlen_tests); }