mini_kraken 0.2.03 → 0.3.03

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +378 -333
  3. data/CHANGELOG.md +48 -0
  4. data/README.md +29 -21
  5. data/lib/mini_kraken/atomic/all_atomic.rb +5 -0
  6. data/lib/mini_kraken/atomic/atomic_term.rb +96 -0
  7. data/lib/mini_kraken/atomic/k_boolean.rb +42 -0
  8. data/lib/mini_kraken/{core → atomic}/k_integer.rb +2 -5
  9. data/lib/mini_kraken/atomic/k_string.rb +17 -0
  10. data/lib/mini_kraken/{core → atomic}/k_symbol.rb +4 -8
  11. data/lib/mini_kraken/composite/all_composite.rb +4 -0
  12. data/lib/mini_kraken/composite/composite_term.rb +27 -0
  13. data/lib/mini_kraken/composite/cons_cell.rb +301 -0
  14. data/lib/mini_kraken/composite/cons_cell_visitor.rb +50 -0
  15. data/lib/mini_kraken/composite/list.rb +32 -0
  16. data/lib/mini_kraken/core/all_core.rb +8 -0
  17. data/lib/mini_kraken/core/any_value.rb +31 -7
  18. data/lib/mini_kraken/core/arity.rb +69 -0
  19. data/lib/mini_kraken/core/association.rb +29 -4
  20. data/lib/mini_kraken/core/association_copy.rb +50 -0
  21. data/lib/mini_kraken/core/base_term.rb +13 -0
  22. data/lib/mini_kraken/core/blackboard.rb +315 -0
  23. data/lib/mini_kraken/core/bookmark.rb +46 -0
  24. data/lib/mini_kraken/core/context.rb +492 -0
  25. data/lib/mini_kraken/core/duck_fiber.rb +21 -19
  26. data/lib/mini_kraken/core/entry.rb +40 -0
  27. data/lib/mini_kraken/core/fail.rb +20 -18
  28. data/lib/mini_kraken/core/fusion.rb +29 -0
  29. data/lib/mini_kraken/core/goal.rb +20 -29
  30. data/lib/mini_kraken/core/log_var.rb +22 -0
  31. data/lib/mini_kraken/core/log_var_ref.rb +108 -0
  32. data/lib/mini_kraken/core/nullary_relation.rb +2 -9
  33. data/lib/mini_kraken/core/parametrized_term.rb +68 -0
  34. data/lib/mini_kraken/core/relation.rb +14 -28
  35. data/lib/mini_kraken/core/scope.rb +67 -0
  36. data/lib/mini_kraken/core/solver_adapter.rb +58 -0
  37. data/lib/mini_kraken/core/specification.rb +48 -0
  38. data/lib/mini_kraken/core/succeed.rb +21 -17
  39. data/lib/mini_kraken/core/symbol_table.rb +137 -0
  40. data/lib/mini_kraken/core/term.rb +15 -4
  41. data/lib/mini_kraken/glue/dsl.rb +44 -88
  42. data/lib/mini_kraken/glue/run_star_expression.rb +28 -30
  43. data/lib/mini_kraken/rela/all_rela.rb +8 -0
  44. data/lib/mini_kraken/rela/binary_relation.rb +30 -0
  45. data/lib/mini_kraken/rela/conde.rb +143 -0
  46. data/lib/mini_kraken/rela/conj2.rb +65 -0
  47. data/lib/mini_kraken/rela/def_relation.rb +93 -0
  48. data/lib/mini_kraken/rela/disj2.rb +70 -0
  49. data/lib/mini_kraken/rela/fresh.rb +98 -0
  50. data/lib/mini_kraken/{core → rela}/goal_relation.rb +7 -9
  51. data/lib/mini_kraken/rela/unify.rb +265 -0
  52. data/lib/mini_kraken/version.rb +1 -1
  53. data/mini_kraken.gemspec +2 -2
  54. data/spec/.rubocop.yml +1 -1
  55. data/spec/atomic/atomic_term_spec.rb +98 -0
  56. data/spec/{core → atomic}/k_boolean_spec.rb +19 -34
  57. data/spec/{core → atomic}/k_symbol_spec.rb +3 -16
  58. data/spec/composite/cons_cell_spec.rb +225 -0
  59. data/spec/{core → composite}/cons_cell_visitor_spec.rb +36 -20
  60. data/spec/composite/list_spec.rb +50 -0
  61. data/spec/core/any_value_spec.rb +52 -0
  62. data/spec/core/arity_spec.rb +92 -0
  63. data/spec/core/association_copy_spec.rb +69 -0
  64. data/spec/core/association_spec.rb +31 -4
  65. data/spec/core/blackboard_spec.rb +287 -0
  66. data/spec/core/bookmark_spec.rb +40 -0
  67. data/spec/core/context_spec.rb +245 -0
  68. data/spec/core/core_spec.rb +40 -0
  69. data/spec/core/duck_fiber_spec.rb +16 -46
  70. data/spec/core/fail_spec.rb +5 -6
  71. data/spec/core/goal_spec.rb +22 -12
  72. data/spec/core/log_var_ref_spec.rb +105 -0
  73. data/spec/core/log_var_spec.rb +64 -0
  74. data/spec/core/nullary_relation_spec.rb +33 -0
  75. data/spec/core/parametrized_tem_spec.rb +39 -0
  76. data/spec/core/relation_spec.rb +33 -0
  77. data/spec/core/scope_spec.rb +73 -0
  78. data/spec/core/solver_adapter_spec.rb +70 -0
  79. data/spec/core/specification_spec.rb +43 -0
  80. data/spec/core/succeed_spec.rb +5 -5
  81. data/spec/core/symbol_table_spec.rb +142 -0
  82. data/spec/glue/dsl_chap1_spec.rb +88 -144
  83. data/spec/glue/dsl_chap2_spec.rb +454 -19
  84. data/spec/glue/run_star_expression_spec.rb +81 -906
  85. data/spec/rela/conde_spec.rb +153 -0
  86. data/spec/rela/conj2_spec.rb +123 -0
  87. data/spec/rela/def_relation_spec.rb +119 -0
  88. data/spec/rela/disj2_spec.rb +117 -0
  89. data/spec/rela/fresh_spec.rb +147 -0
  90. data/spec/rela/unify_spec.rb +369 -0
  91. data/spec/support/factory_atomic.rb +29 -0
  92. data/spec/support/factory_composite.rb +21 -0
  93. data/spec/support/factory_methods.rb +11 -26
  94. metadata +98 -70
  95. data/lib/mini_kraken/core/association_walker.rb +0 -183
  96. data/lib/mini_kraken/core/atomic_term.rb +0 -67
  97. data/lib/mini_kraken/core/base_arg.rb +0 -10
  98. data/lib/mini_kraken/core/binary_relation.rb +0 -63
  99. data/lib/mini_kraken/core/composite_goal.rb +0 -46
  100. data/lib/mini_kraken/core/composite_term.rb +0 -41
  101. data/lib/mini_kraken/core/conde.rb +0 -143
  102. data/lib/mini_kraken/core/conj2.rb +0 -79
  103. data/lib/mini_kraken/core/cons_cell.rb +0 -82
  104. data/lib/mini_kraken/core/cons_cell_visitor.rb +0 -102
  105. data/lib/mini_kraken/core/def_relation.rb +0 -53
  106. data/lib/mini_kraken/core/designation.rb +0 -55
  107. data/lib/mini_kraken/core/disj2.rb +0 -72
  108. data/lib/mini_kraken/core/environment.rb +0 -73
  109. data/lib/mini_kraken/core/equals.rb +0 -193
  110. data/lib/mini_kraken/core/formal_arg.rb +0 -22
  111. data/lib/mini_kraken/core/formal_ref.rb +0 -25
  112. data/lib/mini_kraken/core/freshness.rb +0 -45
  113. data/lib/mini_kraken/core/goal_arg.rb +0 -12
  114. data/lib/mini_kraken/core/goal_template.rb +0 -102
  115. data/lib/mini_kraken/core/k_boolean.rb +0 -35
  116. data/lib/mini_kraken/core/outcome.rb +0 -63
  117. data/lib/mini_kraken/core/variable.rb +0 -41
  118. data/lib/mini_kraken/core/variable_ref.rb +0 -84
  119. data/lib/mini_kraken/core/vocabulary.rb +0 -446
  120. data/lib/mini_kraken/glue/fresh_env.rb +0 -103
  121. data/lib/mini_kraken/glue/fresh_env_factory.rb +0 -83
  122. data/spec/core/association_walker_spec.rb +0 -192
  123. data/spec/core/conde_spec.rb +0 -147
  124. data/spec/core/conj2_spec.rb +0 -114
  125. data/spec/core/cons_cell_spec.rb +0 -107
  126. data/spec/core/def_relation_spec.rb +0 -97
  127. data/spec/core/disj2_spec.rb +0 -99
  128. data/spec/core/environment_spec.rb +0 -142
  129. data/spec/core/equals_spec.rb +0 -317
  130. data/spec/core/goal_template_spec.rb +0 -74
  131. data/spec/core/outcome_spec.rb +0 -56
  132. data/spec/core/variable_ref_spec.rb +0 -30
  133. data/spec/core/variable_spec.rb +0 -35
  134. data/spec/core/vocabulary_spec.rb +0 -219
  135. data/spec/glue/fresh_env_factory_spec.rb +0 -97
  136. data/spec/glue/fresh_env_spec.rb +0 -62
@@ -1,35 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative '../spec_helper' # Use the RSpec framework
4
- require_relative '../../lib/mini_kraken/core/environment'
5
-
6
- # Load the class under test
7
- require_relative '../../lib/mini_kraken/core/variable'
8
-
9
-
10
- module MiniKraken
11
- module Core
12
- describe Variable do
13
- let(:env) { Environment.new }
14
- subject { Variable.new('q') }
15
-
16
- context 'Initialization:' do
17
- it 'should be initialized with a name' do
18
- expect { Variable.new('q') }.not_to raise_error
19
- end
20
-
21
- it 'should know its name' do
22
- expect(subject.name).to eq('q')
23
- end
24
-
25
- it 'should be fresh by default' do
26
- env.add_var(subject)
27
- expect(subject.fresh?(env)).to be_truthy
28
- end
29
- end # context
30
-
31
- context 'Provided services:' do
32
- end # context
33
- end # describe
34
- end # module
35
- end # module
@@ -1,219 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative '../spec_helper' # Use the RSpec framework
4
- require_relative '../../lib/mini_kraken/core/k_symbol'
5
- require_relative '../../lib/mini_kraken/core/variable'
6
- require_relative '../../lib/mini_kraken/core/variable_ref'
7
- require_relative '../support/factory_methods'
8
-
9
- # Load the class under test
10
- # frozen_string_literal: true
11
-
12
- require_relative '../../lib/mini_kraken/core/vocabulary'
13
-
14
- module MiniKraken
15
- module Core
16
- class TestVocabulary
17
- include Vocabulary
18
-
19
- def initialize(aParent = nil)
20
- init_vocabulary(aParent)
21
- end
22
- end # class
23
-
24
- # Helper module that simulates an environment-like object.
25
- module VariableBearer
26
- attr_reader :vars
27
- attr_accessor :ivars
28
-
29
- def init_var_bearer
30
- @vars = {}
31
- @ivars = {}
32
- self
33
- end
34
-
35
- def add_var(aVarName)
36
- vars[aVarName] = Variable.new(aVarName)
37
- ivars[aVarName] = Set.new([aVarName])
38
- end
39
- end # module
40
-
41
- describe Vocabulary do
42
- include FactoryMethods
43
-
44
- let(:parent) { TestVocabulary.new }
45
- subject { TestVocabulary.new }
46
-
47
- context 'Initialization:' do
48
- it 'could be initialized without a parent' do
49
- expect { TestVocabulary.new }.not_to raise_error
50
- end
51
-
52
- it 'could be initialized with a parent' do
53
- expect { TestVocabulary.new(parent) }.not_to raise_error
54
- end
55
-
56
- it 'should know its parent (if any)' do
57
- expect(subject.parent).to be_nil
58
- instance = TestVocabulary.new(parent)
59
- expect(instance.parent).to eq(parent)
60
- end
61
-
62
- it 'should have no associations at initialization' do
63
- expect(subject.associations).to be_empty
64
- end
65
- end # context
66
-
67
- context 'Provided services:' do
68
- let(:pea) { KSymbol.new(:pea) }
69
- let(:pod) { KSymbol.new(:pod) }
70
- let(:ref_q) { VariableRef.new('q') }
71
- let(:ref_x) { VariableRef.new('x') }
72
- let(:grandma) do
73
- voc = TestVocabulary.new
74
- voc.extend(VariableBearer)
75
- voc.init_var_bearer
76
- end
77
- let(:mother) { TestVocabulary.new(grandma) }
78
- subject { TestVocabulary.new(mother) }
79
-
80
- it 'should provide a walker over ancestors' do
81
- walker = subject.ancestor_walker
82
- expect(walker).to be_kind_of(Enumerator)
83
- expect(walker.next).to eq(subject)
84
- expect(walker.next).to eq(mother)
85
- expect(walker.next).to eq(grandma)
86
- expect(walker.next).to be_nil
87
- end
88
-
89
- it 'should know if a variable is defined' do
90
- expect(subject.include?('q')).to be_falsey
91
- grandma.add_var('x')
92
- expect(subject.include?('q')).to be_falsey
93
- expect(grandma.include?('x')).to be_truthy
94
- expect(mother.include?('x')).to be_truthy
95
- expect(subject.include?('x')).to be_truthy
96
- subject.extend(VariableBearer)
97
- subject.init_var_bearer
98
- subject.add_var('y')
99
- expect(subject.include?('y')).to be_truthy
100
- expect(mother.include?('y')).to be_falsey
101
- end
102
-
103
- it 'should allow the addition of associations' do
104
- grandma.add_var('q')
105
- expect(subject['q']).to be_empty
106
- res_add = mother.add_assoc('q', pea)
107
- expect(res_add).to be_kind_of(Association)
108
- expect(subject['q'].size).to eq(1)
109
- expect(subject['q'].first.value).to eq(pea)
110
-
111
- subject.add_assoc('q', ref_x)
112
- expect(subject['q'].size).to eq(2)
113
- expect(subject['q'].first.value).to eq(ref_x)
114
- expect(subject['q'].last.value).to eq(pea)
115
- end
116
-
117
- it 'should allow the deletion of associations' do
118
- grandma.add_var('q')
119
- mother.add_assoc('q', pea)
120
- subject.add_assoc('q', ref_x)
121
- expect(mother.associations.size).to eq(1)
122
- expect(subject.associations.size).to eq(1)
123
-
124
- subject.clear
125
- expect(subject.associations).to be_empty
126
-
127
- mother.clear
128
- expect(mother.associations).to be_empty
129
- end
130
-
131
- it 'should say fresh when a variable has no association at all' do
132
- grandma.add_var('q')
133
- grandma.add_var('x')
134
- expect(subject.fresh?(ref_q)).to be_truthy
135
- subject.add_assoc('q', ref_x) # Dependency: q --> x
136
- expect(subject.fresh?(ref_x)).to be_truthy
137
- end
138
-
139
- it 'should say not fresh when variable --> atomic value' do
140
- grandma.add_var('q')
141
- grandma.add_var('x')
142
- subject.add_assoc('q', ref_x) # Dependency: q --> x
143
- expect(subject.fresh?(ref_q)).to be_truthy
144
-
145
- # Associate with an atomic term
146
- subject.add_assoc('q', pea)
147
- expect(subject.fresh?(ref_q)).to be_falsey
148
- end
149
-
150
- it 'should say not fresh when variable --> composite of atomics' do
151
- grandma.add_var('q')
152
-
153
- # Composite having only atomic terms as leaf elements
154
- expr = cons(pea, cons(pod))
155
- subject.add_assoc('q', expr)
156
- expect(subject.fresh?(ref_q)).to be_falsey
157
- end
158
-
159
- it 'say not fresh when variable --> composite of atomics & bound var' do
160
- grandma.add_var('q')
161
- grandma.add_var('x')
162
- subject.add_assoc('x', pea) # Dependency: x --> pea
163
- expr = cons(pea, cons(pod, cons(ref_x)))
164
- subject.add_assoc('q', expr)
165
- expect(subject.fresh?(ref_q)).to be_falsey
166
- end
167
-
168
- it 'say not fresh when variable --> composite of atomics & fresh var' do
169
- grandma.add_var('q')
170
- grandma.add_var('x')
171
- expr = cons(pea, cons(pod, cons(ref_x)))
172
- subject.add_assoc('q', expr)
173
- expect(subject.fresh?(ref_q)).to be_truthy
174
- end
175
-
176
- it 'say not fresh when variables are fused & one is ground' do
177
- grandma.add_var('q')
178
- grandma.add_var('x')
179
-
180
- # Beware of cyclic structure
181
- subject.add_assoc('q', ref_x) # Dependency: q --> x
182
- subject.add_assoc('x', ref_q) # Dependency: x --> q
183
- expect(subject.fresh?(ref_x)).to be_truthy
184
- expect(subject.fresh?(ref_q)).to be_truthy
185
- expect(subject.associations).to be_empty
186
-
187
- # Associate with an atomic term
188
- subject.add_assoc('x', pea)
189
- expect(subject.fresh?(ref_q)).to be_falsey
190
- end
191
-
192
- it 'should rank names sequentially' do
193
- 2.times do
194
- expect(subject.get_rank('a')).to eq(0)
195
- expect(subject.get_rank('z')).to eq(1)
196
- expect(subject.get_rank('c')).to eq(2)
197
- end
198
- end
199
-
200
- it 'should clear the rankings' do
201
- expect(subject.get_rank('a')).to eq(0)
202
- expect(subject.get_rank('z')).to eq(1)
203
-
204
- subject.clear_rankings
205
- expect(grandma.rankings).to be_empty
206
-
207
- expect(subject.get_rank('z')).to eq(0)
208
- expect(subject.get_rank('a')).to eq(1)
209
- end
210
-
211
- it 'should provide a String representation of itself' do
212
- expectation = +"#<#{subject.class}:#{subject.object_id.to_s(16)} @parent="
213
- expectation << "#<#{subject.parent.class}:#{subject.parent.object_id.to_s(16)}>>"
214
- expect(subject.inspect).to eq(expectation)
215
- end
216
- end # context
217
- end # describe
218
- end # module
219
- end # module
@@ -1,97 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative '../../lib/mini_kraken/core/equals'
4
- require_relative '../../lib/mini_kraken/core/formal_arg'
5
- require_relative '../../lib/mini_kraken/core/formal_ref'
6
- require_relative '../../lib/mini_kraken/core/goal_template'
7
-
8
- require_relative '../support/factory_methods'
9
-
10
- # Load the class under test
11
- require_relative '../../lib/mini_kraken/glue/fresh_env_factory'
12
-
13
-
14
- module MiniKraken
15
- module Glue
16
- describe FreshEnvFactory do
17
- include FactoryMethods
18
-
19
- # (fresh (d) (== d r))
20
- let(:r_formal_ref) { Core::FormalRef.new('r') }
21
- let(:d_ref) { var_ref('d') }
22
- let(:sample_goal_t) do
23
- Core::GoalTemplate.new(Core::Equals.instance, [d_ref, r_formal_ref])
24
- end
25
- subject { FreshEnvFactory.new(['d'], sample_goal_t) }
26
-
27
- context 'Initialization:' do
28
- it 'should be initialized with names and a goal template' do
29
- expect { FreshEnvFactory.new(['d'], sample_goal_t) }.not_to raise_error
30
- end
31
-
32
- it 'should know the variable names' do
33
- expect(subject.names).to eq(['d'])
34
- end
35
-
36
- it 'should know the goal template' do
37
- expect(subject.goal_template).to eq(sample_goal_t)
38
- end
39
- end # context
40
-
41
- context 'Factory for FreshEnv instances' do
42
- # (defrel (caro r a)
43
- # (fresh (d)
44
- # (== (cons a d) r)))
45
- # ;; r, a are formal args, they part of caro signature
46
- # ;; d is a formal ref argument
47
- let(:pea) { k_symbol(:pea) }
48
- let(:q_ref) { var_ref('q') }
49
- let(:r_formal) { Core::FormalRef.new('r') }
50
- let(:a_formal) { Core::FormalRef.new('a') }
51
- let(:t_param1) { Core::ConsCell.new(a_formal, d_ref) }
52
- let(:other_goal_t) do
53
- Core::GoalTemplate.new(Core::Equals.instance, [t_param1, r_formal])
54
- end
55
-
56
- # (fresh (d) (== d r))
57
- it 'should build FreshEnv instance with simple goal' do
58
- created = subject.instantiate([r_formal], [pea])
59
-
60
- # Are variables correctly built?
61
- expect(created).to be_kind_of(FreshEnv)
62
- expect(created.vars['d']).to be_kind_of(Core::Variable)
63
-
64
- # Is the goal correectly built?
65
- goal = created.goal
66
- expect(goal.relation).to eq(Core::Equals.instance)
67
- expect(goal.actuals[0]).to be_kind_of(Core::VariableRef)
68
- expect(goal.actuals[0].name).to eq('d')
69
- expect(goal.actuals[1]).to be_kind_of(Core::KSymbol)
70
- expect(goal.actuals[1]).to eq(:pea)
71
- end
72
-
73
- it 'should build FreshEnv instance with goal' do
74
- instance = FreshEnvFactory.new(['d'], other_goal_t)
75
- acorn = cons(k_symbol(:a), cons(k_symbol(:c), cons(k_symbol(:o),
76
- cons(k_symbol(:r), cons(k_symbol(:n))))))
77
- created = instance.instantiate([r_formal, a_formal], [acorn, q_ref])
78
-
79
- # Are variables correctly built?
80
- expect(created).to be_kind_of(FreshEnv)
81
- expect(created.vars['d']).to be_kind_of(Core::Variable)
82
-
83
- # Is the goal correctly built?
84
- goal = created.goal
85
- expect(goal.relation).to eq(Core::Equals.instance)
86
- expect(goal.actuals[0]).to be_kind_of(Core::ConsCell)
87
- expect(goal.actuals[0].car).to be_kind_of(Core::VariableRef)
88
- expect(goal.actuals[0].car.name).to eq('q')
89
- expect(goal.actuals[0].cdr).to be_kind_of(Core::VariableRef)
90
- expect(goal.actuals[0].cdr.name).to eq('d')
91
- expect(goal.actuals[1]).to be_kind_of(Core::ConsCell)
92
- expect(goal.actuals[1].to_s).to eq('(:a :c :o :r :n)')
93
- end
94
- end # context
95
- end # describe
96
- end # module
97
- end # module
@@ -1,62 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative '../spec_helper' # Use the RSpec framework
4
- require_relative '../../lib/mini_kraken/core/goal'
5
- require_relative '../../lib/mini_kraken/core/equals'
6
- require_relative '../../lib/mini_kraken/core/fail'
7
- require_relative '../../lib/mini_kraken/core/k_symbol'
8
- require_relative '../../lib/mini_kraken/core/succeed'
9
-
10
- # Load the class under test
11
- require_relative '../../lib/mini_kraken/glue/fresh_env'
12
-
13
-
14
- module MiniKraken
15
- module Glue
16
- describe FreshEnv do
17
- let(:pea) { Core::KSymbol.new(:pea) }
18
- let(:pod) { Core::KSymbol.new(:pod) }
19
- let(:sample_goal) do
20
- Core::Goal.new(Core::Equals.instance, [pea, pod])
21
- end
22
- let(:pea_goal) do
23
- Core::Goal.new(Core::Equals.instance, [pea, pea])
24
- end
25
- let(:goal_succeeds) { Core::Goal.new(Core::Succeed.instance, []) }
26
- let(:goal_fails) { Core::Goal.new(Core::Fail.instance, []) }
27
- subject { FreshEnv.new(['q'], sample_goal) }
28
-
29
- context 'Initialization:' do
30
- it 'could be initialized with names and a goal' do
31
- expect { FreshEnv.new(['q'], sample_goal) }.not_to raise_error
32
- end
33
-
34
- it 'could be initialized with names and goals' do
35
- expect { FreshEnv.new(%w[x y], [pea_goal, goal_succeeds]) }.not_to raise_error
36
- end
37
-
38
- it 'should know its variables' do
39
- expect(subject.vars['q']).not_to be_nil
40
-
41
- instance = FreshEnv.new(%w[x y], sample_goal)
42
- expect(instance.vars['x']).not_to be_nil
43
- expect(instance.vars['y']).not_to be_nil
44
- end
45
-
46
- it 'should know its goal' do
47
- # Single goal at initialization
48
- expect(subject.goal).to eq(sample_goal)
49
-
50
- # Multiple goals at initialization
51
- instance = FreshEnv.new(['q'], [pea_goal, goal_succeeds])
52
- expect(instance.goal.relation.name).to eq('conj2')
53
- expect(instance.goal.actuals[0]).to eq(pea_goal)
54
- expect(instance.goal.actuals[1]).to eq(goal_succeeds)
55
- end
56
- end # context
57
-
58
- context 'Provided services:' do
59
- end # context
60
- end # describe
61
- end # module
62
- end # module