Created
April 10, 2012 16:11
-
-
Save remear/2352505 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 "test/unit" | |
| class TestMaximum < Test::Unit::TestCase | |
| def maximum(arr) | |
| arr.length == 1 ? arr.first : arr.sort.last | |
| end | |
| def test_maximum | |
| assert_equal maximum([2, 42, 22, 02]), 42 | |
| assert_equal maximum([-2, 0, 33, 304, 2, -2]), 304 | |
| assert_equal maximum([1]), 1 | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment