3 * gcc t_str.c -o t_str `pkg-config --cflags --libs atf-c`
11 /* Test case 1 -- 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";
23 ATF_CHECK(strstr(s1
, s2
) != NULL
);
24 ATF_CHECK(strstr(s1
, s3
) == NULL
);
27 /* Test case 2 -- 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
)
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 */
47 ATF_TP_ADD_TC(tp
, test_strstr
);
48 ATF_TP_ADD_TC(tp
, test_strcmp
);
50 return atf_no_error();