Skip to content

Instantly share code, notes, and snippets.

@sentientmonkey
Created July 8, 2015 05:44
Show Gist options
  • Select an option

  • Save sentientmonkey/26da58f87f23bc5df4dd to your computer and use it in GitHub Desktop.

Select an option

Save sentientmonkey/26da58f87f23bc5df4dd to your computer and use it in GitHub Desktop.
require "minitest/autorun"
class RangeTest < Minitest::Test
def test_ranges
assert 2.between? 0,5
assert (0..5).include? 2
assert (0..5).include? 0
assert (0..5).include? 5
assert (0...5).include? 0
refute (0...5).include? 5
assert 0..5 <=> 2
assert (0..5) === 2
assert (0..5).include? 0.1
assert (0..5).include? 4.99999999
assert (0..5).include? 5.0
assert (0.0..5.0).include? 5.0
assert (0.0..5.0).include? 0.0000001
assert (0.0..5.0).include? 0
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment