From e57559f8ae50b489dd5e239179e518d0834054da Mon Sep 17 00:00:00 2001 From: Patrick Simianer Date: Thu, 16 Jul 2015 16:10:31 +0200 Subject: SparseVector: fixes --- test/test_sparsevector.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'test/test_sparsevector.rb') diff --git a/test/test_sparsevector.rb b/test/test_sparsevector.rb index a23a7d3..2263c73 100755 --- a/test/test_sparsevector.rb +++ b/test/test_sparsevector.rb @@ -10,9 +10,13 @@ class TestSparseVector < Test::Unit::TestCase v[:a] = 1 v[:b] = 2 v[:c] = 3 + w = SparseVector.new v assert_equal Math.sqrt(1**2+2**2+3**2), v.norm v.unit! assert_equal v.norm, 1.0 + q = w.unit + assert_equal q.norm, 1.0 + assert_equal w.norm, Math.sqrt(1**2+2**2+3**2) end end -- cgit v1.2.3