Sha256: ed308bf2d0adf69c41f655ee7eb0699552a4e6a4ee51f2c3bcc40e7a67effb5c

Contents?: true

Size: 820 Bytes

Versions: 6

Compression:

Stored size: 820 Bytes

Contents

# This file is a behavioral specification for the design under test.

# lowest upper bound of counter's value
LIMIT = 2 ** Counter.Size.intVal

# maximum allowed value for a counter
MAX = LIMIT - 1

class ResettedCounterValue < Test::Unit::TestCase
  def setup
    Counter.reset!
  end

  def test_zero
    assert_equal 0, Counter.count.intVal
  end

  def test_increment
    LIMIT.times do |i|
      assert_equal i, Counter.count.intVal
      relay_verilog # increment the counter
    end
  end
end

class MaximumCounterValue < Test::Unit::TestCase
  def setup
    Counter.reset!

    # increment the counter to maximum value
    MAX.times {relay_verilog}
    assert_equal MAX, Counter.count.intVal
  end

  def test_overflow
    relay_verilog # increment the counter
    assert_equal 0, Counter.count.intVal
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ruby-vpi-11.1.1 samp/counter/counter_xunit_spec.rb
ruby-vpi-12.0.1 samp/counter/counter_xunit_spec.rb
ruby-vpi-12.0.0 samp/counter/counter_xunit_spec.rb
ruby-vpi-12.1.0 samp/counter/counter_xunit_spec.rb
ruby-vpi-13.0.0 samp/counter/counter_xunit_spec.rb
ruby-vpi-12.0.2 samp/counter/counter_xunit_spec.rb