Class: Interval::TestSimpleMethods
- Inherits:
-
Test::Unit::TestCase
- Object
- Test::Unit::TestCase
- Interval::TestSimpleMethods
- Defined in:
- lib/interval.rb
Overview
Tests other methods of Interval::Simple.
Instance Method Summary collapse
Instance Method Details
#test_midpoint ⇒ Object
891 892 893 894 |
# File 'lib/interval.rb', line 891 def test_midpoint assert_equal(1.5,Interval[1,2].midpoint) assert_raise(NoMethodError){ Interval[[1,2],[3,4]].midpoint } end |
#test_width ⇒ Object
896 897 898 899 900 901 902 903 904 905 906 907 908 |
# File 'lib/interval.rb', line 896 def test_width assert_equal(1, Interval[1,2].width) assert_equal(1, Interval[1,2].width) tester = proc{|x| assert_equal( 2.0 ** (-(Math.log(x)/Math.log(2)).ceil - 52), (1/Interval[x]).width) } tester.call(3.0) tester.call(5.0) tester.call(119.0) tester.call(34e-4) end |