diff --git a/all_test/CMakeLists.txt b/all_test/CMakeLists.txt index 7aa513d..df43eb9 100644 --- a/all_test/CMakeLists.txt +++ b/all_test/CMakeLists.txt @@ -10,6 +10,6 @@ aux_source_directory("${CMAKE_CURRENT_SOURCE_DIR}/src" ALL_TEST_SRCS) add_executable(bus_all_test ${SRCS} ${ALL_TEST_SRCS} main.c) add_custom_command(TARGET bus_all_test POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_if_different - "${CMAKE_CURRENT_SOURCE_DIR}/test_cases/" - $) \ No newline at end of file + COMMAND ${CMAKE_COMMAND} -E copy_directory + "${CMAKE_CURRENT_SOURCE_DIR}/test_cases" + "$/test_cases") \ No newline at end of file diff --git a/all_test/main.c b/all_test/main.c index 4d5333b..b606558 100644 --- a/all_test/main.c +++ b/all_test/main.c @@ -33,7 +33,7 @@ int main() FILE *output_file = NULL; printf("Please choose which test case to use:"); - scanf("%d\n", &index); + scanf("%d", &index); ChooseTestCaseInput(path, index); input_file = fopen(path, "r"); @@ -55,7 +55,11 @@ int main() ReadOutputFile(read_output, output_file); if(CheckOutput(output, read_output) == BUS_FAlSE) { - printf("%s\n", output); + printf("Right:\n"); + printf("%s", read_output); + printf("Wrong:\n"); + printf("%s", output); + printf("\n"); // 打印一个空白作为分界线 } else { @@ -112,7 +116,11 @@ int main() ReadOutputFile(read_output, output_file); if(CheckOutput(output, read_output) == BUS_FAlSE) { - printf("%s\n", output); + printf("Right:\n"); + printf("%s", read_output); + printf("Wrong:\n"); + printf("%s", output); + printf("\n"); // 打印一个空白行作为分界线 } else { diff --git a/all_test/src/tools.c b/all_test/src/tools.c index 8c32166..bb63d27 100644 --- a/all_test/src/tools.c +++ b/all_test/src/tools.c @@ -67,7 +67,7 @@ rail_node_t *ChooseConfigFile(int index) sprintf(case_path, "%d", index); - char file_path[30]; + char file_path[30] = {0}; strcat(file_path, root_path); strcat(file_path, case_path); @@ -106,14 +106,15 @@ rail_node_t *ReadChosenConfigFile(char *config_file_path) p++; } - if (*p == '1' && *(p + 1) != '\n') - { - total_station = 10; - } - else if (*(p + 1) == '\n') + // 讲道理,应该只有两位数,所以就这样处理了 + if (*(p + 1) == '\n' || *(p + 1) == '\0') { total_station = *p - 48; } + else + { + total_station = (*p - 48) * 10 + *(p + 1) - 48; + } break; case 'S': @@ -161,7 +162,7 @@ rail_node_t *ReadChosenConfigFile(char *config_file_path) p++; } - if (*(p + 1) == '\n') + if (*(p + 1) == '\n' || *(p + 1) == '\0') { distance = *p - 48; } diff --git a/all_test/test_cases/1/ouput.txt b/all_test/test_cases/1/output.txt similarity index 100% rename from all_test/test_cases/1/ouput.txt rename to all_test/test_cases/1/output.txt diff --git a/src/controller.c b/src/controller.c index 6121a52..bd52255 100644 --- a/src/controller.c +++ b/src/controller.c @@ -4,4 +4,14 @@ #include "controller.h" bus_query_t *target_query = NULL; -int chosen_strategy = -1; \ No newline at end of file +int chosen_strategy = -1; + +int FCFSDirection() +{ + return BUS_STOP; +} + +bus_query_t *FCFSQuery() +{ + return NULL; +} \ No newline at end of file