diff --git a/tests/testParser.c b/tests/testParser.c index f294dc96296ce3982b318f7910c63bbe3852142f..cc693eff5623250d2b39a4ee1669d6c0fd513fa3 100644 --- a/tests/testParser.c +++ b/tests/testParser.c @@ -32,6 +32,7 @@ int main(int argc, char *argv[]) { /* Create variables that will be set from the parameter file. */ int no_of_threads = 0; int no_of_time_steps = 0; + int kernel = 0; float max_h = 0.0f; double start_time = 0.0; char ic_file [PARSER_MAX_LINE_SIZE]; @@ -48,20 +49,23 @@ int main(int argc, char *argv[]) { /* Retrieve parameters and store them in variables defined above. * Have to specify the name of the parameter as it appears in the * input file: testParserInput.yaml.*/ - parser_get_param_int(¶m_file,"no_of_threads",&no_of_threads); - parser_get_param_int(¶m_file,"no_of_time_steps",&no_of_time_steps); - parser_get_param_float(¶m_file,"max_h",&max_h); - parser_get_param_double(¶m_file,"start_time",&start_time); - parser_get_param_string(¶m_file,"ic_file",ic_file); - + parser_get_param_int(¶m_file,"Scheduler:no_of_threads",&no_of_threads); + parser_get_param_int(¶m_file,"Simulation:no_of_time_steps",&no_of_time_steps); + parser_get_param_float(¶m_file,"Simulation:max_h",&max_h); + parser_get_param_double(¶m_file,"Simulation:start_time",&start_time); + parser_get_param_string(¶m_file,"IO:ic_file",ic_file); + + parser_get_param_int(¶m_file,"kernel",&kernel); + /* Print the variables to check their values are correct. */ - printf("no_of_threads: %d, no_of_time_steps: %d, max_h: %f, start_time: %lf, ic_file: %s\n",no_of_threads, no_of_time_steps, max_h, start_time, ic_file); + printf("no_of_threads: %d, no_of_time_steps: %d, max_h: %f, start_time: %lf, ic_file: %s, kernel: %d\n",no_of_threads, no_of_time_steps, max_h, start_time, ic_file, kernel); assert(no_of_threads == 16); assert(no_of_time_steps == 10); assert(fabs(max_h - 1.1255) < 0.00001); assert(fabs(start_time - 1.23456789) < 0.00001); assert(strcmp(ic_file,"ic_file.ini") == 0); /*strcmp returns 0 if correct.*/ + assert(kernel == 4); return 0; } diff --git a/tests/testParserInput.yaml b/tests/testParserInput.yaml index d695e6a8ddd327e31224f36a6e34767ea8d36408..49638dc3fb1e053aae6b6012d54dbc1e160a4ad3 100644 --- a/tests/testParserInput.yaml +++ b/tests/testParserInput.yaml @@ -1,9 +1,19 @@ --- -no_of_threads: 16 # The number of threads that will be used. -no_of_time_steps: 10 -max_h: 1.1255 -start_time: 1.23456789 -#Input file -ic_file: ic_file.ini +#section_1: +# var_a: 4.5e10 +# var_b: Hello World! +kernel: 4 + +Scheduler: + no_of_threads: 16 # The number of threads that will be used. + +Simulation: + no_of_time_steps: 10 + max_h: 1.1255 + start_time: 1.23456789 + +IO: + #Input file + ic_file: ic_file.ini ...