Sha256: 0a840211b90e1fcf12e42f7cc8e27f87da468f2bfe60664a17b6fa3f016c4cae

Contents?: true

Size: 1.26 KB

Versions: 12

Compression:

Stored size: 1.26 KB

Contents

# frozen_string_literal: true

require_relative '../../spec_helper'

# Load the class under test
require_relative '../../../lib/rley/gfg/non_terminal_vertex'

module Rley # Open this namespace to avoid module qualifier prefixes
  module GFG # Open this namespace to avoid module qualifier prefixes
    describe NonTerminalVertex do
      let(:sample_nt) { double('fake-non-terminal') }
      subject { NonTerminalVertex.new(sample_nt) }

      context 'Initialization:' do
        it 'should be created with a non-terminal symbol' do
          expect { NonTerminalVertex.new(sample_nt) }.not_to raise_error
        end

        it 'should know its non-terminal' do
          expect(subject.non_terminal).to eq(sample_nt)
        end


        it 'should accept at more than one outgoing edge' do
          edge1 = double('fake-edge1')
          edge2 = double('fake-edge2')

          expect { subject.add_edge(edge1) }.not_to raise_error
          expect(subject.edges.size).to eq(1)
          expect(subject.edges.last).to eq(edge1)

          expect { subject.add_edge(edge2) }.not_to raise_error
          expect(subject.edges.size).to eq(2)
          expect(subject.edges.last).to eq(edge2)
        end
      end # context
    end # describe
  end # module
end # module

# End of file

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
rley-0.8.13 spec/rley/gfg/non_terminal_vertex_spec.rb
rley-0.8.11 spec/rley/gfg/non_terminal_vertex_spec.rb
rley-0.8.10 spec/rley/gfg/non_terminal_vertex_spec.rb
rley-0.8.09 spec/rley/gfg/non_terminal_vertex_spec.rb
rley-0.8.08 spec/rley/gfg/non_terminal_vertex_spec.rb
rley-0.8.06 spec/rley/gfg/non_terminal_vertex_spec.rb
rley-0.8.05 spec/rley/gfg/non_terminal_vertex_spec.rb
rley-0.8.03 spec/rley/gfg/non_terminal_vertex_spec.rb
rley-0.8.02 spec/rley/gfg/non_terminal_vertex_spec.rb
rley-0.8.01 spec/rley/gfg/non_terminal_vertex_spec.rb
rley-0.8.00 spec/rley/gfg/non_terminal_vertex_spec.rb
rley-0.7.08 spec/rley/gfg/non_terminal_vertex_spec.rb