Sha256: 91135be071ab0d1818dc5dead82597766745bab64b0dc205aec2965e4d37c36c

Contents?: true

Size: 1.25 KB

Versions: 16

Compression:

Stored size: 1.25 KB

Contents

require File.join(File.dirname(__FILE__), "..", "test_helper")
require 'mocha/infinite_range'

class InfiniteRangeTest < Test::Unit::TestCase
  
  def test_should_include_values_at_or_above_minimum
    range = Range.at_least(10)
    assert(range === 10)
    assert(range === 11)
    assert(range === 1000000)
  end
  
  def test_should_not_include_values_below_minimum
    range = Range.at_least(10)
    assert_false(range === 0)
    assert_false(range === 9)
    assert_false(range === -11)
  end
  
  def test_should_be_human_readable_description_for_at_least
    assert_equal "at least 10", Range.at_least(10).to_s
  end
  
  def test_should_include_values_at_or_below_maximum
    range = Range.at_most(10)
    assert(range === 10)
    assert(range === 0)
    assert(range === -1000000)
  end
  
  def test_should_not_include_values_above_maximum
    range = Range.at_most(10)
    assert_false(range === 11)
    assert_false(range === 1000000)
  end
  
  def test_should_be_human_readable_description_for_at_most
    assert_equal "at most 10", Range.at_most(10).to_s
  end
  
  def test_should_not_break_original_description
    assert_equal "1..10", (1..10).to_s
    assert_equal "1...10", (1...10).to_s
  end
  
  def assert_false(condition)
    assert(!condition)
  end
  
end

Version data entries

16 entries across 16 versions & 3 rubygems

Version Path
greatseth-google-geo-2.0 vendor/mocha-0.4.0/test/mocha/infinite_range_test.rb
greatseth-google-geo-2.1 vendor/mocha-0.4.0/test/mocha/infinite_range_test.rb
greatseth-google-geo-2.2 vendor/mocha-0.4.0/test/mocha/infinite_range_test.rb
google-geo-2.3 vendor/mocha-0.4.0/test/mocha/infinite_range_test.rb
google-geo-2.0 vendor/mocha-0.4.0/test/mocha/infinite_range_test.rb
google-geo-2.1 vendor/mocha-0.4.0/test/mocha/infinite_range_test.rb
mocha-0.1 test/mocha/infinite_range_test.rb
mocha-0.1.1 test/mocha/infinite_range_test.rb
mocha-0.2.1 test/mocha/infinite_range_test.rb
mocha-0.3.0 test/mocha/infinite_range_test.rb
mocha-0.3.1 test/mocha/infinite_range_test.rb
mocha-0.3.3 test/mocha/infinite_range_test.rb
mocha-0.4.0 test/mocha/infinite_range_test.rb
mocha-0.1.2 test/mocha/infinite_range_test.rb
mocha-0.3.2 test/mocha/infinite_range_test.rb
mocha-0.2.0 test/mocha/infinite_range_test.rb