int main(void) { set(MAGENTA); set(BOLD); printf("\n\t\t\t\t\t\t\t\t=============== FUNCTIONS ===============\n\n"); set(UNCOLOR); test_bzero(); test_strcat(); test_isalpha(); test_isdigit(); test_isalnum(); test_isascii(); test_isprint(); test_toupper(); test_tolower(); test_puts(); test_strlen(); test_memset(); test_memcpy(); test_strdup(); set(MAGENTA); set(BOLD); printf("\t\t\t\t\t\t\t\t================= BONUS =================\n\n"); set(UNCOLOR); test_islower(); test_isupper(); test_strcpy(); test_putchar(); test_putstr(); return (0); }
int main(int argc, char **argv) { test_strlen(); test_strcat(); return 0; }
/* void test_putstr(void) { char str[] = "PUTSTR"; printf("\033[1;33m%s\033[0m\n", str); ft_putstr("Bonjour"); ft_putstr(" les"); ft_putstr(" amis"); ft_putstr(" !"); ft_putstr("\n"); ft_putstr(NULL); ft_putstr("\n"); printf("\033[1;32m%s passed.\033[0m\n\n", str); } void test_add(void) { //This function adds i & j char str[] = "ADD"; printf("\033[1;33m%s\033[0m\n", str); printf("3 + 5 = %d\n", ft_add(3, 5)); printf("39 + 39 = %d\n", ft_add(39, 39)); printf("0 + 0 = %d\n", ft_add(0, 0)); printf("0 + (-100) = %d\n", ft_add(0, -100)); printf("\033[1;32m%s passed.\033[0m\n\n", str); } void test_mult(void) { //This function multiplies i & j char str[] = "MULT"; printf("\033[1;33m%s\033[0m\n", str); printf("3 * 5 = %d\n", ft_mult(3, 5)); printf("39 * 39 = %d\n", ft_mult(39, 39)); printf("-3 * -1000 = %d\n", ft_mult(-3, -1000)); printf("0 * (-100) = %d\n", ft_mult(0, -100)); printf("\033[1;32m%s passed.\033[0m\n\n", str); } void test_putstr_fd(void) { char str[] = "PUTSTR_FD"; printf("\033[1;33m%s\033[0m\n", str); ft_putstr_fd("Bonjour", 2); ft_putstr_fd(" les", 1); ft_putstr_fd(" amis", 2); ft_putstr_fd(" !", 1); ft_putstr_fd("\n", 3); ft_putstr_fd(NULL, 1); ft_putstr_fd("\n", 1); printf("\033[1;32m%s passed.\033[0m\n\n", str); } void test_strclr(void) { char str[] = "STRCLR"; char str1[] = "COUCOU"; char str2[] = "LES"; printf("\033[1;33m%s\033[0m\n", str); printf("%s et %s deviennent : \n", str1, str2); ft_strclr(str1); ft_strclr(str2); printf("%s et %s\n", str1, str2); printf("\033[1;32m%s passed.\033[0m\n\n", str); } */ int main(void) { test_isascii(); test_isdigit(); test_isalpha(); test_isalnum(); test_isprint(); test_bzero(); //test_toupper(); //test_tolower(); test_strlen(); test_strcat(); test_memset(); test_memcpy(); test_puts(); test_strdup(); test_cat(); printf("\n\n\033[1;32m !! BONUS !! \033[0m\n\n"); //test_putstr(); //test_add(); //test_mult(); //test_putstr_fd(); //test_strclr(); test_strnew(); test_putchar(); return (0); }
int main (int argc, char *argv[]) { test_sprintf (); test_vsprintf (); test_strdup (); test_strndup (); test_strcat (); test_strncat (); test_strcat_sprintf (); test_strcat_vsprintf (); test_str_split (); test_array_new (); test_array_add (); test_array_addn (); test_array_addp (); test_array_copy (); test_array_append (); test_str_wrap (); test_str_screen_width (); test_str_screen_wrap (); return 0; }
int main ( int argc, char *argv[] ) { int failed = 0; int ntest = 1000; int i; newstr s; newstr_init( &s ); for ( i=0; i<ntest; ++i ) failed += test_empty( &s ); for ( i=0; i<ntest; ++i) failed += test_addchar( &s ); for ( i=0; i<ntest; ++i) failed += test_strcat( &s ); for ( i=0; i<ntest; ++i) failed += test_strcpy( &s ); for ( i=0; i<ntest; ++i) failed += test_segcpy( &s ); for ( i=0; i<ntest; ++i) failed += test_segcat( &s ); for ( i=0; i<ntest; ++i) failed += test_findreplace( &s ); newstr_free( &s ); if ( !failed ) { printf( "%s: PASSED\n", progname ); return EXIT_SUCCESS; } else { printf( "%s: FAILED\n", progname ); return EXIT_FAILURE; } return EXIT_SUCCESS; }
int main() { //strcpy printf("%d\n", test_strcpy("hello", 0)); //strncpy printf("%d\n", test_strncpy("hellohellohello", 7, 0)); printf("%d\n", test_strncpy("hello", 7, 0)); printf("%d\n", test_strncpy("hellohello", 10, 0)); //strcmp printf("%d\n", test_strcmp("aaa", "arc", 0)); printf("%d\n", test_strcmp("abc", "abc", 0)); printf("%d\n", test_strcmp("ccc", "abc", 0)); //strncmp printf("%d\n", test_strncmp("aaaddd", "alcccc", 3, 0)); printf("%d\n", test_strncmp("abcddd", "abcccc", 3, 0)); printf("%d\n", test_strncmp("cccddd", "abcccc", 3, 0)); //strcat printf("%d\n", test_strcat("world", "hello", 0)); printf("%d\n", test_strcat("fg", "", 0)); printf("%d\n", test_strcat("", "hello", 0)); //strncat printf("%d\n", test_strncat("world", "hello", 3, 0)); printf("%d\n", test_strncat("world", "hello", 10, 0)); printf("%d\n", test_strncat("", "hello", 10, 0)); //strlen printf("%d\n", test_strlen("", 0)); printf("%d\n", test_strlen("hello", 0)); //strchr printf("%d\n", test_strchr("world", 'r', 0)); printf("%d\n", test_strchr("world", 'a', 0)); printf("%d\n", test_strchr("", 'a', 0)); //strstr printf("%d\n", test_strstr("world", "rl", 0)); printf("%d\n", test_strstr("needle", "nee", 0)); printf("%d\n", test_strstr("world", "hello", 0)); return 0; }
int main(int argc, char **argv) { test_strcmp(); test_strcat(); test_strstr(); test_strncat(); if (!nondet) crashes_gcc(); test_strtok(); test_strtok_r(); return 0; }
int main(int argc, char **argv) { test_strcmp(); test_strcat(); test_strstr(); test_strncat(); if (!nondet) crashes_gcc(); test_strtok(); test_strtok_r(); char *a = strdup("bla"); // unsound; specification currently unsupported char *b = strndup("bla", 2); // unsound; specification currently unsupported return 0; }
int main () { test_slice_positive_sub_str(); test_slice_equal_offlim(); test_slice_negative_offset(); test_slice_negative_limit(); test_slice_both_negative(); test_slice_limit_oor(); test_slice_offset_oor(); test_slice_empty_string(); test_strcpy_no_alloc(); test_strcpy_pre_alloc(); test_strcpy_not_empty(); test_strcpy_empty_paras(); test_strcat(); test_strcat_empty_source(); test_strcat_empty_destination(); test_strcat_empty_params(); test_split(); test_split_multiple_delims(); test_split_delim_not_found(); test_split_empty_delim(); test_split_single_delim(); test_split_empty_paras(); test_startswith(); test_startwith_empy_string(); test_startwith_empy_prefix(); test_startwith_empty_params(); test_endswith(); test_endswith_empty_string(); test_endswith_empty_postfix(); test_endswith_empty_params(); test_strip_no_chars(); test_strip_with_chars(); test_strip_empty_params(); test_translate(); test_translate_empty_params(); test_splitlines(); test_splitlines_keepends(); test_splitlines_empty_params(); test_count(); test_count_empty_params(); test_expandtabs(); test_expandtabs_no_params(); return 0; }
int main() { test_strchr(); test_strcmp(); test_strncmp(); test_strcpy(); test_strncpy(); test_strcspn(); test_strlen(); test_strcat(); test_strncat(); test_strpbrk(); test_strrchr(); test_strspn(); test_strstr(); test_strtok(); return 0; }
int main(void) { ft_puts("\033[33m\n/!\\Change test_is last value from '0' to '1'\ndirectly in main if you want to see tests details./!\\\n\033[00m"); test_is(isdigit, ft_isdigit, "isdigit", 0); test_is(isalnum, ft_isalnum, "isalnum", 0); test_is(isalpha, ft_isalpha, "isalpha", 0); test_is(isascii, ft_isascii, "isascii", 0); test_is(toupper, ft_toupper, "toupper", 0); test_is(tolower, ft_tolower, "tolower", 0); test_bzero(ft_bzero, "bzero", 10); test_strcat(ft_strcat, "strcat"); test_puts(ft_puts, "ft_puts"); test_strlen(ft_strlen, "strlen", 26); test_memset(ft_memset, "memset", 10); test_memcpy("memcpy", 26); test_strdup("strdup", 10); ft_puts(""); return (0); }
int main() { test_isalpha(); test_isdigit(); test_isalnum(); test_isascii(); test_isprint(); test_tolower(); test_toupper(); test_bzero(); test_strcat(); test_strlen(); test_memset(); test_memcpy(); test_puts(); test_strdup(); test_strcmp(); test_cat(); test_isspace(); }
int main(int argc, char **argv) { test_memcpy(); test_memmove(); test_strlen(); test_strnlen(); test_memset(); test_strcmp(); test_strncmp(); test_memcmp(); test_strcat(); // strncat is not tested (code from the man page) test_strcpy(); test_strncpy(); test_strchr(); test_strrchr(); test_memchr(); test_memrchr(); test_strstr(); // strerror not tested // strdup not tested (uses malloc) // strndup not tested (uses malloc) return 0; }
int main ( int argc, char *argv[] ) { int failed = 0; int ntest = 2; int i; newstr s; newstr_init( &s ); /* ...core functions */ for ( i=0; i<ntest; ++i ) failed += test_empty( &s ); /* ...adding functions */ for ( i=0; i<ntest; ++i) failed += test_addchar( &s ); for ( i=0; i<ntest; ++i) failed += test_strcat( &s ); for ( i=0; i<ntest; ++i ) failed += test_newstrcat( &s ); for ( i=0; i<ntest; ++i ) failed += test_segcat( &s ); for ( i=0; i<ntest; ++i ) failed += test_indxcat( &s ); for ( i=0; i<ntest; ++i ) failed += test_cattodelim( &s ); for ( i=0; i<ntest; ++i ) failed += test_prepend( &s ); for ( i=0; i<ntest; ++i ) failed += test_pad( &s ); for ( i=0; i<ntest; ++i ) failed += test_mergestrs( &s ); for ( i=0; i<ntest; ++i ) failed += test_makepath( &s ); /* ...copying functions */ for ( i=0; i<ntest; ++i) failed += test_strcpy( &s ); for ( i=0; i<ntest; ++i) failed += test_newstrcpy( &s ); for ( i=0; i<ntest; ++i ) failed += test_cpytodelim( &s ); for ( i=0; i<ntest; ++i) failed += test_segcpy( &s ); for ( i=0; i<ntest; ++i) failed += test_indxcpy( &s ); for ( i=0; i<ntest; ++i ) failed += test_copyposlen( &s ); for ( i=0; i<ntest; ++i ) failed += test_strdup(); /* ...utility functions */ for ( i=0; i<ntest; ++i) failed += test_findreplace( &s ); for ( i=0; i<ntest; ++i ) failed += test_reverse( &s ); for ( i=0; i<ntest; ++i ) failed += test_toupper( &s ); for ( i=0; i<ntest; ++i ) failed += test_tolower( &s ); for ( i=0; i<ntest; ++i ) failed += test_trimws( &s ); for ( i=0; i<ntest; ++i ) failed += test_trim( &s ); for ( i=0; i<ntest; ++i ) failed += test_case( &s ); for ( i=0; i<ntest; ++i ) failed += test_newstrcmp( &s ); for ( i=0; i<ntest; ++i ) failed += test_char( &s ); for ( i=0; i<ntest; ++i ) failed += test_swapstrings( &s ); for ( i=0; i<ntest; ++i ) failed += test_match( &s ); newstr_free( &s ); if ( !failed ) { printf( "%s: PASSED\n", progname ); return EXIT_SUCCESS; } else { printf( "%s: FAILED\n", progname ); return EXIT_FAILURE; } return EXIT_SUCCESS; }
int main(void) { printf("\n"); printf ("\033[31m1 = Oui / 0 = Non\n\n\033[0m"); printf("\033[33m=== FT_BZERO ===\n\033[0m"); test_bzero(); printf("\n"); printf("\033[33m=== FT_STRCAT ===\n\033[0m"); test_strcat(); printf("\n"); printf("\033[33m=== FT_ISALPHA ===\n\033[0m"); test_isalpha(); printf("\n"); printf("\033[33m=== FT_ISDIGIT ===\n\033[0m"); test_isdigit(); printf("\n"); printf("\033[33m=== FT_ISALNUM ===\n\033[0m"); test_isalnum(); printf("\n"); printf("\033[33m=== FT_ISASCII ===\n\033[0m"); test_isascii(); printf("\n"); printf("\033[33m=== FT_ISPRINT ===\n\033[0m"); test_isprint(); printf("\n"); printf("\033[33m=== FT_TOUPPER ===\n\033[0m"); test_toupper(); printf("\n"); printf("\033[33m=== FT_TOLOWER ===\n\033[0m"); test_tolower(); printf("\n"); printf("\033[33m=== FT_PUTS ===\n\033[0m"); test_puts(); printf("\n"); printf("\033[33m=== FT_STRLEN ===\n\033[0m"); test_strlen(); printf("\n"); printf("\033[33m=== FT_MEMSET ===\n\033[0m"); test_memset(); printf("\n"); printf("\033[33m=== FT_STRDUP ===\n\033[0m"); test_strdup(); printf("\n"); printf("\033[33m=== FT_MEMCPY ===\n\033[0m"); test_memcpy(); printf("\n"); printf("\033[33m=== FT_CAT ===\n\033[0m"); test_cat(); printf("\n"); return (0); }