reaction_graphs.plt 1.15 KB
Newer Older
Thierry Martinez's avatar
Thierry Martinez committed
1 2 3 4 5 6 7 8
:- use_module(library(plunit)).


:- begin_tests(reaction_graphs).


test(
  'reaction_graph',
9 10 11 12 13
  [
    result(Edges, Stoichiometry, Kinetics)
    ==
    result(['A' -> 'reaction0', 'reaction0' -> 'B'], 2, 'MA'(3))
  ]
Thierry Martinez's avatar
Thierry Martinez committed
14 15
) :-
  clear_model,
Thierry Martinez's avatar
ode  
Thierry Martinez committed
16
  add_reaction('MA'(3) for 'A' => 2 * 'B'),
Thierry Martinez's avatar
Thierry Martinez committed
17 18 19
  reaction_graph,
  get_current_graph(GraphId),
  all_items([parent: GraphId, kind: edge], Edges),
Thierry Martinez's avatar
Thierry Martinez committed
20
  once((
21 22
    get_attribute(GraphId, 'reaction0', kinetics = Kinetics),
    get_attribute(GraphId, ('reaction0' -> 'B'), stoichiometry = Stoichiometry)
Thierry Martinez's avatar
Thierry Martinez committed
23
  )).
Thierry Martinez's avatar
Thierry Martinez committed
24 25 26

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

:- end_tests(reaction_graphs).