Created
July 15, 2015 03:45
-
-
Save litonico/16c46ea29c675f00a2ce to your computer and use it in GitHub Desktop.
Ruby lacks exclusive between
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'minitest/autorun' | |
class TestExclusiveBetween < Minitest::Test | |
def assert_between min, max, value | |
# Fill in here | |
end | |
def refute_between min, max, value | |
# Fill in here | |
end | |
def test_number_between_min_and_max | |
assert_between 0.0, 1.0, 0.4 | |
end | |
def test_maximum_is_included | |
assert_between 0.0, 1.0, 1.0 | |
end | |
def test_just_a_little_above_minimum_is_included | |
assert_between 0.0, 1.0, Float::EPSILON | |
end | |
def test_minimum_is_excluded | |
refute_between 0.0, 1.0, 0.0 | |
end | |
def test_above_max_is_excluded | |
refute_between 0.0, 1.0, 2.0 | |
end | |
def test_just_a_little_above_maximum_is_excluded | |
refute_between 0.0, 1.0, 1.0+Float::EPSILON | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment