Commit 68c87a50 authored by Thierry Martinez's avatar Thierry Martinez
parents 9287eb77 2f6bfe91
:- use_module(library(plunit)).
:- use_module(reaction_rules).
:- begin_tests(conservation_laws).
......@@ -62,9 +62,8 @@ test(
cleanup(models:clear_model)
]
) :-
% not written 'a => b' to allow flycheck by separate compilation…
command(add_reaction('=>'(a, b))),
command(add_reaction('=>'(b, a))),
command(add_reaction(a => b)),
command(add_reaction(b => a)),
command(add_conservation(a + b)),
with_output_to(atom(_), command(check_conservations)).
......@@ -76,9 +75,8 @@ test(
cleanup(models:clear_model)
]
) :-
% writing with 'command' produces a parsing error on k…
add_reaction('for'(k*[a], '=>'(a, b))),
add_reaction('for'(k*[a], '=>'(a, 2*a))),
command(add_reaction(k*[a] for a => b)),
command(add_reaction(k*[a] for a => 2*a)),
command(add_conservation(a)),
with_output_to(atom(_), command(check_conservations)).
......
......@@ -124,8 +124,7 @@ check_type(Grammar, Item, NewItem) :-
NewHead =.. [Grammar, NewItem],
(
clause(NewHead, NewBody),
copy_term((NewHead, NewBody), (Head, Body))
->
copy_term((NewHead, NewBody), (Head, Body)),
check_grammar_body(Body, NewBody)
;
throw(error(expected(Grammar)))
......@@ -137,7 +136,7 @@ check_atom(Atom, NewAtom) :-
check_number(Number, NewNumber) :-
NewNumber is Number.
catch(NewNumber is Number, error(_, _), fail).
check_grammar_body((A, B), (NewA, NewB)) :-
......
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