Sha256: 6cbc5030354760d44977d4cf556b24751b51b37f7ebd21b4e657b5d32bd6d218
Contents?: true
Size: 980 Bytes
Versions: 16
Compression:
Stored size: 980 Bytes
Contents
require 'facets/range/within' require 'test/unit' class TestRangeWithin < Test::Unit::TestCase def test_within? assert( (4..5).within?(3..6) ) assert( (3..6).within?(3..6) ) assert(! (2..5).within?(3..6) ) assert(! (5..7).within?(3..6) ) end def test_umbrella_aligned assert_equal( [0,0], (3..6).umbrella(3..6) ) assert_equal( [0,0], (3...6).umbrella(3...6) ) end def test_umbrella_partial_aligned assert_equal( [1,0], (3..6).umbrella(2..6) ) assert_equal( [0,1], (3..6).umbrella(3..7) ) assert_equal( [-1,0], (3..6).umbrella(4..6) ) assert_equal( [0,-1], (3..6).umbrella(3..5) ) end def test_umbrella_offset assert_equal( [1,1], (3..6).umbrella(2..7) ) assert_equal( [-1,1], (3..6).umbrella(4..7) ) assert_equal( [1,-1], (3..6).umbrella(2..5) ) assert_equal( [-1,-1], (3..6).umbrella(4..5) ) end def test_umbrella_offset_by_exclusion assert_equal( [0,1], (10...20).umbrella(10..20) ) end end
Version data entries
16 entries across 16 versions & 1 rubygems