mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
2bef7dece1
* test/ruby/test_time.rb: add tests to achieve over 70% test coverage of time.c. * test/ruby/test_prec.rb: ditto over 90% for prec.c. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15399 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
21 lines
489 B
Ruby
21 lines
489 B
Ruby
require 'test/unit'
|
|
|
|
class TestPrecision < Test::Unit::TestCase
|
|
def test_prec_i
|
|
assert_same(1, 1.0.prec(Integer))
|
|
assert_same(1, 1.0.prec_i)
|
|
assert_same(1, Integer.induced_from(1.0))
|
|
end
|
|
|
|
def test_prec_f
|
|
assert_equal(1.0, 1.prec(Float))
|
|
assert_equal(1.0, 1.prec_f)
|
|
assert_equal(1.0, Float.induced_from(1))
|
|
end
|
|
|
|
def test_induced_from
|
|
m = Module.new
|
|
m.instance_eval { include(Precision) }
|
|
assert_raise(TypeError) { m.induced_from(0) }
|
|
end
|
|
end
|