reaction_editor.plt 1.29 KB
Newer Older
1 2 3 4 5 6
:- use_module(library(plunit)).


:- begin_tests(reaction_editor).


MARTINEZ Thierry 's avatar
MARTINEZ Thierry committed
7 8 9 10
test(
  'compound',
  [Reactions == [2 * a + 2 * b => 2 * 'a-b']]
) :-
11 12
  clear_model,
  command(add_reaction(2 * a + 2 * b => 2 * a-b)),
MARTINEZ Thierry 's avatar
MARTINEZ Thierry committed
13
  all_items([kind: reaction], Reactions).
14

MARTINEZ Thierry 's avatar
MARTINEZ Thierry committed
15 16
test(
  'catalyst',
17
  [Reactions == [b =[ b + a + c ]=> '_', '_' =[ b + a + c ]=> b]]
MARTINEZ Thierry 's avatar
MARTINEZ Thierry committed
18
) :-
19 20
  clear_model,
  add_reaction(a + b + c <=[ b ]=> a + c),
MARTINEZ Thierry 's avatar
MARTINEZ Thierry committed
21
  simplify_all_reactions,
MARTINEZ Thierry 's avatar
MARTINEZ Thierry committed
22
  all_items([kind: reaction], Reactions).
23

24 25
test(
  'reversible reaction',
26
  [true(Reactions == [1 for a => b, 2 for b => a])]
27 28
) :-
  clear_model,
29
  command((1, 2) for a <=> b),
30
  all_items([kind: reaction], Reactions).
31

FAGES Francois's avatar
FAGES Francois committed
32 33
test(
'michaelis menten reduction',
FAGES Francois's avatar
FAGES Francois committed
34
  [true(Reactions == [(2*'MA'(1) for 'S'=['E'+'C']=>'P')])]
FAGES Francois's avatar
FAGES Francois committed
35 36 37 38 39 40 41 42 43 44
) :-

  command(load('library:examples/michaelis-menten/mm.bc')),
  command(delete_reaction('C'=>'E'+'S')),
  command(merge_reactions('E'+'S'=>'C','C'=>'E'+'P')),
%  command(merge_molecules('E','C')),
  all_items([kind: reaction], Reactions).

test(
'michaelis menten reduction C',
FAGES Francois's avatar
FAGES Francois committed
45
  [true(Reactions == [(2*'MA'(1) for 'S'=['E'+'C']=>'P')])]
FAGES Francois's avatar
FAGES Francois committed
46 47 48 49 50 51 52
) :-

  command(load('library:examples/michaelis-menten/mm.bc')),
  command(merge_reactions('E'+'S'=>'C','C'=>'E'+'P')),
  command(delete_reaction('C'=>'E'+'S')),
  all_items([kind: reaction], Reactions).

53
:- end_tests(reaction_editor).