Skip to content

Commit 522d238

Browse files
prasunanand9prady9
authored andcommitted
correct test for sinh
1 parent 1d86d6f commit 522d238

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

test/arith_test.rb

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ def setup
66
@a = ArrayFire::Af_Array.new 2, [2,2],[1,2,3,4]
77
@b = ArrayFire::Af_Array.new 2, [2,2],[2,4,6,8]
88
@elements = [10, -11, 48, 21, 65, 0, 1, -7, 112]
9+
@elements_h = [1, -1, 0, 1, 1, 0.4, -0.7, 1, 0.9]
910
@af_array = ArrayFire::Af_Array.new 2, [3,3], @elements
11+
@af_array_h = ArrayFire::Af_Array.new 2, [3,3], @elements_h
1012
end
1113

1214
def test_addition
@@ -28,12 +30,20 @@ def test_division
2830
assert_equal c, @b / @a
2931
end
3032

31-
[:sin, :cos, :tan, :sinh, :cosh, :tanh].each do |method|
33+
[:sin, :cos, :tan].each do |method|
3234
define_method("test_#{method}") do
3335
x = @elements.map{ |e| Math.send(method, e) }
3436
res_arr = ArrayFire::Af_Array.new 2, [3,3], x
3537
assert res_arr.approx_equal @af_array.send method
3638
end
3739
end
3840

41+
[:sinh, :cosh, :tanh].each do |method|
42+
define_method("test_#{method}") do
43+
x = @elements_h.map{ |e| Math.send(method, e) }
44+
res_arr = ArrayFire::Af_Array.new 2, [3,3], x
45+
assert res_arr.approx_equal @af_array_h.send method
46+
end
47+
end
48+
3949
end

0 commit comments

Comments
 (0)