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

:- begin_tests(initial_state).

test(
  'present',
  [true(InitialState == [present(a), present(b)])]
) :-
Thierry Martinez's avatar
Thierry Martinez committed
9
  clear_model,
Thierry Martinez's avatar
Thierry Martinez committed
10 11 12 13 14 15 16
  command(present({ a, b })),
  all_items([model: current_model, kind: initial_state], InitialState).

test(
  'absent',
  [true(InitialState == [absent(a), absent(b)])]
) :-
Thierry Martinez's avatar
Thierry Martinez committed
17
  clear_model,
Thierry Martinez's avatar
Thierry Martinez committed
18 19 20 21 22 23 24
  command(absent({ a, b })),
  all_items([model: current_model, kind: initial_state], InitialState).

test(
  'undefined',
  [true(InitialState == [present(a), absent(b)])]
) :-
Thierry Martinez's avatar
Thierry Martinez committed
25
  clear_model,
Thierry Martinez's avatar
Thierry Martinez committed
26 27 28 29 30 31 32 33 34
  command(present({ a, b, c })),
  command(absent({ b, c, e })),
  command(undefined({ c, d, e })),
  all_items([model: current_model, kind: initial_state], InitialState).

test(
  'make_absent_not_present',
  [true(InitialState == [present(a), absent(b)])]
) :-
Thierry Martinez's avatar
Thierry Martinez committed
35
  clear_model,
Thierry Martinez's avatar
Thierry Martinez committed
36
  add_reaction(a => b),
Thierry Martinez's avatar
Thierry Martinez committed
37 38 39 40 41 42 43 44
  command(present(a)),
  make_absent_not_present,
  all_items([model: current_model, kind: initial_state], InitialState).

test(
  'make_present_not_absent',
  [true(InitialState == [absent(a), present(b)])]
) :-
Thierry Martinez's avatar
Thierry Martinez committed
45
  clear_model,
Thierry Martinez's avatar
Thierry Martinez committed
46
  add_reaction(a => b),
Thierry Martinez's avatar
Thierry Martinez committed
47 48 49 50 51
  command(absent(a)),
  make_present_not_absent,
  all_items([model: current_model, kind: initial_state], InitialState).

:- end_tests(initial_state).