Sha256: 345dfd268b84b9b00ee8d58a0739f83219650fe06d4f7aba12310a77dc7097b0

Contents?: true

Size: 1.24 KB

Versions: 23

Compression:

Stored size: 1.24 KB

Contents

require_relative '../../spec_helper'


# Load the class under test
require_relative '../../../lib/rley/parser/chart'

module Rley # Open this namespace to avoid module qualifier prefixes
  module Parser # Open this namespace to avoid module qualifier prefixes
    describe Chart do

      let(:count_token) { 20 }
      let(:dotted_rule) { double('fake-dotted-item') }

      context 'Initialization:' do

        # Default instantiation rule
        subject { Chart.new(dotted_rule, count_token) }

        it 'should be created with a start dotted rule and a token count' do
          expect { Chart.new(dotted_rule, count_token) }.not_to raise_error
        end

        it 'should have a seed state in first state_set' do
          seed_state = ParseState.new(dotted_rule, 0)
          expect(subject[0].states).to eq([seed_state])

          # Shorthand syntax
          expect(subject[0].first).to eq(seed_state)
        end

        it 'should have the correct state_set count' do
          expect(subject.state_sets.size).to eq(count_token + 1)
        end

        it 'should the start dotted rule' do
          expect(subject.start_dotted_rule).to eq(dotted_rule)
        end

      end # context

    end # describe
  end # module
end # module

# End of file

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
rley-0.1.08 spec/rley/parser/chart_spec.rb
rley-0.1.07 spec/rley/parser/chart_spec.rb
rley-0.1.06 spec/rley/parser/chart_spec.rb
rley-0.1.05 spec/rley/parser/chart_spec.rb
rley-0.1.04 spec/rley/parser/chart_spec.rb
rley-0.1.03 spec/rley/parser/chart_spec.rb
rley-0.1.02 spec/rley/parser/chart_spec.rb
rley-0.1.01 spec/rley/parser/chart_spec.rb
rley-0.1.00 spec/rley/parser/chart_spec.rb
rley-0.0.18 spec/rley/parser/chart_spec.rb
rley-0.0.17 spec/rley/parser/chart_spec.rb
rley-0.0.16 spec/rley/parser/chart_spec.rb
rley-0.0.15 spec/rley/parser/chart_spec.rb
rley-0.0.14 spec/rley/parser/chart_spec.rb
rley-0.0.13 spec/rley/parser/chart_spec.rb
rley-0.0.12 spec/rley/parser/chart_spec.rb
rley-0.0.11 spec/rley/parser/chart_spec.rb
rley-0.0.10 spec/rley/parser/chart_spec.rb
rley-0.0.09 spec/rley/parser/chart_spec.rb
rley-0.0.08 spec/rley/parser/chart_spec.rb