Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SWIFT
SWIFTsim
Commits
0119a458
Commit
0119a458
authored
Jun 05, 2016
by
Matthieu Schaller
Browse files
Added a test of the reading of optional parameters.
parent
d64d1877
Changes
1
Hide whitespace changes
Inline
Side-by-side
tests/testParser.c
View file @
0119a458
...
...
@@ -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
;
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment