aboutsummaryrefslogtreecommitdiffstats
path: root/test/matrix
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-09-15 01:33:43 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-09-15 01:33:43 +0000
commit1cda1058865c87d076088bb1d441891f03180e5f (patch)
tree1203b04be4ecc73e479dc430ce17db0e9d42348b /test/matrix
parentc767be3039c9d511cc01541a7560896404e2ab80 (diff)
downloadruby-1cda1058865c87d076088bb1d441891f03180e5f.tar.gz
* test/matrix/test_matrix.rb (setup): typo.
(test_equality): misdefinition of the expected working. Reported by an anonymous user. (test_hash): added. * test/matrix/test_vector.rb: ditto. Mon Sep 15 03:33:10 2008 Tanaka Akira <akr@fsij.org> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19352 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/matrix')
-rw-r--r--test/matrix/test_matrix.rb10
-rw-r--r--test/matrix/test_vector.rb10
2 files changed, 16 insertions, 4 deletions
diff --git a/test/matrix/test_matrix.rb b/test/matrix/test_matrix.rb
index 9e132efa5e..0850117b86 100644
--- a/test/matrix/test_matrix.rb
+++ b/test/matrix/test_matrix.rb
@@ -6,7 +6,7 @@ class TestMatrix < Test::Unit::TestCase
@m1 = Matrix[[1,2,3], [4,5,6]]
@m2 = Matrix[[1,2,3], [4,5,6]]
@m3 = @m1.clone
- @m4 = Matrix[[1,0, 2.0, 3.0], [4.0, 5.0, 6.0]]
+ @m4 = Matrix[[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]]
@n1 = Matrix[[2,3,4], [5,6,7]]
end
@@ -22,7 +22,7 @@ class TestMatrix < Test::Unit::TestCase
assert_equal @m1, @m1
assert_equal @m1, @m2
assert_equal @m1, @m3
- assert_not_equal @m1, @m4
+ assert_equal @m1, @m4
assert_not_equal @m1, @n1
end
@@ -40,4 +40,10 @@ class TestMatrix < Test::Unit::TestCase
assert !hash.key?(@m4)
assert !hash.key?(@n1)
end
+
+ def test_hash
+ assert_equal @m1.hash, @m1.hash
+ assert_equal @m1.hash, @m2.hash
+ assert_equal @m1.hash, @m3.hash
+ end
end
diff --git a/test/matrix/test_vector.rb b/test/matrix/test_vector.rb
index d8f5c778c3..95a39693fc 100644
--- a/test/matrix/test_vector.rb
+++ b/test/matrix/test_vector.rb
@@ -6,7 +6,7 @@ class TestVector < Test::Unit::TestCase
@v1 = Vector[1,2,3]
@v2 = Vector[1,2,3]
@v3 = @v1.clone
- @v4 = Vector[1,0, 2.0, 3.0]
+ @v4 = Vector[1.0, 2.0, 3.0]
@w1 = Vector[2,3,4]
end
@@ -22,7 +22,7 @@ class TestVector < Test::Unit::TestCase
assert_equal @v1, @v1
assert_equal @v1, @v2
assert_equal @v1, @v3
- assert_not_equal @v1, @v4
+ assert_equal @v1, @v4
assert_not_equal @v1, @w1
end
@@ -40,4 +40,10 @@ class TestVector < Test::Unit::TestCase
assert !hash.key?(@v4)
assert !hash.key?(@w1)
end
+
+ def test_hash
+ assert_equal @v1.hash, @v1.hash
+ assert_equal @v1.hash, @v2.hash
+ assert_equal @v1.hash, @v3.hash
+ end
end