diff options
author | gogotanaka <gogotanaka@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-06-10 19:39:59 +0000 |
---|---|---|
committer | gogotanaka <gogotanaka@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-06-10 19:39:59 +0000 |
commit | fcf7d234fb6ac35e389cc7f8346e18e6b513529e (patch) | |
tree | c754e86f9e7cc71377864d3620aa0b20490b8773 /test/test_cmath.rb | |
parent | d766f4698bfebcf573a4e3d37b5ccf6cf93b6eaa (diff) | |
download | bundler-fcf7d234fb6ac35e389cc7f8346e18e6b513529e.tar.gz |
* test/test_cmath.rb: Add assertions for error handling.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50818 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/test_cmath.rb')
-rw-r--r-- | test/test_cmath.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/test_cmath.rb b/test/test_cmath.rb index e911fcb9e7..d2dbf58178 100644 --- a/test/test_cmath.rb +++ b/test/test_cmath.rb @@ -41,6 +41,14 @@ class TestCMath < Test::Unit::TestCase assert_in_delta 0.17328679513998635+1.1780972450961724i , CMath.atanh(1+2i) end + def test_error_handling + assert_raise_with_message(TypeError, "Numeric Number required") { CMath.acos("2") } + assert_raise_with_message(TypeError, "Numeric Number required") { CMath.log("2") } + assert_raise(ArgumentError) { CMath.log(2, "2") } + assert_raise(NoMethodError) { CMath.log(2, 2i) } + assert_raise(RangeError) { CMath.hypot(2i, 2i) } + end + def test_cbrt_returns_principal_value_of_cube_root assert_equal (-8)**(1.0/3), CMath.cbrt(-8), '#3676' end |