Merge branch 'dev'
This commit is contained in:
		@@ -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_executable(bus_all_test ${SRCS} ${ALL_TEST_SRCS} main.c)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
add_custom_command(TARGET bus_all_test POST_BUILD
 | 
					add_custom_command(TARGET bus_all_test POST_BUILD
 | 
				
			||||||
        COMMAND ${CMAKE_COMMAND} -E copy_if_different
 | 
					        COMMAND ${CMAKE_COMMAND} -E copy_directory
 | 
				
			||||||
        "${CMAKE_CURRENT_SOURCE_DIR}/test_cases/"
 | 
					        "${CMAKE_CURRENT_SOURCE_DIR}/test_cases"
 | 
				
			||||||
        $<TARGET_FILE_DIR:bus_all_test>)
 | 
					        "$<TARGET_FILE_DIR:bus_all_test>/test_cases")
 | 
				
			||||||
@@ -33,7 +33,7 @@ int main()
 | 
				
			|||||||
    FILE *output_file = NULL;
 | 
					    FILE *output_file = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    printf("Please choose which test case to use:");
 | 
					    printf("Please choose which test case to use:");
 | 
				
			||||||
    scanf("%d\n", &index);
 | 
					    scanf("%d", &index);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ChooseTestCaseInput(path, index);
 | 
					    ChooseTestCaseInput(path, index);
 | 
				
			||||||
    input_file = fopen(path, "r");
 | 
					    input_file = fopen(path, "r");
 | 
				
			||||||
@@ -55,7 +55,11 @@ int main()
 | 
				
			|||||||
    ReadOutputFile(read_output, output_file);
 | 
					    ReadOutputFile(read_output, output_file);
 | 
				
			||||||
    if(CheckOutput(output, read_output) == BUS_FAlSE)
 | 
					    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
 | 
					    else
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
@@ -112,7 +116,11 @@ int main()
 | 
				
			|||||||
            ReadOutputFile(read_output, output_file);
 | 
					            ReadOutputFile(read_output, output_file);
 | 
				
			||||||
            if(CheckOutput(output, read_output) == BUS_FAlSE)
 | 
					            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
 | 
					            else
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -67,7 +67,7 @@ rail_node_t *ChooseConfigFile(int index)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    sprintf(case_path, "%d", index);
 | 
					    sprintf(case_path, "%d", index);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    char file_path[30];
 | 
					    char file_path[30] = {0};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    strcat(file_path, root_path);
 | 
					    strcat(file_path, root_path);
 | 
				
			||||||
    strcat(file_path, case_path);
 | 
					    strcat(file_path, case_path);
 | 
				
			||||||
@@ -106,14 +106,15 @@ rail_node_t *ReadChosenConfigFile(char *config_file_path)
 | 
				
			|||||||
                    p++;
 | 
					                    p++;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                if (*p == '1' && *(p + 1) != '\n')
 | 
					                // 讲道理,应该只有两位数,所以就这样处理了
 | 
				
			||||||
                {
 | 
					                if (*(p + 1) == '\n' || *(p + 1) == '\0')
 | 
				
			||||||
                    total_station = 10;
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
                else if (*(p + 1) == '\n')
 | 
					 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    total_station = *p - 48;
 | 
					                    total_station = *p - 48;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					                else
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    total_station = (*p - 48) * 10 + *(p + 1) - 48;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
            case 'S':
 | 
					            case 'S':
 | 
				
			||||||
@@ -161,7 +162,7 @@ rail_node_t *ReadChosenConfigFile(char *config_file_path)
 | 
				
			|||||||
                    p++;
 | 
					                    p++;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                if (*(p + 1) == '\n')
 | 
					                if (*(p + 1) == '\n' || *(p + 1) == '\0')
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    distance = *p - 48;
 | 
					                    distance = *p - 48;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -70,7 +70,7 @@ rail_node_t *ReadConfigFile()
 | 
				
			|||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                // 讲道理,应该只有两位数,所以就这样处理了
 | 
					                // 讲道理,应该只有两位数,所以就这样处理了
 | 
				
			||||||
                if (*(p + 1) == '\n')
 | 
					                if (*(p + 1) == '\n' || *(p + 1) == '\0')
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    total_station = *p - 48;
 | 
					                    total_station = *p - 48;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
@@ -125,7 +125,7 @@ rail_node_t *ReadConfigFile()
 | 
				
			|||||||
                    p++;
 | 
					                    p++;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                if (*(p + 1) == '\n')
 | 
					                if (*(p + 1) == '\n' || *(p + 1) == '\0')
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    distance = *p - 48;
 | 
					                    distance = *p - 48;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,3 +5,13 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
bus_query_t *target_query = NULL;
 | 
					bus_query_t *target_query = NULL;
 | 
				
			||||||
int chosen_strategy = -1;
 | 
					int chosen_strategy = -1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int FCFSDirection()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    return BUS_STOP;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					bus_query_t *FCFSQuery()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    return NULL;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Reference in New Issue
	
	Block a user