porolog 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +22 -13
- data/coverage/index.html +4564 -4552
- data/doc/Array.html +9 -9
- data/doc/Object.html +1 -1
- data/doc/Porolog.html +77 -67
- data/doc/Symbol.html +1 -1
- data/doc/_index.html +1 -1
- data/doc/file.README.html +22 -14
- data/doc/index.html +22 -14
- data/doc/top-level-namespace.html +1 -1
- data/lib/porolog.rb +4 -2
- data/lib/porolog/core_ext.rb +8 -8
- data/lib/porolog/goal.rb +2 -2
- data/lib/porolog/predicate/builtin.rb +34 -34
- data/lib/porolog/rule.rb +1 -1
- data/lib/porolog/variable.rb +7 -7
- data/test/porolog/arguments_test.rb +73 -73
- data/test/porolog/core_ext_test.rb +39 -39
- data/test/porolog/goal_test.rb +72 -72
- data/test/porolog/instantiation_test.rb +153 -153
- data/test/porolog/porolog_test.rb +272 -270
- data/test/porolog/predicate/builtin_test.rb +166 -166
- data/test/porolog/predicate_test.rb +85 -85
- data/test/porolog/rule_test.rb +69 -69
- data/test/porolog/scope_test.rb +89 -89
- data/test/porolog/tail_test.rb +23 -23
- data/test/porolog/value_test.rb +32 -34
- data/test/porolog/variable_test.rb +120 -120
- data/test/samples_test.rb +11 -11
- data/test/test_helper.rb +56 -61
- metadata +2 -2
data/lib/porolog/rule.rb
CHANGED
@@ -61,7 +61,7 @@ module Porolog
|
|
61
61
|
def satisfy(goal, &block)
|
62
62
|
subgoal = Goal.new self.arguments, goal
|
63
63
|
|
64
|
-
unified_goals = unify_goals(goal, subgoal)
|
64
|
+
unified_goals = Porolog::unify_goals(goal, subgoal)
|
65
65
|
if unified_goals
|
66
66
|
satisfy_definition(goal, subgoal) do |solution_goal|
|
67
67
|
block.call(solution_goal)
|
data/lib/porolog/variable.rb
CHANGED
@@ -143,7 +143,7 @@ module Porolog
|
|
143
143
|
}
|
144
144
|
|
145
145
|
if values.size > 2
|
146
|
-
merged, unifications = unify_many_arrays(values, values_goals, visited)
|
146
|
+
merged, unifications = Porolog::unify_many_arrays(values, values_goals, visited)
|
147
147
|
elsif values.size == 2
|
148
148
|
no_variables = values.map(&:variables).flatten.empty?
|
149
149
|
if no_variables
|
@@ -157,7 +157,7 @@ module Porolog
|
|
157
157
|
return nil
|
158
158
|
end
|
159
159
|
end
|
160
|
-
merged, unifications = unify_arrays(*values, *values_goals, visited)
|
160
|
+
merged, unifications = Porolog::unify_arrays(*values, *values_goals, visited)
|
161
161
|
else
|
162
162
|
# :nocov: NOT REACHED
|
163
163
|
merged, unifications = values.first, []
|
@@ -168,7 +168,7 @@ module Porolog
|
|
168
168
|
else
|
169
169
|
# -- Not All Values Are Arrays --
|
170
170
|
values.each_cons(2){|left,right|
|
171
|
-
unification = unify(left, right, @goal, @goal, visited)
|
171
|
+
unification = Porolog::unify(left, right, @goal, @goal, visited)
|
172
172
|
if unification && unifications
|
173
173
|
unifications += unification
|
174
174
|
else
|
@@ -178,9 +178,9 @@ module Porolog
|
|
178
178
|
if unifications
|
179
179
|
values.min_by{|value|
|
180
180
|
case value
|
181
|
-
when Variable, Symbol
|
182
|
-
when UNKNOWN_TAIL, UNKNOWN_ARRAY then 9
|
183
|
-
else
|
181
|
+
when Porolog::Variable, Symbol then 2
|
182
|
+
when Porolog::UNKNOWN_TAIL, Porolog::UNKNOWN_ARRAY then 9
|
183
|
+
else 0
|
184
184
|
end
|
185
185
|
} || self
|
186
186
|
else
|
@@ -233,7 +233,7 @@ module Porolog
|
|
233
233
|
other_goal ||= self.goal
|
234
234
|
|
235
235
|
# -- Check Unification --
|
236
|
-
unless unify(self, other, self.goal, other_goal)
|
236
|
+
unless Porolog::unify(self, other, self.goal, other_goal)
|
237
237
|
self.goal.log << "Cannot unify: #{self.inspect} and #{other.inspect}"
|
238
238
|
return nil
|
239
239
|
end
|
@@ -14,27 +14,27 @@ describe 'Porolog' do
|
|
14
14
|
end
|
15
15
|
|
16
16
|
let(:pred_name) { :pred }
|
17
|
-
let(:pred) { Predicate.new pred_name }
|
18
|
-
let(:pred1) { Predicate.new :p }
|
19
|
-
let(:pred2) { Predicate.new :q }
|
17
|
+
let(:pred) { Porolog::Predicate.new pred_name }
|
18
|
+
let(:pred1) { Porolog::Predicate.new :p }
|
19
|
+
let(:pred2) { Porolog::Predicate.new :q }
|
20
20
|
|
21
21
|
describe 'Arguments' do
|
22
22
|
|
23
23
|
describe '.reset' do
|
24
24
|
|
25
25
|
it 'should delete/unregister all Arguments' do
|
26
|
-
args1 = Arguments.new pred, [1,:x,'word',[2,:y,0.3]]
|
27
|
-
args2 = Arguments.new pred, [2]
|
28
|
-
args3 = Arguments.new pred, [3,:x,:y,:z]
|
26
|
+
args1 = Porolog::Arguments.new pred, [1,:x,'word',[2,:y,0.3]]
|
27
|
+
args2 = Porolog::Arguments.new pred, [2]
|
28
|
+
args3 = Porolog::Arguments.new pred, [3,:x,:y,:z]
|
29
29
|
|
30
30
|
assert_equal 'Arguments1', args1.myid
|
31
31
|
assert_equal 'Arguments2', args2.myid
|
32
32
|
assert_equal 'Arguments3', args3.myid
|
33
33
|
|
34
|
-
Arguments.reset
|
34
|
+
Porolog::Arguments.reset
|
35
35
|
|
36
|
-
args4 = Arguments.new pred, [4,[1,2,3]]
|
37
|
-
args5 = Arguments.new pred, [5,[]]
|
36
|
+
args4 = Porolog::Arguments.new pred, [4,[1,2,3]]
|
37
|
+
args5 = Porolog::Arguments.new pred, [5,[]]
|
38
38
|
|
39
39
|
assert_equal 'Arguments-999', args1.myid
|
40
40
|
assert_equal 'Arguments-999', args2.myid
|
@@ -42,7 +42,7 @@ describe 'Porolog' do
|
|
42
42
|
assert_equal 'Arguments1', args4.myid
|
43
43
|
assert_equal 'Arguments2', args5.myid
|
44
44
|
|
45
|
-
Arguments.reset
|
45
|
+
Porolog::Arguments.reset
|
46
46
|
|
47
47
|
assert_equal 'Arguments-999', args1.myid
|
48
48
|
assert_equal 'Arguments-999', args2.myid
|
@@ -56,7 +56,7 @@ describe 'Porolog' do
|
|
56
56
|
describe '.new' do
|
57
57
|
|
58
58
|
it 'should create a new Arguments' do
|
59
|
-
arguments = Arguments.new pred, [1, :x, 'word', [2, :y, 0.3]]
|
59
|
+
arguments = Porolog::Arguments.new pred, [1, :x, 'word', [2, :y, 0.3]]
|
60
60
|
|
61
61
|
assert_Arguments arguments, :pred, [1, :x, 'word', [2, :y, 0.3]]
|
62
62
|
end
|
@@ -67,22 +67,22 @@ describe 'Porolog' do
|
|
67
67
|
|
68
68
|
it 'should return all registered arguments' do
|
69
69
|
# -- No Arguments --
|
70
|
-
assert_equal 0, Arguments.arguments.size
|
70
|
+
assert_equal 0, Porolog::Arguments.arguments.size
|
71
71
|
|
72
72
|
# -- One Arguments --
|
73
|
-
arguments1 = Arguments.new pred1, [:x,:y,:z]
|
73
|
+
arguments1 = Porolog::Arguments.new pred1, [:x,:y,:z]
|
74
74
|
|
75
|
-
assert_equal 1, Arguments.arguments.size
|
76
|
-
assert_Arguments Arguments.arguments.last, :p, [:x,:y,:z]
|
75
|
+
assert_equal 1, Porolog::Arguments.arguments.size
|
76
|
+
assert_Arguments Porolog::Arguments.arguments.last, :p, [:x,:y,:z]
|
77
77
|
|
78
78
|
# -- Two Arguments --
|
79
|
-
arguments2 = Arguments.new pred2, [:a,:b,:c,:d]
|
79
|
+
arguments2 = Porolog::Arguments.new pred2, [:a,:b,:c,:d]
|
80
80
|
|
81
|
-
assert_equal 2, Arguments.arguments.size
|
82
|
-
assert_Arguments Arguments.arguments.last, :q, [:a,:b,:c,:d]
|
81
|
+
assert_equal 2, Porolog::Arguments.arguments.size
|
82
|
+
assert_Arguments Porolog::Arguments.arguments.last, :q, [:a,:b,:c,:d]
|
83
83
|
|
84
84
|
|
85
|
-
assert_equal [arguments1, arguments2], Arguments.arguments
|
85
|
+
assert_equal [arguments1, arguments2], Porolog::Arguments.arguments
|
86
86
|
end
|
87
87
|
|
88
88
|
end
|
@@ -90,22 +90,22 @@ describe 'Porolog' do
|
|
90
90
|
describe '#initialize' do
|
91
91
|
|
92
92
|
it 'should initialize predicate and arguments' do
|
93
|
-
arguments = Arguments.new pred, [:x,:y,:z]
|
93
|
+
arguments = Porolog::Arguments.new pred, [:x,:y,:z]
|
94
94
|
|
95
95
|
assert_equal pred, arguments.predicate
|
96
96
|
assert_equal [:x,:y,:z], arguments.arguments
|
97
97
|
end
|
98
98
|
|
99
99
|
it 'should register the arguments' do
|
100
|
-
arguments1 = Arguments.new pred, [:x]
|
101
|
-
arguments2 = Arguments.new pred, [:x,:y]
|
102
|
-
arguments3 = Arguments.new pred, [:x,:y,:z]
|
100
|
+
arguments1 = Porolog::Arguments.new pred, [:x]
|
101
|
+
arguments2 = Porolog::Arguments.new pred, [:x,:y]
|
102
|
+
arguments3 = Porolog::Arguments.new pred, [:x,:y,:z]
|
103
103
|
|
104
104
|
assert_equal [
|
105
105
|
arguments1,
|
106
106
|
arguments2,
|
107
107
|
arguments3,
|
108
|
-
], Arguments.arguments
|
108
|
+
], Porolog::Arguments.arguments
|
109
109
|
end
|
110
110
|
|
111
111
|
end
|
@@ -113,9 +113,9 @@ describe 'Porolog' do
|
|
113
113
|
describe '#myid' do
|
114
114
|
|
115
115
|
it 'should return its class and index as a String' do
|
116
|
-
arguments1 = Arguments.new pred, [:x]
|
117
|
-
arguments2 = Arguments.new pred, [:x,:y]
|
118
|
-
arguments3 = Arguments.new pred, [:x,:y,:z]
|
116
|
+
arguments1 = Porolog::Arguments.new pred, [:x]
|
117
|
+
arguments2 = Porolog::Arguments.new pred, [:x,:y]
|
118
|
+
arguments3 = Porolog::Arguments.new pred, [:x,:y,:z]
|
119
119
|
|
120
120
|
assert_equal 'Arguments1', arguments1.myid
|
121
121
|
assert_equal 'Arguments2', arguments2.myid
|
@@ -123,11 +123,11 @@ describe 'Porolog' do
|
|
123
123
|
end
|
124
124
|
|
125
125
|
it 'should return its class and -999 as a String when deleted/reset' do
|
126
|
-
arguments1 = Arguments.new pred, [:x]
|
127
|
-
arguments2 = Arguments.new pred, [:x,:y]
|
128
|
-
arguments3 = Arguments.new pred, [:x,:y,:z]
|
126
|
+
arguments1 = Porolog::Arguments.new pred, [:x]
|
127
|
+
arguments2 = Porolog::Arguments.new pred, [:x,:y]
|
128
|
+
arguments3 = Porolog::Arguments.new pred, [:x,:y,:z]
|
129
129
|
|
130
|
-
Arguments.reset
|
130
|
+
Porolog::Arguments.reset
|
131
131
|
|
132
132
|
assert_equal 'Arguments-999', arguments1.myid
|
133
133
|
assert_equal 'Arguments-999', arguments2.myid
|
@@ -139,13 +139,13 @@ describe 'Porolog' do
|
|
139
139
|
describe '#inspect' do
|
140
140
|
|
141
141
|
it 'should show the predicate and arguments' do
|
142
|
-
predicate1 = Predicate.new :p
|
143
|
-
predicate2 = Predicate.new :q
|
144
|
-
predicate3 = Predicate.new :generic
|
142
|
+
predicate1 = Porolog::Predicate.new :p
|
143
|
+
predicate2 = Porolog::Predicate.new :q
|
144
|
+
predicate3 = Porolog::Predicate.new :generic
|
145
145
|
|
146
|
-
arguments1 = Arguments.new predicate1, [:x]
|
147
|
-
arguments2 = Arguments.new predicate2, [:list, [1,2,3]]
|
148
|
-
arguments3 = Arguments.new predicate3, [:a,:b,:c]
|
146
|
+
arguments1 = Porolog::Arguments.new predicate1, [:x]
|
147
|
+
arguments2 = Porolog::Arguments.new predicate2, [:list, [1,2,3]]
|
148
|
+
arguments3 = Porolog::Arguments.new predicate3, [:a,:b,:c]
|
149
149
|
|
150
150
|
assert_equal 'p(:x)', arguments1.inspect
|
151
151
|
assert_equal 'q(:list,[1, 2, 3])', arguments2.inspect
|
@@ -227,7 +227,7 @@ describe 'Porolog' do
|
|
227
227
|
#:nocov:
|
228
228
|
end
|
229
229
|
|
230
|
-
assert_instance_of Arguments, arguments2
|
230
|
+
assert_instance_of Porolog::Arguments, arguments2
|
231
231
|
|
232
232
|
part1 = "[ pred(1,\"a\",0.1):- #<Proc:0x"
|
233
233
|
part2 = "@#{__FILE__}:#{line}>]"
|
@@ -283,8 +283,8 @@ describe 'Porolog' do
|
|
283
283
|
describe '#solutions' do
|
284
284
|
|
285
285
|
it 'should memoize solutions' do
|
286
|
-
args1 = Arguments.new pred, [1,2]
|
287
|
-
args2 = Arguments.new pred, [:p,:q]
|
286
|
+
args1 = Porolog::Arguments.new pred, [1,2]
|
287
|
+
args2 = Porolog::Arguments.new pred, [:p,:q]
|
288
288
|
|
289
289
|
args1.fact!
|
290
290
|
|
@@ -304,8 +304,8 @@ describe 'Porolog' do
|
|
304
304
|
describe '#solve' do
|
305
305
|
|
306
306
|
it 'should unify and solve a simple predicate' do
|
307
|
-
args1 = Arguments.new pred, [1,2]
|
308
|
-
args2 = Arguments.new pred, [:p,:q]
|
307
|
+
args1 = Porolog::Arguments.new pred, [1,2]
|
308
|
+
args2 = Porolog::Arguments.new pred, [:p,:q]
|
309
309
|
|
310
310
|
args1.fact!
|
311
311
|
|
@@ -315,7 +315,7 @@ describe 'Porolog' do
|
|
315
315
|
end
|
316
316
|
|
317
317
|
it 'should unify and solve a simple predicate with multiple solutions' do
|
318
|
-
predicate :simple
|
318
|
+
Porolog::predicate :simple
|
319
319
|
|
320
320
|
simple(1,2).fact!
|
321
321
|
simple(3,4).fact!
|
@@ -329,7 +329,7 @@ describe 'Porolog' do
|
|
329
329
|
end
|
330
330
|
|
331
331
|
it 'should unify and solve a simple predicate with multiple solutions involving a head and tail' do
|
332
|
-
predicate :basic
|
332
|
+
Porolog::predicate :basic
|
333
333
|
|
334
334
|
basic([1,2,3]).fact!
|
335
335
|
basic([3,4,5]).fact!
|
@@ -343,7 +343,7 @@ describe 'Porolog' do
|
|
343
343
|
end
|
344
344
|
|
345
345
|
it 'should unify and solve a normal predicate' do
|
346
|
-
predicate :likes
|
346
|
+
Porolog::predicate :likes
|
347
347
|
|
348
348
|
likes('mary','food').fact!
|
349
349
|
likes('mary','wine').fact!
|
@@ -365,7 +365,7 @@ describe 'Porolog' do
|
|
365
365
|
end
|
366
366
|
|
367
367
|
it 'should allow isnt to be defined' do
|
368
|
-
predicate :isnt
|
368
|
+
Porolog::predicate :isnt
|
369
369
|
|
370
370
|
isnt(:A,:A) << [:CUT, false]
|
371
371
|
isnt(:A,:B) << [:CUT, true]
|
@@ -378,7 +378,7 @@ describe 'Porolog' do
|
|
378
378
|
end
|
379
379
|
|
380
380
|
it 'should unify and solve a deeper predicate' do
|
381
|
-
predicate :male, :female, :parent
|
381
|
+
Porolog::predicate :male, :female, :parent
|
382
382
|
|
383
383
|
male('james1').fact!
|
384
384
|
male('charles1').fact!
|
@@ -415,7 +415,7 @@ describe 'Porolog' do
|
|
415
415
|
], solutions
|
416
416
|
|
417
417
|
|
418
|
-
predicate :mother, :father, :sibling, :isnt
|
418
|
+
Porolog::predicate :mother, :father, :sibling, :isnt
|
419
419
|
|
420
420
|
mother(:X,:M) << [
|
421
421
|
parent(:X,:M),
|
@@ -468,7 +468,7 @@ describe 'Porolog' do
|
|
468
468
|
end
|
469
469
|
|
470
470
|
it 'should unify and solve a predicate involving a head and tail' do
|
471
|
-
predicate :join, :split, :head, :tail
|
471
|
+
Porolog::predicate :join, :split, :head, :tail
|
472
472
|
|
473
473
|
head(1).fact!
|
474
474
|
head(4).fact!
|
@@ -504,8 +504,8 @@ describe 'Porolog' do
|
|
504
504
|
end
|
505
505
|
|
506
506
|
it 'should call a builtin predicate' do
|
507
|
-
builtin :write
|
508
|
-
predicate :callwrite
|
507
|
+
Porolog::builtin :write
|
508
|
+
Porolog::predicate :callwrite
|
509
509
|
|
510
510
|
callwrite(:MESSAGE) << [
|
511
511
|
write(:MESSAGE,"\n")
|
@@ -521,8 +521,8 @@ describe 'Porolog' do
|
|
521
521
|
end
|
522
522
|
|
523
523
|
it 'should pass on instantiations between goals' do
|
524
|
-
builtin :write
|
525
|
-
predicate :passon, :copy
|
524
|
+
Porolog::builtin :write
|
525
|
+
Porolog::predicate :passon, :copy
|
526
526
|
|
527
527
|
copy(:A,:A).fact!
|
528
528
|
|
@@ -546,8 +546,8 @@ describe 'Porolog' do
|
|
546
546
|
end
|
547
547
|
|
548
548
|
it 'should implement simple recursion' do
|
549
|
-
builtin :write, :is, :gtr
|
550
|
-
predicate :count
|
549
|
+
Porolog::builtin :write, :is, :gtr
|
550
|
+
Porolog::predicate :count
|
551
551
|
|
552
552
|
count(1) << [
|
553
553
|
write("1: END\n"),
|
@@ -585,8 +585,8 @@ describe 'Porolog' do
|
|
585
585
|
end
|
586
586
|
|
587
587
|
it 'should solve tower of Hanoi' do
|
588
|
-
builtin :gtr, :is, :write
|
589
|
-
predicate :move
|
588
|
+
Porolog::builtin :gtr, :is, :write
|
589
|
+
Porolog::predicate :move
|
590
590
|
|
591
591
|
move(1,:X,:Y,:Z) << [
|
592
592
|
write('Move top disk from ', :X, ' to ', :Y, "\n"),
|
@@ -627,8 +627,8 @@ describe 'Porolog' do
|
|
627
627
|
end
|
628
628
|
|
629
629
|
it 'should solve a peeling off predicate' do
|
630
|
-
builtin :is
|
631
|
-
predicate :peel
|
630
|
+
Porolog::builtin :is
|
631
|
+
Porolog::predicate :peel
|
632
632
|
|
633
633
|
peel([],0).cut_fact!
|
634
634
|
peel(:H/:T,:N) << [
|
@@ -652,8 +652,8 @@ describe 'Porolog' do
|
|
652
652
|
it 'should solve tower of Hanoi with list representation' do
|
653
653
|
# TODO: convert to list representation
|
654
654
|
|
655
|
-
builtin :gtr, :is, :append, :write
|
656
|
-
predicate :tower, :move
|
655
|
+
Porolog::builtin :gtr, :is, :append, :write
|
656
|
+
Porolog::predicate :tower, :move
|
657
657
|
|
658
658
|
tower(1, :X, :Y, :Z, [[:X,:Z]]).fact!
|
659
659
|
tower(:N, :X, :Y, :Z, :S) << [
|
@@ -716,7 +716,7 @@ describe 'Porolog' do
|
|
716
716
|
describe '#solve_for' do
|
717
717
|
|
718
718
|
it 'should solve a predicate for specified variables' do
|
719
|
-
predicate :alpha
|
719
|
+
Porolog::predicate :alpha
|
720
720
|
|
721
721
|
alpha(1,2).fact!
|
722
722
|
|
@@ -726,7 +726,7 @@ describe 'Porolog' do
|
|
726
726
|
end
|
727
727
|
|
728
728
|
it 'should solve a predicate for a specified variable' do
|
729
|
-
predicate :alpha
|
729
|
+
Porolog::predicate :alpha
|
730
730
|
|
731
731
|
alpha(1,2).fact!
|
732
732
|
alpha(3,5).fact!
|
@@ -737,7 +737,7 @@ describe 'Porolog' do
|
|
737
737
|
end
|
738
738
|
|
739
739
|
it 'should solve a predicate with multiple solutions for specified variables' do
|
740
|
-
predicate :alpha
|
740
|
+
Porolog::predicate :alpha
|
741
741
|
|
742
742
|
alpha(1,2).fact!
|
743
743
|
alpha(3,4).fact!
|
@@ -754,7 +754,7 @@ describe 'Porolog' do
|
|
754
754
|
describe '#valid?' do
|
755
755
|
|
756
756
|
it 'should return true when a solution is found' do
|
757
|
-
predicate :f
|
757
|
+
Porolog::predicate :f
|
758
758
|
|
759
759
|
f(3).fact!
|
760
760
|
|
@@ -762,7 +762,7 @@ describe 'Porolog' do
|
|
762
762
|
end
|
763
763
|
|
764
764
|
it 'should return false when no solution is found' do
|
765
|
-
predicate :f
|
765
|
+
Porolog::predicate :f
|
766
766
|
|
767
767
|
f(1).fact!
|
768
768
|
f(2).fact!
|
@@ -773,7 +773,7 @@ describe 'Porolog' do
|
|
773
773
|
end
|
774
774
|
|
775
775
|
it 'should return false when a fallacy is found' do
|
776
|
-
predicate :f
|
776
|
+
Porolog::predicate :f
|
777
777
|
|
778
778
|
f(3).fallacy!
|
779
779
|
|
@@ -803,30 +803,30 @@ describe 'Porolog' do
|
|
803
803
|
describe '#==' do
|
804
804
|
|
805
805
|
it 'should return true for Arguments with identical predicates and arguments' do
|
806
|
-
predicate1 = Predicate.new :omega
|
806
|
+
predicate1 = Porolog::Predicate.new :omega
|
807
807
|
arguments1 = predicate1.(1,'a',0.1)
|
808
808
|
|
809
|
-
predicate2 = Predicate.new :omega
|
809
|
+
predicate2 = Porolog::Predicate.new :omega
|
810
810
|
arguments2 = predicate2.(1,'a',0.1)
|
811
811
|
|
812
812
|
assert arguments1 == arguments2, 'Arguments with identical predicates and arguments should return true'
|
813
813
|
end
|
814
814
|
|
815
815
|
it 'should return false for Arguments with non-identical arguments' do
|
816
|
-
predicate1 = Predicate.new :omega
|
816
|
+
predicate1 = Porolog::Predicate.new :omega
|
817
817
|
arguments1 = predicate1.(1,'a',0.1)
|
818
818
|
|
819
|
-
predicate2 = Predicate.new :omega
|
819
|
+
predicate2 = Porolog::Predicate.new :omega
|
820
820
|
arguments2 = predicate2.(1,'a',0.2)
|
821
821
|
|
822
822
|
refute arguments1 == arguments2, 'Arguments with non-identical arguments should return false'
|
823
823
|
end
|
824
824
|
|
825
825
|
it 'should return false for Arguments with non-identical predicates' do
|
826
|
-
predicate1 = Predicate.new :omega
|
826
|
+
predicate1 = Porolog::Predicate.new :omega
|
827
827
|
arguments1 = predicate1.(1,'a',0.1)
|
828
828
|
|
829
|
-
predicate2 = Predicate.new :omegb
|
829
|
+
predicate2 = Porolog::Predicate.new :omegb
|
830
830
|
arguments2 = predicate2.(1,'a',0.1)
|
831
831
|
|
832
832
|
refute arguments1 == arguments2, 'Arguments with non-identical predicates should return false'
|