Commit 8f24de1f authored by Hemery Mathieu's avatar Hemery Mathieu

Add a test for the xpp parser

parent 3e442264
# name: test_xpp
# date: 2020/9/8 - 12:13
dx/dt=y
y'=- (k*f(x*y))
f(x)=sqrt(x)
init x=0
init y=1
parameter k1=2.5
par k2=20.5
# option: method=bsimp
# option: error_epsilon_absolute=1.0e-6
# option: error_epsilon_relative=1.0e-6
# option: initial_step_size=1.0e-6
# option: maximum_step_size=0.01
# option: minimum_step_size=1.0e-5
# option: precision=6
# option: time=20
# option: stochastic_conversion=100
done
:- use_module(library(plunit)).
:- use_module(xpp_parser).
:- begin_tests(xpp_parser, [setup((clear_model, reset_options))]).
test(read_xpp, [nondet]) :-
read_xpp("library/examples/tests/test_xpp.ode"),
get_current_ode_system(Id),
item([parent:Id, type:ode, item: d(x)/dt = y]),
item([parent:Id, type:ode, item: d(y)/dt = -k*f(x*y)]),
item([parent:Id, type:parameter, item: par(k1=2.5)]),
item([parent:Id, type:parameter, item: par(k2=20.5)]),
item([parent:Id, type:function, item: func(f(x)=sqrt(x))]),
write_xpp("library/examples/tests/test_xpp_out.ode"),
clear_model,
read_xpp("library/examples/tests/test_xpp_out.ode"),
get_current_ode_system(Id2),
item([parent:Id2, type:ode, item: d(x)/dt = y]),
item([parent:Id2, type:ode, item: d(y)/dt = -k*f(x*y)]),
item([parent:Id2, type:parameter, item: par(k1=2.5)]),
item([parent:Id2, type:parameter, item: par(k2=20.5)]),
item([parent:Id2, type:function, item: func(f(x)=sqrt(x))]).
:- end_tests(xpp_parser).
Markdown is supported
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