|
23 | 23 | end |
24 | 24 | end |
25 | 25 |
|
26 | | - its(:cost) {is_expected.to be (4+2+1)} |
| 26 | + its(:cost) {is_expected.to be (2+4+8)} |
27 | 27 |
|
28 | 28 | it "should not have variables" do |
29 | 29 | expect(subject.variables?).to be_falsey |
|
59 | 59 | specify {is_expected.to be_variable} |
60 | 60 | specify {is_expected.to be_bound} |
61 | 61 |
|
62 | | - its(:cost) {is_expected.to be (4+2+1)} |
| 62 | + its(:cost) {is_expected.to be (2+4+8)} |
63 | 63 |
|
64 | 64 | it "should have one variable" do |
65 | 65 | expect(subject).to be_variables |
|
99 | 99 | specify {is_expected.to be_variable} |
100 | 100 | specify {is_expected.to be_bound} |
101 | 101 |
|
102 | | - its(:cost) {is_expected.to be (4+2+1)} |
| 102 | + its(:cost) {is_expected.to be (2+4+8)} |
103 | 103 |
|
104 | 104 | it "should have three variables" do |
105 | 105 | expect(subject).to be_variables |
|
132 | 132 | context "with variable in different locations" do |
133 | 133 | { |
134 | 134 | "spog": [[RDF::URI("s"), RDF::URI("p"), RDF::URI("o"), graph_name: RDF::URI("g")], 0], |
135 | | - "spo?": [[RDF::URI("s"), RDF::URI("p"), RDF::URI("o"), graph_name: :g], 8], |
136 | | - "sp?g": [[RDF::URI("s"), RDF::URI("p"), :o, graph_name: RDF::URI("g")], 1], |
137 | | - "s?og": [[RDF::URI("s"), :p, RDF::URI("o"), graph_name: RDF::URI("g")], 2], |
138 | | - "?pog": [[:s, RDF::URI("p"), RDF::URI("o"), graph_name: RDF::URI("g")], 4], |
| 135 | + "spo?": [[RDF::URI("s"), RDF::URI("p"), RDF::URI("o"), graph_name: :g], 1], |
| 136 | + "sp?g": [[RDF::URI("s"), RDF::URI("p"), :o, graph_name: RDF::URI("g")], 8], |
| 137 | + "s?og": [[RDF::URI("s"), :p, RDF::URI("o"), graph_name: RDF::URI("g")], 4], |
| 138 | + "?pog": [[:s, RDF::URI("p"), RDF::URI("o"), graph_name: RDF::URI("g")], 2], |
139 | 139 | }.each do |name, (args, cost)| |
140 | 140 | it "cost for #{name} should be #{cost}" do |
141 | 141 | pattern = described_class.new(*args) |
|
146 | 146 |
|
147 | 147 | context "#cost" do |
148 | 148 | it "can be set separately" do |
149 | | - expect(subject.cost).to be (4+2+1) |
| 149 | + expect(subject.cost).to be (2+4+8) |
150 | 150 | subject.cost = 0 |
151 | 151 | expect(subject.cost).to be 0 |
152 | 152 | end |
|
162 | 162 | expect(subject.graph_name).to eq RDF::Query::Variable.new(:c) |
163 | 163 | end |
164 | 164 |
|
165 | | - its(:cost) {is_expected.to be (8+4+2+1)} |
| 165 | + its(:cost) {is_expected.to be (1+2+4+8)} |
166 | 166 |
|
167 | 167 | it "uses a constant for :default" do |
168 | 168 | pattern = described_class.new(s, p, o, graph_name: false) |
169 | 169 | expect(pattern.graph_name).to eq false |
170 | | - expect(pattern.cost).to eq (4+2+1) |
| 170 | + expect(pattern.cost).to eq (2+4+8) |
171 | 171 | end |
172 | 172 | end |
173 | 173 |
|
|
181 | 181 | specify {is_expected.to be_variable} |
182 | 182 | specify {is_expected.not_to be_bound} |
183 | 183 |
|
184 | | - its(:cost) {is_expected.to be (4+2+1)} |
| 184 | + its(:cost) {is_expected.to be (2+4+8)} |
185 | 185 |
|
186 | 186 | describe "#bind" do |
187 | 187 | context "complete solution" do |
|
236 | 236 | specify {is_expected.to be_variable} |
237 | 237 | specify {is_expected.not_to be_bound} |
238 | 238 |
|
239 | | - its(:cost) {is_expected.to be (4+2+1)} |
| 239 | + its(:cost) {is_expected.to be (2+4+8)} |
240 | 240 |
|
241 | 241 | it "should have two variable" do |
242 | 242 | expect(subject).to be_variables |
|
275 | 275 | let(:pattern) {described_class.new(s, p, o)} |
276 | 276 | subject {described_class.new(pattern, RDF::URI("ex:p"), "o")} |
277 | 277 |
|
278 | | - its(:cost) {is_expected.to be (4+2+1+4)} |
| 278 | + its(:cost) {is_expected.to be ((2+4+8)*2)} |
279 | 279 |
|
280 | 280 | specify {is_expected.not_to be_constant} |
281 | 281 | specify {is_expected.to be_variable} |
|
349 | 349 | context "with constant subject pattern" do |
350 | 350 | let(:pattern) {described_class.new(RDF::URI("ex:s"), RDF::URI("ex:p"), "o")} |
351 | 351 | let(:subject) {described_class.new(pattern, p, o)} |
352 | | - its(:cost) {is_expected.to be (4+2+1)} |
| 352 | + its(:cost) {is_expected.to be (4+8)} |
353 | 353 |
|
354 | 354 | specify {is_expected.not_to be_constant} |
355 | 355 | specify {is_expected.to be_variable} |
|
370 | 370 | context "with variable object pattern" do |
371 | 371 | let(:pattern) {described_class.new(s, p, o)} |
372 | 372 | let(:subject) {described_class.new(RDF::URI("ex:s"), RDF::URI("ex:p"), pattern)} |
373 | | - its(:cost) {is_expected.to be (4+2+1)} |
| 373 | + its(:cost) {is_expected.to be ((2+4+8)*4)} |
374 | 374 |
|
375 | 375 | specify {is_expected.not_to be_constant} |
376 | 376 | specify {is_expected.to be_variable} |
|
443 | 443 | context "with constant object pattern" do |
444 | 444 | let(:pattern) {described_class.new(RDF::URI("ex:s1"), RDF::URI("ex:p1"), "o1")} |
445 | 445 | let(:subject) {described_class.new(s, p, pattern)} |
446 | | - its(:cost) {is_expected.to be (4+2)} |
| 446 | + its(:cost) {is_expected.to be (2+4)} |
447 | 447 |
|
448 | 448 | specify {is_expected.not_to be_constant} |
449 | 449 | specify {is_expected.to be_variable} |
|
0 commit comments