Sha256: 9ff57966eff8d4de5c7e40cf00ec07c8f1ebbbb313da8b56a9ef82361be75c58

Contents?: true

Size: 1.29 KB

Versions: 87

Compression:

Stored size: 1.29 KB

Contents

require 'helper'

class TestLexerStackState < Minitest::Test
  def setup
    @state = Parser::Lexer::StackState.new('state')
  end

  def test_push
    refute @state.active?

    assert_equal true, @state.push(true)
    assert @state.active?

    assert_equal false, @state.push(false)
    refute @state.active?
  end

  def test_clear
    @state.push true
    @state.clear

    refute @state.active?
  end

  def test_pop
    @state.push(true)

    assert_equal true, @state.pop
    refute @state.active?
  end

  def test_pop_empty
    assert_equal false, @state.pop
    refute @state.active?
  end

  def test_lexpop_10
    @state.push(true)
    @state.push(false)

    assert_equal true, @state.lexpop
    assert_equal true, @state.pop
  end

  def test_lexpop_01
    @state.push(false)
    @state.push(true)

    assert_equal true, @state.lexpop
    assert_equal true, @state.pop
  end

  def test_lexpop_00
    @state.push(false)
    @state.push(false)

    assert_equal false, @state.lexpop
    assert_equal false, @state.pop
  end

  def test_dup
    @state.push(true)
    new_state = @state.dup

    assert_equal true, @state.pop
    assert_equal true, new_state.pop
  end

  def test_to_s
    @state.push(true)
    @state.push(false)
    @state.push(false)

    assert_equal '[100 <= state]', @state.to_s
  end
end

Version data entries

87 entries across 87 versions & 5 rubygems

Version Path
parser-2.0.0.beta8 test/test_lexer_stack_state.rb
parser-2.0.0.beta7 test/test_lexer_stack_state.rb
parser-2.0.0.beta6 test/test_lexer_stack_state.rb
parser-2.0.0.beta5 test/test_lexer_stack_state.rb
parser-2.0.0.beta4 test/test_lexer_stack_state.rb
parser-2.0.0.beta3 test/test_lexer_stack_state.rb
parser-2.0.0.beta2 test/test_lexer_stack_state.rb