From f1668b9ab8d9e596b827ab11a356113de39372ed Mon Sep 17 00:00:00 2001 From: tdameros Date: Sun, 4 Aug 2024 00:40:57 +0200 Subject: [PATCH] fix: use streq instead eq in tests --- test/ft_create_elem.c | 6 +++--- test/ft_list_push_front.c | 12 ++++++------ test/ft_list_sort.c | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/test/ft_create_elem.c b/test/ft_create_elem.c index ad50952..3c988fd 100644 --- a/test/ft_create_elem.c +++ b/test/ft_create_elem.c @@ -25,7 +25,7 @@ UTEST(ft_create_elem, null_data) { UTEST(ft_create_elem, non_null_data) { char *data = strdup("Hello, World!"); t_list *elem = ft_create_elem(data); - ASSERT_EQ(elem->data, data); + ASSERT_STREQ(elem->data, data); ASSERT_EQ(elem->next, NULL); free(data); free(elem); @@ -37,9 +37,9 @@ UTEST(ft_create_elem, multiple_elems) { t_list *elem1 = ft_create_elem(data1); t_list *elem2 = ft_create_elem(data2); elem1->next = elem2; - ASSERT_EQ(elem1->data, data1); + ASSERT_STREQ(elem1->data, data1); ASSERT_EQ(elem1->next, elem2); - ASSERT_EQ(elem2->data, data2); + ASSERT_STREQ(elem2->data, data2); ASSERT_EQ(elem2->next, NULL); free(data1); free(data2); diff --git a/test/ft_list_push_front.c b/test/ft_list_push_front.c index 3ccf986..4cab639 100644 --- a/test/ft_list_push_front.c +++ b/test/ft_list_push_front.c @@ -20,7 +20,7 @@ UTEST(ft_list_push_front, null_list) { t_list *list = NULL; char *data = strdup("Hello, World!"); ft_list_push_front(&list, data); - ASSERT_EQ(list->data, data); + ASSERT_STREQ(list->data, data); ASSERT_EQ(list->next, NULL); free(data); free(list); @@ -31,8 +31,8 @@ UTEST(ft_list_push_front, non_null_list) { char *data2 = strdup("Hello, 42!"); t_list *list = ft_create_elem(data1); ft_list_push_front(&list, data2); - ASSERT_EQ(list->data, data2); - ASSERT_EQ(list->next->data, data1); + ASSERT_STREQ(list->data, data2); + ASSERT_STREQ(list->next->data, data1); ASSERT_EQ(list->next->next, NULL); free(data1); free(data2); @@ -47,9 +47,9 @@ UTEST(ft_list_push_front, multiple_elems) { t_list *list = ft_create_elem(data1); ft_list_push_front(&list, data2); ft_list_push_front(&list, data3); - ASSERT_EQ(list->data, data3); - ASSERT_EQ(list->next->data, data2); - ASSERT_EQ(list->next->next->data, data1); + ASSERT_STREQ(list->data, data3); + ASSERT_STREQ(list->next->data, data2); + ASSERT_STREQ(list->next->next->data, data1); ASSERT_EQ(list->next->next->next, NULL); free(data1); free(data2); diff --git a/test/ft_list_sort.c b/test/ft_list_sort.c index da37b5f..5925fdd 100644 --- a/test/ft_list_sort.c +++ b/test/ft_list_sort.c @@ -30,7 +30,7 @@ UTEST(ft_list_sort, empty_list) { UTEST(ft_list_sort, null_cmp) { t_list *list = ft_create_elem("Hello, World!"); ft_list_sort(&list, NULL); - ASSERT_EQ(list->data, "Hello, World!"); + ASSERT_STREQ(list->data, "Hello, World!"); ASSERT_EQ(list->next, NULL); free_list(list); }