Example #1
0
int main() {
	char s[] = "toto";
	printf("%d\n", mon_strlen(s));
	
	char s1[20] = "abce";
	char s2[] = "abcd";
	printf("%d\n", mon_strcmp(s1, s2));
	printf("%d\n", mon_strncmp(s1, s2, 3));
	printf("%s + %s = %s \n", s1, s2, mon_strcat(s1, s2));
	printf("%c\n", *mon_strchr(s, 'o'));
	
	char str[] = "abcdef";
	char substr[] = "cd";
	printf("%s\n", mon_strstr(str, substr));
	
	return 0;
}
Example #2
0
MU_TEST(mon_strchr, mon_strchr_empty_string) {
    const char *str = "" ;
    const char *result ;
    result = mon_strchr(str, 'C') ;
    MU_ASSERT_EQUAL(result, NULL) ;
}
Example #3
0
MU_TEST(mon_strchr, mon_strchr_c_first_found) {
    const char *str = "ABCDECFG" ;
    const char *result ;
    result = mon_strchr(str, 'C') ;
    MU_ASSERT_EQUAL(result, str+2) ;
}
Example #4
0
MU_TEST(mon_strchr, mon_strchr_c_not_found) {
    const char *str = "ABCDEF" ;
    const char *result ;
    result = mon_strchr(str, 'G') ;
    MU_ASSERT_EQUAL(result, NULL) ;
}
Example #5
0
MU_TEST(mon_strchr, mon_strchr_c_found) {
    const char *str = "ABCDEF" ;
    const char *result ;
    result = mon_strchr(str, 'D') ;
    MU_ASSERT_EQUAL(result, str+3) ;
}