Sha256: efec6a9c260a625d53d04e9b684990f67c76755d4421a6fda9b50b7e77623fb8

Contents?: true

Size: 696 Bytes

Versions: 3

Compression:

Stored size: 696 Bytes

Contents

require 'facets/array/intersection'

test_case Array do

	method :intersection do
		test { [1, 2].intersection.assert == nil }
		test { [1..10, 11..20].intersection.assert == nil }
		test { [1..10, 5..15, 11..20].intersection.assert == nil }
		test { [8..8, 1..10, 10 ].intersection.assert == nil }
		test { [10, 1..10].intersection.assert == 10 }
		test { [1..10, 1].intersection.assert == 1 }
		test { [1, 1].intersection.assert == 1 }
		test { [1..10, 5, 5..8, 5..10 ].intersection.assert == 5 }
		test { [1..10, 5..8, 5..10 ].intersection.assert == (5..8) }
		test { [5..10, 1..10, 4..8 ].intersection.assert == (5..8) }
		test { [5..10, 1..10, 4..20, 8].intersection.assert == 8 }
	end

end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
facets-glimmer-3.2.0 test/core/array/test_intersection.rb
facets-3.1.0 test/core/array/test_intersection.rb
facets-3.0.0 test/core/array/test_intersection.rb