diff options
author | marcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-03-05 23:45:42 +0000 |
---|---|---|
committer | marcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-03-05 23:45:42 +0000 |
commit | b81950f480df1c07f2e6f271d23d066dafdc0e1f (patch) | |
tree | 032b3e9f6e56fd5acb4cb353ea16969c4c9d3a5d /test/matrix/test_matrix.rb | |
parent | ce85cd55c621804a39f06e9ce46974fc693ff8df (diff) | |
download | ruby-b81950f480df1c07f2e6f271d23d066dafdc0e1f.tar.gz |
* lib/matrix.rb: Add Vector#round. Patch by Jordan Stephens.
[Fixes GH-802]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49866 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/matrix/test_matrix.rb')
-rw-r--r-- | test/matrix/test_matrix.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/test/matrix/test_matrix.rb b/test/matrix/test_matrix.rb index 3fdef3b314..7f058abe37 100644 --- a/test/matrix/test_matrix.rb +++ b/test/matrix/test_matrix.rb @@ -190,6 +190,12 @@ class TestMatrix < Test::Unit::TestCase assert_equal(@m1, Matrix[o, [4,5,6]]) end + def test_round + a = Matrix[[1.0111, 2.32320, 3.04343], [4.81, 5.0, 6.997]] + b = Matrix[[1.01, 2.32, 3.04], [4.81, 5.0, 7.0]] + assert_equal(a.round(2), b) + end + def test_rows assert_equal(@m1, Matrix.rows([[1, 2, 3], [4, 5, 6]])) end |