spec/derivation_strategy/exhaustive_spec.rb in panini-1.2.0 vs spec/derivation_strategy/exhaustive_spec.rb in panini-1.3.0

- old
+ new

@@ -1,10 +1,10 @@ require "spec_helper" describe Panini::DerivationStrategy::Exhaustive do - it_behaves_like "basic derivation strategy" + it_behaves_like "basic derivation strategy" end describe "Grammar with the production S -> AAB, A -> 'a' | 'x', B -> 'b'" do @@ -19,43 +19,43 @@ @n_a.add_production(['a']) @n_a.add_production(['x']) @n_b.add_production(['b']) end - it "generates the sentence ['a', 'a', 'b'] first" do + it "generates the sentence ['a', 'a', 'b'] first" do d = Panini::DerivationStrategy::Exhaustive.new(@g) - d.sentence.should == ['a', 'a', 'b'] + expect(d.sentence).to eq(['a', 'a', 'b']) end - it "generates the sentence ['a', 'x', 'b'] next" do + it "generates the sentence ['a', 'x', 'b'] next" do d = Panini::DerivationStrategy::Exhaustive.new(@g) d.sentence - d.sentence.should == ['a', 'x', 'b'] + expect(d.sentence).to eq(['a', 'x', 'b']) end - it "generates the sentence ['x', 'a', 'b'] next" do + it "generates the sentence ['x', 'a', 'b'] next" do d = Panini::DerivationStrategy::Exhaustive.new(@g) d.sentence d.sentence - d.sentence.should == ['x', 'a', 'b'] + expect(d.sentence).to eq(['x', 'a', 'b']) end - it "generates the sentence ['x', 'x', 'b'] next" do + it "generates the sentence ['x', 'x', 'b'] next" do d = Panini::DerivationStrategy::Exhaustive.new(@g) d.sentence d.sentence d.sentence - d.sentence.should == ['x', 'x', 'b'] + expect(d.sentence).to eq(['x', 'x', 'b']) end - it "generates nil next" do + it "generates nil next" do d = Panini::DerivationStrategy::Exhaustive.new(@g) d.sentence d.sentence d.sentence d.sentence - d.sentence.should be_nil + expect(d.sentence).to be_nil end end @@ -66,19 +66,19 @@ @n = @g.add_nonterminal @n.add_production(['a']) @n.add_production(['b']) end - it "generates the sentence ['a']" do + it "generates the sentence ['a']" do d = Panini::DerivationStrategy::Exhaustive.new(@g) - d.sentence.should == ['a'] + expect(d.sentence).to eq(['a']) end - it "generates the sentence ['b']" do + it "generates the sentence ['b']" do d = Panini::DerivationStrategy::Exhaustive.new(@g) d.sentence - d.sentence.should == ['b'] + expect(d.sentence).to eq(['b']) end end @@ -96,26 +96,26 @@ @n_a.add_production(['aa']) @n_b.add_production(['b']) @n_b.add_production(['bb']) end - it "generates the sentence ['x', 'a', 'y', 'b', 'z'] first" do + it "generates the sentence ['x', 'a', 'y', 'b', 'z'] first" do d = Panini::DerivationStrategy::Exhaustive.new(@g) - d.sentence.should == ['x', 'a', 'y', 'b', 'z'] + expect(d.sentence).to eq(['x', 'a', 'y', 'b', 'z']) end - it "generates the sentence ['x', 'a', 'y', 'bb', 'z'] next" do + it "generates the sentence ['x', 'a', 'y', 'bb', 'z'] next" do d = Panini::DerivationStrategy::Exhaustive.new(@g) - d.sentence.should - d.sentence.should == ['x', 'a', 'y', 'bb', 'z'] + d.sentence + expect(d.sentence).to eq(['x', 'a', 'y', 'bb', 'z']) end - it "generates the sentence ['x', 'aa', 'y', 'b', 'z'] next" do + it "generates the sentence ['x', 'aa', 'y', 'b', 'z'] next" do d = Panini::DerivationStrategy::Exhaustive.new(@g) - d.sentence.should - d.sentence.should - d.sentence.should == ['x', 'aa', 'y', 'b', 'z'] + d.sentence + d.sentence + expect(d.sentence).to eq(['x', 'aa', 'y', 'b', 'z']) end end @@ -133,24 +133,24 @@ @n_a.add_production(['a']) @n_b.add_production([]) @n_b.add_production(['b']) end - it "generates the sentence ['x', 'y', 'z'] first" do + it "generates the sentence ['x', 'y', 'z'] first" do d = Panini::DerivationStrategy::Exhaustive.new(@g, 4) - d.sentence.should == ['x', 'y', 'z'] + expect(d.sentence).to eq(['x', 'y', 'z']) end - it "generates the sentence ['x', 'y', 'b', 'z'] next" do + it "generates the sentence ['x', 'y', 'b', 'z'] next" do d = Panini::DerivationStrategy::Exhaustive.new(@g, 4) - d.sentence.should - d.sentence.should == ['x', 'y', 'b', 'z'] + d.sentence + expect(d.sentence).to eq(['x', 'y', 'b', 'z']) end - it "generates the sentence ['x', 'a', 'y', 'z'] next" do + it "generates the sentence ['x', 'a', 'y', 'z'] next" do d = Panini::DerivationStrategy::Exhaustive.new(@g, 4) - d.sentence.should - d.sentence.should - d.sentence.should == ['x', 'a', 'y', 'z'] + d.sentence + d.sentence + expect(d.sentence).to eq(['x', 'a', 'y', 'z']) end end \ No newline at end of file