-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_to_lower.c
executable file
·83 lines (70 loc) · 2.18 KB
/
test_to_lower.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#include "s21_string_tests.h"
START_TEST(to_lower_1) {
char s1[] = "HELLO, WORLD!";
char *s2 = s21_to_lower(s1);
ck_assert_pstr_eq(s2, "hello, world!");
if (s2) free(s2);
} END_TEST
START_TEST(to_lower_2) {
char s1[] = "already lower";
char *s2 = s21_to_lower(s1);
ck_assert_pstr_eq(s2, "already lower");
if (s2) free(s2);
} END_TEST
START_TEST(to_lower_3) {
char s1[] = "";
char *s2 = s21_to_lower(s1);
ck_assert_pstr_eq(s2, "");
if (s2) free(s2);
} END_TEST
START_TEST(to_lower_4) {
char s1[] = "HaLf LiFe 123456789";
char *s2 = s21_to_lower(s1);
ck_assert_pstr_eq(s2, "half life 123456789");
if (s2) free(s2);
} END_TEST
START_TEST(to_lower_5) {
char s1[] = "\n1234G56789\t";
char *s2 = s21_to_lower(s1);
ck_assert_pstr_eq(s2, "\n1234g56789\t");
if (s2) free(s2);
} END_TEST
START_TEST(to_lower_6) {
char *s1 = s21_NULL;
char *s2 = s21_to_lower(s1);
ck_assert_pstr_eq(s2, s21_NULL);
if (s2) free(s2);
} END_TEST
START_TEST(to_lower_7) {
char *s1 = "~!@#$^&*()_+-SCHOOL21=`;',./<>?:|";
char *s2 = s21_to_lower(s1);
ck_assert_pstr_eq(s2, "~!@#$^&*()_+-school21=`;',./<>?:|");
if (s2) free(s2);
} END_TEST
START_TEST(to_lower_8) {
char s1[] = "London is the capital of Great Britain";
char *s2 = s21_to_lower(s1);
ck_assert_pstr_eq(s2, "london is the capital of great britain");
if (s2) free(s2);
} END_TEST
START_TEST(to_lower_9) {
char s1[] = "How\n can\t I\0 help?";
char *s2 = s21_to_lower(s1);
ck_assert_pstr_eq(s2, "how\n can\t i\0 help?");
if (s2) free(s2);
} END_TEST
Suite *test_to_lower() {
Suite *test_set = suite_create("s21_to_lower");
TCase *test_group = tcase_create("to_lower_test_group");
tcase_add_test(test_group, to_lower_1);
tcase_add_test(test_group, to_lower_2);
tcase_add_test(test_group, to_lower_3);
tcase_add_test(test_group, to_lower_4);
tcase_add_test(test_group, to_lower_5);
tcase_add_test(test_group, to_lower_6);
tcase_add_test(test_group, to_lower_7);
tcase_add_test(test_group, to_lower_8);
tcase_add_test(test_group, to_lower_9);
suite_add_tcase(test_set, test_group);
return test_set;
}