porolog 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -129,8 +129,8 @@ describe 'Array' do
129
129
 
130
130
  let(:array1) { [1, 2, :A, 4, [:B, 6, 7, :C], 9] }
131
131
  let(:array2) { [] }
132
- let(:array3) { UNKNOWN_ARRAY }
133
- let(:array4) { [1, :B, 3, UNKNOWN_TAIL] }
132
+ let(:array3) { Porolog::UNKNOWN_ARRAY }
133
+ let(:array4) { [1, :B, 3, Porolog::UNKNOWN_TAIL] }
134
134
 
135
135
  describe '#/' do
136
136
 
@@ -173,12 +173,12 @@ describe 'Array' do
173
173
  it 'should return simple Arrays as is' do
174
174
  assert_equal [1, 2, :A, 4, [:B, 6, 7, :C], 9], array1.value
175
175
  assert_equal [], array2.value
176
- assert_equal [UNKNOWN_TAIL], array3.value
177
- assert_equal [1, :B, 3, UNKNOWN_TAIL], array4.value
176
+ assert_equal [Porolog::UNKNOWN_TAIL], array3.value
177
+ assert_equal [1, :B, 3, Porolog::UNKNOWN_TAIL], array4.value
178
178
  end
179
179
 
180
180
  it 'should expand Tails that are an Array' do
181
- array = [1,2,3,Tail.new([7,8,9])]
181
+ array = [1, 2, 3, Porolog::Tail.new([7, 8, 9])]
182
182
 
183
183
  assert_equal [1,2,3,7,8,9], array.value
184
184
  end
@@ -194,7 +194,7 @@ describe 'Array' do
194
194
 
195
195
  it 'should return the value of instantiated variables in a Tail' do
196
196
  goal = new_goal :taylor, :head, :tail
197
- array = [Tail.new(goal.value([5,6,7,8]))]
197
+ array = [Porolog::Tail.new(goal.value([5, 6, 7, 8]))]
198
198
 
199
199
  assert_equal [5,6,7,8], array.value
200
200
  end
@@ -204,10 +204,10 @@ describe 'Array' do
204
204
  describe '#type' do
205
205
 
206
206
  it 'should return :variable for symbols' do
207
- assert_equal :array, array1.type
208
- assert_equal :array, array2.type
209
- assert_equal :array, array3.type
210
- assert_equal :array, array4.type
207
+ assert_equal :array, array1.type
208
+ assert_equal :array, array2.type
209
+ assert_equal :array, array3.type
210
+ assert_equal :array, array4.type
211
211
  end
212
212
 
213
213
  end
@@ -215,24 +215,24 @@ describe 'Array' do
215
215
  describe '#head' do
216
216
 
217
217
  it 'should return the first element when no headsize is provided' do
218
- assert_equal 1, array1.head
219
- assert_nil array2.head
220
- assert_nil array3.head
221
- assert_equal 1, array4.head
218
+ assert_equal 1, array1.head
219
+ assert_nil array2.head
220
+ assert_nil array3.head
221
+ assert_equal 1, array4.head
222
222
  end
223
223
 
224
224
  it 'should return the first headsize elements' do
225
- assert_equal [1, 2], array1.head(2)
226
- assert_equal [], array2.head(2)
227
- assert_equal [UNKNOWN_TAIL], array3.head(2)
228
- assert_equal [1, :B], array4.head(2)
225
+ assert_equal [1, 2], array1.head(2)
226
+ assert_equal [], array2.head(2)
227
+ assert_equal [Porolog::UNKNOWN_TAIL], array3.head(2)
228
+ assert_equal [1, :B], array4.head(2)
229
229
  end
230
230
 
231
231
  it 'should return an extended head if the tail is uninstantiated' do
232
- assert_equal [1, 2, :A, 4, [:B, 6, 7, :C], 9], array1.head(9)
233
- assert_equal [], array2.head(9)
234
- assert_equal [UNKNOWN_TAIL], array3.head(9)
235
- assert_equal [1, :B, 3, UNKNOWN_TAIL], array4.head(9)
232
+ assert_equal [1, 2, :A, 4, [:B, 6, 7, :C], 9], array1.head(9)
233
+ assert_equal [], array2.head(9)
234
+ assert_equal [Porolog::UNKNOWN_TAIL], array3.head(9)
235
+ assert_equal [1, :B, 3, Porolog::UNKNOWN_TAIL], array4.head(9)
236
236
  end
237
237
 
238
238
  end
@@ -240,31 +240,31 @@ describe 'Array' do
240
240
  describe '#tail' do
241
241
 
242
242
  it 'should return the tail after the first element when no headsize is provided' do
243
- assert_equal [2, :A, 4, [:B, 6, 7, :C], 9], array1.tail
244
- assert_equal [], array2.tail
245
- assert_equal [UNKNOWN_TAIL], array3.tail
246
- assert_equal [:B, 3, UNKNOWN_TAIL], array4.tail
243
+ assert_equal [2, :A, 4, [:B, 6, 7, :C], 9], array1.tail
244
+ assert_equal [], array2.tail
245
+ assert_equal [Porolog::UNKNOWN_TAIL], array3.tail
246
+ assert_equal [:B, 3, Porolog::UNKNOWN_TAIL], array4.tail
247
247
  end
248
248
 
249
249
  it 'should return the tail after the first headsize elements' do
250
- assert_equal [:A, 4, [:B, 6, 7, :C], 9], array1.tail(2)
251
- assert_equal [], array2.tail(2)
252
- assert_equal [UNKNOWN_TAIL], array3.tail(2)
253
- assert_equal [3, UNKNOWN_TAIL], array4.tail(2)
250
+ assert_equal [:A, 4, [:B, 6, 7, :C], 9], array1.tail(2)
251
+ assert_equal [], array2.tail(2)
252
+ assert_equal [Porolog::UNKNOWN_TAIL], array3.tail(2)
253
+ assert_equal [3, Porolog::UNKNOWN_TAIL], array4.tail(2)
254
254
  end
255
255
 
256
256
  it 'should return an extended tail if the tail is uninstantiated' do
257
- assert_equal [], array1.tail(9)
258
- assert_equal [], array2.tail(9)
259
- assert_equal [UNKNOWN_TAIL], array3.tail(9)
260
- assert_equal [UNKNOWN_TAIL], array4.tail(9)
257
+ assert_equal [], array1.tail(9)
258
+ assert_equal [], array2.tail(9)
259
+ assert_equal [Porolog::UNKNOWN_TAIL], array3.tail(9)
260
+ assert_equal [Porolog::UNKNOWN_TAIL], array4.tail(9)
261
261
  end
262
262
 
263
263
  end
264
264
 
265
265
  describe '#clean' do
266
266
 
267
- let(:predicate1) { Predicate.new :generic }
267
+ let(:predicate1) { Porolog::Predicate.new :generic }
268
268
  let(:arguments1) { predicate1.arguments(:m,:n) }
269
269
  let(:goal1) { arguments1.goal }
270
270
 
@@ -275,14 +275,14 @@ describe 'Array' do
275
275
  it 'should return simple Arrays as is' do
276
276
  assert_equal [1, 2, :A, 4, [:B, 6, 7, :C], 9], array1.clean
277
277
  assert_equal [], array2.clean
278
- assert_equal [UNKNOWN_TAIL], array3.clean
279
- assert_equal [1, :B, 3, UNKNOWN_TAIL], array4.clean
278
+ assert_equal [Porolog::UNKNOWN_TAIL], array3.clean
279
+ assert_equal [1, :B, 3, Porolog::UNKNOWN_TAIL], array4.clean
280
280
  end
281
281
 
282
282
  it 'should return the values of its elements with variables replaced by nil and Tails replaced by UNKNOWN_TAIL' do
283
283
  assert_equal [1, 2, nil, 4, [nil, 6, 7, nil], 9], array5.clean
284
- assert_equal [1, nil, 3, UNKNOWN_TAIL], array6.clean
285
- assert_equal [1, nil, 3, UNKNOWN_TAIL], array7.clean
284
+ assert_equal [1, nil, 3, Porolog::UNKNOWN_TAIL], array6.clean
285
+ assert_equal [1, nil, 3, Porolog::UNKNOWN_TAIL], array7.clean
286
286
  end
287
287
 
288
288
  end
@@ -16,9 +16,9 @@ describe 'Porolog' do
16
16
 
17
17
  describe 'Goal' do
18
18
 
19
- let(:pred) { Predicate.new :p }
19
+ let(:pred) { Porolog::Predicate.new :p }
20
20
  let(:args) { pred.(:x,:y) }
21
- let(:goal) { Goal.new args }
21
+ let(:goal) { Porolog::Goal.new args }
22
22
 
23
23
  describe '.reset' do
24
24
 
@@ -27,26 +27,26 @@ describe 'Porolog' do
27
27
  new_goal :predicate2, :a, :b
28
28
  new_goal :predicate3, :a, :b, :c
29
29
 
30
- assert_equal 3, Goal.goals.size
30
+ assert_equal 3, Porolog::Goal.goals.size
31
31
 
32
- Goal.reset
32
+ Porolog::Goal.reset
33
33
 
34
- assert_empty Goal.goals
34
+ assert_empty Porolog::Goal.goals
35
35
  end
36
36
 
37
37
  it 'should call check_deleted for each goal' do
38
- Goal.any_instance.expects(:check_deleted).with().returns(false).times(5)
38
+ Porolog::Goal.any_instance.expects(:check_deleted).with().returns(false).times(5)
39
39
 
40
40
  new_goal :p, :x, :y
41
41
  new_goal :q, :a
42
42
  new_goal :r, :a, :b, :c
43
43
 
44
- Goal.reset
44
+ Porolog::Goal.reset
45
45
 
46
46
  new_goal :j, 1
47
47
  new_goal :k, ['a', 'b', 'c']
48
48
 
49
- Goal.reset
49
+ Porolog::Goal.reset
50
50
  end
51
51
 
52
52
  end
@@ -54,19 +54,19 @@ describe 'Porolog' do
54
54
  describe '.goals' do
55
55
 
56
56
  it 'should return all registered goals' do
57
- assert_equal 0, Goal.goals.size
57
+ assert_equal 0, Porolog::Goal.goals.size
58
58
 
59
59
  goal1 = new_goal :predicate1, :a
60
60
 
61
- assert_equal [goal1], Goal.goals
61
+ assert_equal [goal1], Porolog::Goal.goals
62
62
 
63
63
  goal2 = new_goal :predicate2, :a, :b
64
64
 
65
- assert_equal [goal1,goal2], Goal.goals
65
+ assert_equal [goal1,goal2], Porolog::Goal.goals
66
66
 
67
67
  goal3 = new_goal :predicate3, :a, :b, :c
68
68
 
69
- assert_equal [goal1,goal2,goal3], Goal.goals
69
+ assert_equal [goal1,goal2,goal3], Porolog::Goal.goals
70
70
  end
71
71
 
72
72
  end
@@ -74,9 +74,9 @@ describe 'Porolog' do
74
74
  describe '.new' do
75
75
 
76
76
  it 'should create a new Goal' do
77
- goal = Goal.new nil
77
+ goal = Porolog::Goal.new nil
78
78
 
79
- assert_instance_of Goal, goal
79
+ assert_instance_of Porolog::Goal, goal
80
80
  end
81
81
 
82
82
  end
@@ -84,8 +84,8 @@ describe 'Porolog' do
84
84
  describe '#initialize' do
85
85
 
86
86
  it 'should initialize calling_goal' do
87
- goal1 = Goal.new args
88
- goal2 = Goal.new args, goal1
87
+ goal1 = Porolog::Goal.new args
88
+ goal2 = Porolog::Goal.new args, goal1
89
89
 
90
90
  assert_nil goal1.calling_goal
91
91
  assert_equal goal1, goal2.calling_goal
@@ -95,19 +95,19 @@ describe 'Porolog' do
95
95
  end
96
96
 
97
97
  it 'should initialize arguments' do
98
- goal = Goal.new args, nil
98
+ goal = Porolog::Goal.new args, nil
99
99
 
100
100
  assert_equal goal.variablise(args), goal.arguments
101
101
  end
102
102
 
103
103
  it 'should initialize terminate' do
104
- goal = Goal.new args, nil
104
+ goal = Porolog::Goal.new args, nil
105
105
 
106
106
  assert_equal false, goal.terminated?
107
107
  end
108
108
 
109
109
  it 'should initialize variables' do
110
- goal = Goal.new args, nil
110
+ goal = Porolog::Goal.new args, nil
111
111
 
112
112
  assert_Goal_variables goal, { x: nil, y: nil }, [
113
113
  'Goal1.:x',
@@ -116,10 +116,10 @@ describe 'Porolog' do
116
116
  end
117
117
 
118
118
  it 'should register the goal as undeleted' do
119
- goal1 = Goal.new args, nil
120
- goal2 = Goal.new args, goal1
119
+ goal1 = Porolog::Goal.new args, nil
120
+ goal2 = Porolog::Goal.new args, goal1
121
121
 
122
- assert_equal [goal1,goal2], Goal.goals
122
+ assert_equal [goal1,goal2], Porolog::Goal.goals
123
123
  end
124
124
 
125
125
  end
@@ -127,8 +127,8 @@ describe 'Porolog' do
127
127
  describe '#myid' do
128
128
 
129
129
  it 'should return the pretty id of the goal' do
130
- goal1 = Goal.new args, nil
131
- goal2 = Goal.new args, goal1
130
+ goal1 = Porolog::Goal.new args, nil
131
+ goal2 = Porolog::Goal.new args, goal1
132
132
 
133
133
  assert_equal 'Goal1', goal1.myid
134
134
  assert_equal 'Goal2', goal2.myid
@@ -139,10 +139,10 @@ describe 'Porolog' do
139
139
  describe '#ancestors' do
140
140
 
141
141
  it 'should return an Array of the parent goals' do
142
- goal1 = Goal.new args
143
- goal2 = Goal.new args, goal1
144
- goal3 = Goal.new args, goal2
145
- goal4 = Goal.new args, goal3
142
+ goal1 = Porolog::Goal.new args
143
+ goal2 = Porolog::Goal.new args, goal1
144
+ goal3 = Porolog::Goal.new args, goal2
145
+ goal4 = Porolog::Goal.new args, goal3
146
146
 
147
147
  assert_equal [goal1], goal1.ancestors
148
148
  assert_equal [goal1, goal2], goal2.ancestors
@@ -155,10 +155,10 @@ describe 'Porolog' do
155
155
  describe '#ancestry' do
156
156
 
157
157
  it 'should return an Array of the parent goals' do
158
- goal1 = Goal.new args
159
- goal2 = Goal.new args, goal1
160
- goal3 = Goal.new args, goal2
161
- goal4 = Goal.new args, goal3
158
+ goal1 = Porolog::Goal.new args
159
+ goal2 = Porolog::Goal.new args, goal1
160
+ goal3 = Porolog::Goal.new args, goal2
161
+ goal4 = Porolog::Goal.new args, goal3
162
162
 
163
163
  ancestors = [
164
164
  'Goal1 -- Solve p(:x,:y) {:x=>nil, :y=>nil}',
@@ -178,10 +178,10 @@ describe 'Porolog' do
178
178
  describe '#inspect' do
179
179
 
180
180
  it 'should show a description of the goal' do
181
- goal1 = Goal.new args
182
- goal2 = Goal.new pred.(1,:b,'word'), goal1
183
- goal3 = Goal.new args, goal2
184
- goal4 = Goal.new args, goal3
181
+ goal1 = Porolog::Goal.new args
182
+ goal2 = Porolog::Goal.new pred.(1,:b,'word'), goal1
183
+ goal3 = Porolog::Goal.new args, goal2
184
+ goal4 = Porolog::Goal.new args, goal3
185
185
 
186
186
  assert_equal 'Goal1 -- Solve p(:x,:y)', goal1.inspect
187
187
  assert_equal 'Goal2 -- Solve p(1,:b,"word")', goal2.inspect
@@ -194,25 +194,25 @@ describe 'Porolog' do
194
194
  describe '#delete!' do
195
195
 
196
196
  it 'should delete the goal' do
197
- goal1 = Goal.new args
198
- goal2 = Goal.new pred.(1,:b,'word'), goal1
199
- goal3 = Goal.new args, goal2
200
- goal4 = Goal.new args, goal3
197
+ goal1 = Porolog::Goal.new args
198
+ goal2 = Porolog::Goal.new pred.(1,:b,'word'), goal1
199
+ goal3 = Porolog::Goal.new args, goal2
200
+ goal4 = Porolog::Goal.new args, goal3
201
201
 
202
202
  assert goal2.delete!, 'goal should delete'
203
- assert_equal [goal1, goal3, goal4], Goal.goals
203
+ assert_equal [goal1, goal3, goal4], Porolog::Goal.goals
204
204
  end
205
205
 
206
206
  end
207
207
 
208
208
  describe '#myid' do
209
209
 
210
- let(:pred) { Predicate.new :p }
210
+ let(:pred) { Porolog::Predicate.new :p }
211
211
  let(:args) { pred.(:x,:y) }
212
212
 
213
213
  it 'should return the pretty id of the goal' do
214
- goal1 = Goal.new args, nil
215
- goal2 = Goal.new args, goal1
214
+ goal1 = Porolog::Goal.new args, nil
215
+ goal2 = Porolog::Goal.new args, goal1
216
216
 
217
217
  assert_equal 'Goal1', goal1.myid
218
218
  assert_equal 'Goal2', goal2.myid
@@ -223,17 +223,17 @@ describe 'Porolog' do
223
223
  describe '#deleted?' do
224
224
 
225
225
  it 'should return the deleted state of a goal' do
226
- goal = Goal.new args
226
+ goal = Porolog::Goal.new args
227
227
 
228
228
  refute goal.deleted?, 'goal should not be deleted'
229
229
 
230
- Goal.reset
230
+ Porolog::Goal.reset
231
231
 
232
232
  assert goal.deleted?, 'goal should be deleted'
233
233
  end
234
234
 
235
235
  it 'should memoize the deleted state of a goal' do
236
- goal = Goal.new args
236
+ goal = Porolog::Goal.new args
237
237
 
238
238
  check_deleted_spy = Spy.on(goal, :check_deleted).and_call_through
239
239
 
@@ -242,7 +242,7 @@ describe 'Porolog' do
242
242
  refute goal.deleted?
243
243
  refute goal.deleted?
244
244
 
245
- Goal.reset
245
+ Porolog::Goal.reset
246
246
 
247
247
  assert goal.deleted?
248
248
  assert goal.deleted?
@@ -257,12 +257,12 @@ describe 'Porolog' do
257
257
  describe '#check_deleted' do
258
258
 
259
259
  it 'should return false when the goal is not deleted and keep variables intact' do
260
- goal = Goal.new args
260
+ goal = Porolog::Goal.new args
261
261
  goal.variable(:x)
262
262
  goal.variable(:y)
263
263
  goal.variable(:z)
264
264
 
265
- variable_remove_spy = Spy.on_instance_method(Variable, :remove)
265
+ variable_remove_spy = Spy.on_instance_method(Porolog::Variable, :remove)
266
266
 
267
267
  refute goal.check_deleted, 'goal should not be deleted'
268
268
 
@@ -270,14 +270,14 @@ describe 'Porolog' do
270
270
  end
271
271
 
272
272
  it 'should return true when the goal is deleted and remove all variables' do
273
- goal = Goal.new args
273
+ goal = Porolog::Goal.new args
274
274
  goal.variable(:x)
275
275
  goal.variable(:y)
276
276
  goal.variable(:z)
277
277
 
278
- variable_remove_spy = Spy.on_instance_method(Variable, :remove)
278
+ variable_remove_spy = Spy.on_instance_method(Porolog::Variable, :remove)
279
279
 
280
- Goal.reset
280
+ Porolog::Goal.reset
281
281
 
282
282
  assert goal.check_deleted, 'goal should be deleted'
283
283
 
@@ -289,7 +289,7 @@ describe 'Porolog' do
289
289
  describe '#terminate!' do
290
290
 
291
291
  it 'should set the goal to terminate and log the event' do
292
- goal = Goal.new args
292
+ goal = Porolog::Goal.new args
293
293
 
294
294
  assert goal.terminate!, 'the goal should be set to terminate'
295
295
  assert_equal ['terminating'], goal.log
@@ -300,7 +300,7 @@ describe 'Porolog' do
300
300
  describe '#terminated?' do
301
301
 
302
302
  it 'should return whether the goal is set to terminate or not' do
303
- goal = Goal.new args
303
+ goal = Porolog::Goal.new args
304
304
 
305
305
  refute goal.terminated?, 'the goal should not be initialized to terminate'
306
306
  assert goal.terminate!, 'the goal should be set to terminate'
@@ -316,7 +316,7 @@ describe 'Porolog' do
316
316
  end
317
317
 
318
318
  it 'should return a Variable as is' do
319
- v = Variable.new :r, goal
319
+ v = Porolog::Variable.new :r, goal
320
320
  assert_equal v, goal.variablise(v)
321
321
  end
322
322
 
@@ -331,20 +331,20 @@ describe 'Porolog' do
331
331
  end
332
332
 
333
333
  it 'should convert a Tail into a Tail with a variablised value' do
334
- assert_Tail goal.variablise(Tail.new :m), '*Goal1.:m'
334
+ assert_Tail goal.variablise(Porolog::Tail.new :m), '*Goal1.:m'
335
335
  end
336
336
 
337
337
  it 'should return a Value as is' do
338
- v = Value.new(45, goal)
338
+ v = Porolog::Value.new(45, goal)
339
339
  assert_equal v, goal.variablise(v)
340
340
  end
341
341
 
342
342
  it 'should return an unknown array as is' do
343
- assert_equal UNKNOWN_ARRAY, goal.variablise(UNKNOWN_ARRAY)
343
+ assert_equal Porolog::UNKNOWN_ARRAY, goal.variablise(Porolog::UNKNOWN_ARRAY)
344
344
  end
345
345
 
346
346
  it 'should return an unknown tail as is' do
347
- assert_equal UNKNOWN_TAIL, goal.variablise(UNKNOWN_TAIL)
347
+ assert_equal Porolog::UNKNOWN_TAIL, goal.variablise(Porolog::UNKNOWN_TAIL)
348
348
  end
349
349
 
350
350
  it 'should convert any other Object into a Value' do
@@ -356,7 +356,7 @@ describe 'Porolog' do
356
356
  describe '#variables' do
357
357
 
358
358
  it 'should return a Hash of variables and their values' do
359
- goal = Goal.new args
359
+ goal = Porolog::Goal.new args
360
360
  goal.variable(:x)
361
361
  goal.variable(:y)
362
362
  goal.variable(:z)
@@ -379,7 +379,7 @@ describe 'Porolog' do
379
379
 
380
380
  it 'should return a string showing the instantiations of the variables of the goal' do
381
381
  # -- Initial Goal --
382
- goal = Goal.new args
382
+ goal = Porolog::Goal.new args
383
383
 
384
384
  x = goal.variable(:x)
385
385
  y = goal.variable(:y)
@@ -480,7 +480,7 @@ describe 'Porolog' do
480
480
  describe '#values' do
481
481
 
482
482
  it 'should return the values that have been associated with the goal' do
483
- goal = Goal.new args
483
+ goal = Porolog::Goal.new args
484
484
 
485
485
  x = goal.variable(:x)
486
486
  y = goal.variable(:y)
@@ -609,7 +609,7 @@ describe 'Porolog' do
609
609
  end
610
610
 
611
611
  it 'should somehow splat when given a Tail' do
612
- tail1 = Tail.new ['apples','oranges','bananas']
612
+ tail1 = Porolog::Tail.new ['apples','oranges','bananas']
613
613
 
614
614
  assert_equal 'apples', goal.values_of(tail1)
615
615
  end
@@ -635,7 +635,7 @@ describe 'Porolog' do
635
635
  end
636
636
 
637
637
  it 'should solve a fact' do
638
- predicate :fact
638
+ Porolog::predicate :fact
639
639
 
640
640
  fact(42).fact!
641
641
 
@@ -645,7 +645,7 @@ describe 'Porolog' do
645
645
  end
646
646
 
647
647
  it 'should not solve a fallacy' do
648
- predicate :fact
648
+ Porolog::predicate :fact
649
649
 
650
650
  fact(42).fallacy!
651
651
 
@@ -655,7 +655,7 @@ describe 'Porolog' do
655
655
  end
656
656
 
657
657
  it 'should solve using head and tail with lists' do
658
- predicate :head_tail
658
+ Porolog::predicate :head_tail
659
659
 
660
660
  head_tail([1,2,3,4,5,6,7]).fact!
661
661
  head_tail(['head','body','foot']).fact!
@@ -669,8 +669,8 @@ describe 'Porolog' do
669
669
  end
670
670
 
671
671
  it 'should solve a goal recursively' do
672
- builtin :write
673
- predicate :recursive
672
+ Porolog::builtin :write
673
+ Porolog::predicate :recursive
674
674
 
675
675
  recursive([]) << [:CUT, true]
676
676
  recursive(:head/:tail) << [
@@ -692,7 +692,7 @@ describe 'Porolog' do
692
692
  let(:block) { ->(subgoal){} }
693
693
 
694
694
  it 'should return false when the goal has no arguments' do
695
- goal = Goal.new nil
695
+ goal = Porolog::Goal.new nil
696
696
 
697
697
  block.expects(:call).times(0)
698
698
 
@@ -760,8 +760,8 @@ describe 'Porolog' do
760
760
  end
761
761
 
762
762
  it 'creates variables from its contents with a goal' do
763
- predicate :bravo
764
- arguments = Predicate[:bravo].arguments(:x,:y,:z)
763
+ Porolog::predicate :bravo
764
+ arguments = Porolog::Predicate[:bravo].arguments(:x,:y,:z)
765
765
  goal = arguments.goal
766
766
 
767
767
  head_tail = [:alpha,bravo(:a,:b,:c),[:carly]] / [:x,[:y],bravo(:p,:q/:r)]