Advertisement
HeroBaga

Untitled

Oct 30th, 2021
286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. // #include <string.h>
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. #include <check.h>
  5. #include "s21_string.h"
  6.  
  7. // Пишешь сюда тело теста
  8. START_TEST(s21_strlen_test) {
  9. fail_unless(s21_strlen("haha") == 4, "strlen didn't work lol");
  10. fail_unless(s21_strlen("ç") == 2, "strlen didn't work lol");
  11. fail_unless(s21_strlen("") == 0, "strlen didn't work lol");
  12. }
  13. END_TEST
  14.  
  15. START_TEST(s21_strcmp_test) {
  16. fail_unless(s21_strcmp("haha", "haha") == 0, "strcmp didn't work lol");
  17. fail_unless(s21_strcmp("", "haha") == -104, "strcmp didn't work lol");
  18. fail_unless(s21_strcmp("", "") == 0, "strcmp didn't work lol");
  19. }
  20. END_TEST
  21.  
  22. int main(void) {
  23. Suite *s1 = suite_create("Core");
  24. TCase *tc1_1 = tcase_create("Core");
  25. SRunner *sr = srunner_create(s1);
  26. int nf;
  27.  
  28. suite_add_tcase(s1, tc1_1);
  29. // Сюда не забываешь добавлять
  30. tcase_add_test(tc1_1, s21_strlen_test);
  31. tcase_add_test(tc1_1, s21_strcmp_test);
  32.  
  33. srunner_run_all(sr, CK_ENV);
  34. nf = srunner_ntests_failed(sr);
  35. srunner_free(sr);
  36.  
  37. return nf == 0 ? 0 : 1;
  38. }
  39.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement