void TestNum_run_tests() { TestBatch *batch = TestBatch_new(53); TestBatch_Plan(batch); test_To_String(batch); test_accessors(batch); test_Equals_and_Compare_To(batch); test_Clone(batch); test_Mimic(batch); DECREF(batch); }
int main( int argc, char **argv ) { FILE *test_fp; char *cp; char test_str[BUF_SIZE]; taskspec_t ts; int dec_result; /* attempt to open the file of test task spec strings */ if (argc == 1) { test_fp = fopen( "test_cases.txt", "r" ); } else if (argc == 2) { if (strlen(argv[1]) == 1 && argv[1][0] == '-') test_fp = stdin; else test_fp = fopen( argv[1], "r" ); } else { printf( "Usage: %s [test-strings-file]\n", argv[0] ); return 1; } if (test_fp == NULL) { perror( "main, fopen" ); return -1; } /* the read, test loop */ while (!feof( test_fp )) { if (fgets( test_str, BUF_SIZE, test_fp ) == NULL) break; /* strip read line of a new-line character, if present */ if ((cp = strchr( test_str, '\n' )) != NULL) *cp = '\0'; printf( "Test string: %s\n", test_str ); dec_result = decode_taskspec( &ts, test_str ); switch( dec_result ) { case 0: printf( "taskspec_t accessor method results:\n" ); test_accessors( &ts ); free_taskspec_struct( &ts ); printf( "\n" ); break; case 1: printf( "Unrecognized or unsupported task spec string version.\n\n" ); break; case -1: fprintf( stderr, "decode_taskspec (task spec string parsing) failed.\n\n" ); break; default: fprintf( stderr, "decode_taskspec returned: %d\n\n", dec_result ); break; } } if (test_fp != stdin) fclose( test_fp ); return 0; }