Commit 0119a458 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Added a test of the reading of optional parameters.

parent d64d1877
......@@ -50,14 +50,17 @@ int main(int argc, char *argv[]) {
parser_get_param_double(&param_file, "Simulation:start_time");
const int kernel = parser_get_param_int(&param_file, "kernel");
const int optional = parser_get_opt_param_int(&param_file, "optional", 1);
char ic_file[PARSER_MAX_LINE_SIZE];
parser_get_param_string(&param_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;
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment