|
0 |
Samovar
|
|
1 |
=======
|
|
2 |
|
|
3 |
This is a literate test suite for Samovar, in Falderal format.
|
|
4 |
It describes Samovar, and includes examples inline; each example
|
|
5 |
specifies the expected result of running it, so these examples
|
|
6 |
can be run as tests. (That's what Falderal does.)
|
|
7 |
|
|
8 |
-> Tests for functionality "Run Samovar Simulation"
|
|
9 |
|
|
10 |
-> Functionality "Run Samovar Simulation" is implemented by
|
|
11 |
-> shell command
|
|
12 |
-> "bin/samovar %(test-body-file) --words 20 --line-per-sentence --seed 0"
|
|
13 |
|
|
14 |
Ignatz
|
|
15 |
------
|
|
16 |
|
|
17 |
rules
|
|
18 |
[actor(α),item(β),~holding(α,β)] α picks up the β. [holding(α,β)]
|
|
19 |
[actor(α),item(β),holding(α,β)] α puts down the β. [~holding(α,β)]
|
|
20 |
end
|
|
21 |
situations
|
|
22 |
[actor(Ignatz),item(brick)]
|
|
23 |
end
|
|
24 |
|
|
25 |
===> Ignatz picks up the brick.
|
|
26 |
===> Ignatz puts down the brick.
|
|
27 |
===> Ignatz picks up the brick.
|
|
28 |
===> Ignatz puts down the brick.
|
|
29 |
|
|
30 |
|
|
31 |
chairs
|
|
32 |
------
|
|
33 |
|
|
34 |
rules
|
|
35 |
|
|
36 |
[actor(ρ),~sitting(ρ)]
|
|
37 |
ρ walks around the room.
|
|
38 |
[]
|
|
39 |
|
|
40 |
[actor(ρ),~sitting(ρ),nearby(κ),empty(κ)]
|
|
41 |
ρ sits down in the κ.
|
|
42 |
[sitting(ρ),in(ρ,κ),~empty(κ)]
|
|
43 |
|
|
44 |
[actor(ρ),sitting(ρ),in(ρ,κ)]
|
|
45 |
ρ leans back in the κ.
|
|
46 |
[]
|
|
47 |
|
|
48 |
[actor(ρ),sitting(ρ),in(ρ,κ)]
|
|
49 |
ρ gets up and stretches.
|
|
50 |
[~sitting(ρ),~in(ρ,κ),empty(κ)]
|
|
51 |
|
|
52 |
end
|
|
53 |
|
|
54 |
situations
|
|
55 |
|
|
56 |
[
|
|
57 |
actor(Hastings),
|
|
58 |
actor(Petersen),
|
|
59 |
actor(Wembley),
|
|
60 |
nearby(chair), empty(chair),
|
|
61 |
nearby(recliner), empty(recliner),
|
|
62 |
nearby(sofa), empty(sofa)
|
|
63 |
]
|
|
64 |
|
|
65 |
end
|
|
66 |
===> Hastings sits down in the chair.
|
|
67 |
===> Hastings leans back in the chair.
|
|
68 |
===> Wembley sits down in the recliner.
|
|
69 |
===> Petersen sits down in the sofa.
|
|
70 |
|
|
71 |
idle
|
|
72 |
----
|
|
73 |
|
|
74 |
rules
|
|
75 |
|
|
76 |
[actor(ρ)]
|
|
77 |
ρ rubs his chin.
|
|
78 |
[]
|
|
79 |
|
|
80 |
[actor(ρ)]
|
|
81 |
ρ yawns.
|
|
82 |
[]
|
|
83 |
|
|
84 |
end
|
|
85 |
???> IndexError
|
|
86 |
|
|
87 |
functions
|
|
88 |
---------
|
|
89 |
|
|
90 |
rules
|
|
91 |
[actor(ρ)]
|
|
92 |
ρ scratches their(ρ) head.
|
|
93 |
[]
|
|
94 |
end
|
|
95 |
functions
|
|
96 |
their(Alice) → her
|
|
97 |
their(Bob) → his
|
|
98 |
end
|
|
99 |
situations
|
|
100 |
[
|
|
101 |
actor(Alice),
|
|
102 |
actor(Bob)
|
|
103 |
]
|
|
104 |
end
|
|
105 |
|
|
106 |
===> Alice scratches her head.
|
|
107 |
===> Alice scratches her head.
|
|
108 |
===> Bob scratches his head.
|
|
109 |
===> Bob scratches his head.
|
|
110 |
===> Alice scratches her head.
|
|
111 |
|
|
112 |
no need for functions
|
|
113 |
---------------------
|
|
114 |
|
|
115 |
rules
|
|
116 |
[actor(ρ),possessive(ρ,ξ)]
|
|
117 |
ρ scratches ξ head.
|
|
118 |
[]
|
|
119 |
end
|
|
120 |
situations
|
|
121 |
[
|
|
122 |
actor(Alice),
|
|
123 |
possessive(Alice, her),
|
|
124 |
actor(Bob),
|
|
125 |
possessive(Bob, his)
|
|
126 |
]
|
|
127 |
end
|
|
128 |
|
|
129 |
===> Alice scratches her head.
|
|
130 |
===> Alice scratches her head.
|
|
131 |
===> Bob scratches his head.
|
|
132 |
===> Bob scratches his head.
|
|
133 |
===> Alice scratches her head.
|