diff --git a/tests/testParser.c b/tests/testParser.c index 0b08d20c9e2d48de1858877cf186eaa9d0ac84c0..d33cfcd4dc8c7b5d4cf90fc8e944ec2bd5f197bb 100644 --- a/tests/testParser.c +++ b/tests/testParser.c @@ -50,14 +50,17 @@ int main(int argc, char *argv[]) { parser_get_param_double(¶m_file, "Simulation:start_time"); const int kernel = parser_get_param_int(¶m_file, "kernel"); + const int optional = parser_get_opt_param_int(¶m_file, "optional", 1); + char ic_file[PARSER_MAX_LINE_SIZE]; parser_get_param_string(¶m_file, "IO:ic_file", ic_file); /* 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, kernel: %d\n", - no_of_threads, no_of_time_steps, max_h, start_time, ic_file, kernel); + "ic_file: %s, kernel: %d optional: %d\n", + no_of_threads, no_of_time_steps, max_h, start_time, ic_file, kernel, + optional); assert(no_of_threads == 16); assert(no_of_time_steps == 10); @@ -65,6 +68,7 @@ int main(int argc, char *argv[]) { assert(fabs(start_time - 1.23456789) < 0.00001); assert(strcmp(ic_file, "ic_file.ini") == 0); /*strcmp returns 0 if correct.*/ assert(kernel == 4); + assert(optional == 1); return 0; }