-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.rules
77 lines (62 loc) · 1.37 KB
/
test.rules
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
%% -*- Prolog -*-
%% Rules for unit tests.
%initial_data([]).
:- multifile rule/1.
rule test_post_load_action:
[ test_post_load_action ] ==> [ recommend(post_load_action) ].
rule test_load_action_alt:
[ test_load_action_alt ] ==> [ ask(test_load_action) ].
rule test_load_action:
[ test_load_action ] ==> [ load('load_test2.rules') ].
rule jimtest:
[ jim ] ==> [ recommend(im_here_jim) ].
%% Don't change these, else the unit tests will break.
% Test firing of a sequence of rules from an initial fact.
rule sequence1: [ sequence_1 ] ==> [ assert(sequence_2) ].
rule sequence2: [ sequence_2 ] ==> [ assert(sequence_3) ].
rule sequence3: [ sequence_3 ] ==> [ recommend(end_sequence) ].
% Test 'fanout' from a fact: one fact fires multiple rules.
rule branch1a: [ branch_start ] ==> [ assert(branch_2) ].
rule branch1b: [ branch_start ] ==> [ assert(branch_3) ].
rule branch2: [ branch_2 ] ==> [ recommend(branch_end_2) ].
rule branch3: [ branch_3 ] ==> [ recommend(branch_end_3) ].
rule a:
[
annoying(X),
color(orange, X)
]
==>
[
assert(isa(orange, X)),
recommend(avoid(X))
].
% GTD rules.
rule doit:
[
actionable(X),
effort(X) =< 2,
steps(X) == 1
]
==>
[
recommend(do(X))
].
rule deferit:
[
actionable(X),
effort(X) > 2,
steps(X) == 1
]
==>
[
recommend(defer(X))
].
rule project:
[
actionable(X),
steps(X) > 1
]
==>
[
recommend(determine_successful_outcome(X))
].