Sha256: 3bff77ee8490c8f1c1e36b24f073ce89df0785a2bcb6556fadccc1314c153f17

Contents?: true

Size: 1.24 KB

Versions: 4

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

4 entries across 4 versions & 1 rubygems

Version Path
rley-0.1.12 spec/rley/parser/chart_spec.rb
rley-0.1.11 spec/rley/parser/chart_spec.rb
rley-0.1.10 spec/rley/parser/chart_spec.rb
rley-0.1.09 spec/rley/parser/chart_spec.rb