Advertisement
2607

test

Nov 20th, 2021
1,534
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.21 KB | None | 0 0
  1. #include <string.h>
  2. #include <check.h>
  3. #include "s21_string.h"
  4.  
  5. START_TEST(s21_strcmp_test)
  6. {
  7.     char *str1 = "12345";
  8.     char *str2 = "12344";
  9.     ck_assert_int_eq(s21_strcmp(str1, str2), strcmp(str1, str2));
  10.     ck_assert_int_eq(s21_strcmp(str1, str1), strcmp(str1, str1));
  11.     char *str3 = "123456789";
  12.     ck_assert_int_eq(s21_strcmp(str1, str3), strcmp(str1, str3));
  13.     char *str4 = "";
  14.     char *str5 = " ";
  15.     ck_assert_int_eq(s21_strcmp(str4, str4), strcmp(str4, str4));
  16.     ck_assert_int_eq(s21_strcmp(str4, str5), strcmp(str4, str5));
  17.  
  18. }
  19. END_TEST
  20.  
  21. START_TEST(s21_strncmp_test)
  22. {
  23.    
  24. }
  25. END_TEST
  26.  
  27. START_TEST(s21_strcpy_test)
  28. {
  29.    
  30. }
  31. END_TEST
  32.  
  33. START_TEST(s21_strncpy_test)
  34. {
  35.    
  36. }
  37. END_TEST
  38.  
  39. int main(void)
  40. {
  41.     Suite *s1 = suite_create("Core");
  42.     TCase *tc1_1 = tcase_create("Core");
  43.     SRunner *sr = srunner_create(s1);
  44.     int nf;
  45.  
  46.     suite_add_tcase(s1, tc1_1);
  47.     tcase_add_test(tc1_1, s21_strcmp_test);
  48.     tcase_add_test(tc1_1, s21_strncmp_test);
  49.     tcase_add_test(tc1_1, s21_strcpy_test);
  50.     tcase_add_test(tc1_1, s21_strncpy_test);
  51.  
  52.     srunner_run_all(sr, CK_ENV);
  53.     nf = srunner_ntests_failed(sr);
  54.     srunner_free(sr);
  55.  
  56.     return nf == 0 ? 0 : 1;
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement