reaction_graphs.plt 1.26 KB
Newer Older
1 2 3 4 5 6 7 8 9 10
:- use_module(library(plunit)).


:- begin_tests(reaction_graphs).


test(
  'reaction_graph',
  [true((
     Edges == ['A' -> 'reaction0', 'reaction0' -> 'B'],
MARTINEZ Thierry 's avatar
MARTINEZ Thierry committed
11 12
     Reversible == true,
     Stoichiometry == 2,
13 14 15 16 17 18 19 20 21 22
     Kinetics == 'MA'(3)
   ))]
) :-
  clear_model,
  add_reaction('MA'(3) for 'A' <=> 2 * 'B'),
  reaction_graph,
  get_current_graph(GraphId),
  all_items([parent: GraphId, kind: edge], Edges),
  once(get_attribute('reaction0', reversible: Reversible)),
  once(get_attribute('reaction0', kinetics: Kinetics)),
MARTINEZ Thierry 's avatar
MARTINEZ Thierry committed
23
  once(get_attribute(('reaction0' -> 'B'), stoichiometry: Stoichiometry)).
24 25 26 27 28 29 30 31

test(
  'import_reactions_from_graph',
  [true(Reactions == [ a <=[b]=> c, 'MA'(2) for a + 3 * c => 2 * d ])]
) :-
  clear_model,
  new_graph,
  command(transition('reaction0')),
MARTINEZ Thierry 's avatar
MARTINEZ Thierry committed
32
  command(set_attribute('reaction0', reversible: true)),
33 34 35 36 37 38 39 40 41 42
  command(
    add_edge(
      'a' -> 'reaction0',
      'b' -> 'reaction0',
      'reaction0' -> 'b',
      'reaction0' -> 'c',
      'a' -> 'reaction1'
    )
  ),
  command(set_attribute('reaction1', kinetics: 'MA'(2))),
MARTINEZ Thierry 's avatar
MARTINEZ Thierry committed
43 44
  command(set_attribute(('c' -> 'reaction1'), stoichiometry: 3)),
  command(set_attribute(('reaction1' -> 'd'), stoichiometry: 2)),
45 46 47 48
  import_reactions_from_graph,
  all_items([kind: reaction], Reactions).

:- end_tests(reaction_graphs).