Fix typo in comment
[eleutheria.git] / atf / t_str.c
blobebbb311992bdc900f8189c90fce4e5321450b8e4
1 /*
2 * Compile with:
3 * gcc t_str.c -o t_str `pkg-config --cflags --libs atf-c`
4 */
6 #include <stdio.h>
7 #include <string.h>
9 #include <atf-c.h>
11 /* Test case 1 -- strstr() */
12 ATF_TC(test_strstr);
13 ATF_TC_HEAD(test_strstr, tc)
15 atf_tc_set_md_var(tc, "descr", "Tests the strstr(3) function");
17 ATF_TC_BODY(test_strstr, tc)
19 char s1[] = "This is a big string";
20 char s2[] = "big";
21 char s3[] = "none";
23 ATF_CHECK(strstr(s1, s2) != NULL);
24 ATF_CHECK(strstr(s1, s3) == NULL);
27 /* Test case 2 -- strcmp() */
28 ATF_TC(test_strcmp);
29 ATF_TC_HEAD(test_strcmp, tc)
31 atf_tc_set_md_var(tc, "descr", "Tests the strcmp(3) function");
33 ATF_TC_BODY(test_strcmp, tc)
35 char s1[] = "a";
36 char s2[] = "b";
37 char s3[] = "aaa";
39 ATF_CHECK(strcmp(s1, s1) == 0);
40 ATF_CHECK(strcmp(s1, s2) < 0);
41 ATF_CHECK(strcmp(s1, s3) < 0);
44 /* Add test cases to test program */
45 ATF_TP_ADD_TCS(tp)
47 ATF_TP_ADD_TC(tp, test_strstr);
48 ATF_TP_ADD_TC(tp, test_strcmp);
50 return atf_no_error();