Skip to content

Commit b7231b4

Browse files
committed
clean up 1.9 test warnings
1 parent dd3ee1e commit b7231b4

File tree

4 files changed

+16
-4
lines changed

4 files changed

+16
-4
lines changed

test/linalg-test.rb

+12
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,18 @@ def assert_close(a, b)
4040
a.within(EPSILON, b)
4141
}
4242
end
43+
44+
if RUBY_VERSION >= '1.9.0'
45+
def assert_nothing_raised
46+
begin
47+
yield
48+
rescue => e
49+
assert_block("raised in assert_nothing_raised: #{e.inspect}") {
50+
false
51+
}
52+
end
53+
end
54+
end
4355
end
4456

4557
$mat_f = DMatrix.rows [

test/tc_eigensystem.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ def test_eigensystem
6767
end
6868

6969
eigs_c = DMatrix.new(2*dim, 2*dim)
70-
eigs_list.each_with_index { |c, j|
71-
eigs_c.replace_minor(0, 2*j, c)
70+
eigs_list.each_with_index { |c, jj|
71+
eigs_c.replace_minor(0, 2*jj, c)
7272
}
7373

7474
assert_close(a_c*eigs_c, eigs_c*lambda_c)

test/tc_nullspace.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def test_typical
3737
end
3838
a.replace_column(c0, a.column(c1))
3939
ns2 = a.nullspace(EPSILON)
40-
assert_not_nil(ns2)
40+
refute_nil(ns2)
4141
assert_equal(ns2.hsize, 1)
4242
assert_equal(a.hsize, a.rank + a.nullity)
4343
end

test/tc_scalars.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def test_scalars
5959
u = DMatrix.rand(t.vsize, 1)
6060
v = t.dot(u)
6161
w = 0.0
62-
t.each_index { |i, j| w += t[i]*u[i] }
62+
t.each_index { |ii, jj| w += t[ii]*u[ii] }
6363
assert_close(v, w)
6464
}
6565
end

0 commit comments

Comments
 (0)