int test_case_7(char **argv) { char **args = (char **) malloc(sizeof(char *) * 3); args[0] = argv[0]; args[1] = argv[1]; args[2] = "local_file"; int r2 = test_case_2(argv, 1024); if (r2) { printf("test_case_7() : fail on test_case_2\n"); } else { printf("test_case_7(): test_case_2 OK\n"); } args[2] = "local_file_medium"; int r6 = test_case_4(argv, 4096); if (r2) { printf("test_case_7() : fail on test_case_4]n"); } else { printf("test_case_7(): test_case_4 OK]n"); } args[2] = "local_file_large"; int r8 = test_case_6(argv, 8192); if (r2) { printf("test_case_7() : fail on test_case_6\n"); } else { printf("test_case_7(): test_case_6 OK\n"); } return r2 || r6 || r8; }
int main(int argc, char **argv) { assert(argc == 3); char *result[2]; result[0] = "PASS"; result[1] = "FAILED"; printf("TEST CASE 0:%s\n", result[test_case_0(argv, 2)]); //generate data //can contact to single datanode generate_data("local_file", 1024); printf("TEST CASE 1:%s\n", result[test_case_1(argv, 1)]); printf("TEST CASE 2:%s\n", result[test_case_2(argv, 0)]); //can contact to two datanodes generate_data("local_file_medium", 4096); printf("TEST CASE 3:%s\n", result[test_case_3(argv, 1)]); printf("TEST CASE 4:%s\n", result[test_case_4(argv, 0)]); //can handle chunk pieces generate_data("local_file_large", 8192); printf("TEST CASE 5:%s\n", result[test_case_5(argv, 1)]); printf("TEST CASE 6:%s\n", result[test_case_6(argv, 0)]); //check every file is stored correctly printf("TEST CASE 7:%s\n", result[test_case_7(argv)]); //modify the file append_data("local_file", 1024); printf("TEST CASE 8:%s\n", result[test_case_8(argv, 3)]); return 0; }
int test_case_7(char **argv) { char **args = (char **) malloc(sizeof(char *) * 3); args[0] = argv[0]; args[1] = argv[1]; args[2] = "local_file"; int r2 = test_case_2(argv, 1024); args[2] = "local_file_medium"; int r6 = test_case_4(argv, 4096); args[2] = "local_file_large"; int r8 = test_case_6(argv, 8192); return r2 || r6 || r8; }