Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // #include <string.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <check.h>
- #include "s21_string.h"
- // Пишешь сюда тело теста
- START_TEST(s21_strlen_test) {
- fail_unless(s21_strlen("haha") == 4, "strlen didn't work lol");
- fail_unless(s21_strlen("ç") == 2, "strlen didn't work lol");
- fail_unless(s21_strlen("") == 0, "strlen didn't work lol");
- }
- END_TEST
- START_TEST(s21_strcmp_test) {
- fail_unless(s21_strcmp("haha", "haha") == 0, "strcmp didn't work lol");
- fail_unless(s21_strcmp("", "haha") == -104, "strcmp didn't work lol");
- fail_unless(s21_strcmp("", "") == 0, "strcmp didn't work lol");
- }
- END_TEST
- int main(void) {
- Suite *s1 = suite_create("Core");
- TCase *tc1_1 = tcase_create("Core");
- SRunner *sr = srunner_create(s1);
- int nf;
- suite_add_tcase(s1, tc1_1);
- // Сюда не забываешь добавлять
- tcase_add_test(tc1_1, s21_strlen_test);
- tcase_add_test(tc1_1, s21_strcmp_test);
- srunner_run_all(sr, CK_ENV);
- nf = srunner_ntests_failed(sr);
- srunner_free(sr);
- return nf == 0 ? 0 : 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement