Sha256: cb401fec2c6133936c5defb90695da8091cb5f24de11ef27e812fc69a0814891

Contents?: true

Size: 858 Bytes

Versions: 1

Compression:

Stored size: 858 Bytes

Contents

require 'test/unit'

require 'rockit/grammar'
include Rockit

class UTestRepetitionOperator < Test::Unit::TestCase
  def test_01_creation_of_repetition
    r = Repetition.new(:A, 2, 10)
    assert_kind_of(Repetition, r)
    assert_kind_of(Operator, r)
    assert_kind_of(GrammarSymbol, r)
    assert_equal(2, r.min)
    assert_equal(10, r.max)
  end

  def test_02_creation_of_mult
    r = Mult.new(:C)
    assert_kind_of(Mult, r)
    assert_kind_of(Repetition, r)
    assert_kind_of(Operator, r)
    assert_kind_of(GrammarSymbol, r)
    assert_equal(0, r.min)
    assert_equal((1.0/0.0), r.max)
  end

  def test_03_creation_of_plus
    r = Plus.new(:C)
    assert_kind_of(Plus, r)
    assert_kind_of(Repetition, r)
    assert_kind_of(Operator, r)
    assert_kind_of(GrammarSymbol, r)
    assert_equal(1, r.min)
    assert_equal((1.0/0.0), r.max)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rockit-0.7.1 tests/unit/rockit/utest_repetition_operators.rb