-
-
Notifications
You must be signed in to change notification settings - Fork 937
Expand file tree
/
Copy pathtest_float.rb
More file actions
54 lines (39 loc) · 898 Bytes
/
test_float.rb
File metadata and controls
54 lines (39 loc) · 898 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
require 'test/unit'
class TestGH5939 < Test::Unit::TestCase
class Primitive
def _value
@__value ||= 0.0
end
def +(other)
_value + other
end
def ==(other)
other == _value
end
def to_f
_value.to_f
end
end
def test_op_indy_regression
threads = []
30.times do
threads << Thread.start do
begin
i = Object.new
def i.version; @version ||= Primitive.new end
assert_equal 11.0, i.version + 11.0
assert_false i.version == 5.0
assert_true 0.0 == i.version
true
rescue java.lang.Exception => ex
warn("#{__method__} FAILED WITH: #{ex}")
raise ex
end
end
end
threads.each &:join
threads.each do |thread|
assert thread.value # should not raise (if thread raised an exception)
end
end
end