Guest User

Untitled

a guest
Oct 20th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. # coding: utf-8
  2.  
  3. module Kernel
  4. def ∞
  5. Float::INFINITY
  6. end
  7. end
  8.  
  9. if __FILE__ == $0
  10. require 'test/unit'
  11. class InfinityAliasTest < Test::Unit::TestCase
  12. def judge(n)
  13. case n
  14. when 1..10; 1
  15. when 11..∞; 2
  16. else ; 3
  17. end
  18. end
  19.  
  20. def test_judge_infinity
  21. assert_equal judge(1), 1
  22. assert_equal judge(10), 1
  23. assert_equal judge(11), 2
  24. assert_equal judge(100), 2
  25. assert_equal judge(9999999999999999), 2
  26. end
  27. end
  28. end
Add Comment
Please, Sign In to add comment