diff options
author | marcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-10-07 19:29:53 +0000 |
---|---|---|
committer | marcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-10-07 19:29:53 +0000 |
commit | eb9c3e7120286163c8dfb4c802ddad8c36c9f0c4 (patch) | |
tree | 2c71ee3b67f71ee0eeebfb463d7a0f5ae32c3b31 /test/matrix | |
parent | 2ebafed88a665dcaaf4fb58b8c3fd0809db8fa2c (diff) | |
download | bundler-eb9c3e7120286163c8dfb4c802ddad8c36c9f0c4.tar.gz |
* lib/matrix.rb: Add Vector.basis.
Based on patch by gogo tanaka [#10072]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47833 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/matrix')
-rw-r--r-- | test/matrix/test_vector.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/matrix/test_vector.rb b/test/matrix/test_vector.rb index ced774c490..465108dcec 100644 --- a/test/matrix/test_vector.rb +++ b/test/matrix/test_vector.rb @@ -10,6 +10,15 @@ class TestVector < Test::Unit::TestCase @w1 = Vector[2,3,4] end + def test_basis + assert_equal(Vector[1, 0, 0], Vector.basis(size: 3, index: 0)) + assert_raise(ArgumentError) { Vector.basis(size: -1, index: 2) } + assert_raise(ArgumentError) { Vector.basis(size: 4, index: -1) } + assert_raise(ArgumentError) { Vector.basis(size: 3, index: 3) } + assert_raise(ArgumentError) { Vector.basis(size: 3) } + assert_raise(ArgumentError) { Vector.basis(index: 3) } + end + def test_identity assert_same @v1, @v1 assert_not_same @v1, @v2 |