@@ -38,18 +38,18 @@ def test_concurrency
38
38
cache[key]
39
39
cache.delete(key)
40
40
RUBY_EVAL
41
- do_thread_loop ( :concurrency , code )
41
+ do_thread_loop ( __method__ , code )
42
42
end
43
43
44
44
def test_put_if_absent
45
- do_thread_loop ( :put_if_absent , 'acc += 1 unless cache.put_if_absent(key, key)' , :key_count => 100_000 ) do |result , cache , options , keys |
45
+ do_thread_loop ( __method__ , 'acc += 1 unless cache.put_if_absent(key, key)' , :key_count => 100_000 ) do |result , cache , options , keys |
46
46
assert_standard_accumulator_test_result ( result , cache , options , keys )
47
47
end
48
48
end
49
49
50
50
def test_compute_if_absent
51
51
code = 'cache.compute_if_absent(key) { acc += 1; key }'
52
- do_thread_loop ( :compute_if_absent , code ) do |result , cache , options , keys |
52
+ do_thread_loop ( __method__ , code ) do |result , cache , options , keys |
53
53
assert_standard_accumulator_test_result ( result , cache , options , keys )
54
54
end
55
55
end
@@ -62,7 +62,7 @@ def test_compute_put_if_absent
62
62
acc += 1 unless cache.put_if_absent(key, key)
63
63
end
64
64
RUBY_EVAL
65
- do_thread_loop ( :compute_put_if_absent , code ) do |result , cache , options , keys |
65
+ do_thread_loop ( __method__ , code ) do |result , cache , options , keys |
66
66
assert_standard_accumulator_test_result ( result , cache , options , keys )
67
67
end
68
68
end
@@ -133,7 +133,7 @@ def test_count_race
133
133
v = cache[key]
134
134
acc += change if cache.replace_pair(key, v, v + change)
135
135
RUBY_EVAL
136
- do_thread_loop ( :count_race , code , :loop_count => 5 , :prelude => prelude , :cache_setup => ZERO_VALUE_CACHE_SETUP ) do |result , cache , options , keys |
136
+ do_thread_loop ( __method__ , code , :loop_count => 5 , :prelude => prelude , :cache_setup => ZERO_VALUE_CACHE_SETUP ) do |result , cache , options , keys |
137
137
result_sum = sum ( result )
138
138
assert_equal ( sum ( keys . map { |key | cache [ key ] } ) , result_sum )
139
139
assert_equal ( sum ( cache . values ) , result_sum )
@@ -143,14 +143,14 @@ def test_count_race
143
143
144
144
def test_get_and_set_new
145
145
code = 'acc += 1 unless cache.get_and_set(key, key)'
146
- do_thread_loop ( :get_and_set_new , code ) do |result , cache , options , keys |
146
+ do_thread_loop ( __method__ , code ) do |result , cache , options , keys |
147
147
assert_standard_accumulator_test_result ( result , cache , options , keys )
148
148
end
149
149
end
150
150
151
151
def test_get_and_set_existing
152
152
code = 'acc += 1 if cache.get_and_set(key, key) == -1'
153
- do_thread_loop ( :get_and_set_existing , code , :cache_setup => INITIAL_VALUE_CACHE_SETUP , :initial_value => -1 ) do |result , cache , options , keys |
153
+ do_thread_loop ( __method__ , code , :cache_setup => INITIAL_VALUE_CACHE_SETUP , :initial_value => -1 ) do |result , cache , options , keys |
154
154
assert_standard_accumulator_test_result ( result , cache , options , keys )
155
155
end
156
156
end
@@ -260,7 +260,7 @@ def count_up_via_compute(opts = {})
260
260
old_value ? old_value + 1 : 1
261
261
end
262
262
RUBY_EVAL
263
- do_thread_loop ( :count_up_via_compute , code , { :loop_count => 5 } . merge ( opts ) ) do |result , cache , options , keys |
263
+ do_thread_loop ( __method__ , code , { :loop_count => 5 } . merge ( opts ) ) do |result , cache , options , keys |
264
264
assert_count_up ( result , cache , options , keys )
265
265
result . inject ( nil ) do |previous_value , next_value | # since compute guarantees atomicity all count ups should be equal
266
266
assert_equal previous_value , next_value if previous_value
@@ -273,7 +273,7 @@ def count_up_via_merge_pair(opts = {})
273
273
code = <<-RUBY_EVAL
274
274
cache.merge_pair(key, 1) {|old_value| old_value + 1}
275
275
RUBY_EVAL
276
- do_thread_loop ( :count_up_via_merge_pair , code , { :loop_count => 5 } . merge ( opts ) ) do |result , cache , options , keys |
276
+ do_thread_loop ( __method__ , code , { :loop_count => 5 } . merge ( opts ) ) do |result , cache , options , keys |
277
277
all_match = true
278
278
expected_value = options [ :loop_count ] * options [ :thread_count ]
279
279
keys . each do |key |
@@ -291,7 +291,7 @@ def add_remove_to_zero(opts = {})
291
291
acc += 1 unless cache.put_if_absent(key, key)
292
292
acc -= 1 if cache.delete_pair(key, key)
293
293
RUBY_EVAL
294
- do_thread_loop ( :add_remove_to_zero , code , { :loop_count => 5 } . merge ( opts ) ) do |result , cache , options , keys |
294
+ do_thread_loop ( __method__ , code , { :loop_count => 5 } . merge ( opts ) ) do |result , cache , options , keys |
295
295
assert_all_key_mappings_exist ( cache , keys , false )
296
296
assert_equal ( cache . size , sum ( result ) )
297
297
end
@@ -301,7 +301,7 @@ def add_remove_to_zero_via_merge_pair(opts = {})
301
301
code = <<-RUBY_EVAL
302
302
acc += (cache.merge_pair(key, key) {}) ? 1 : -1
303
303
RUBY_EVAL
304
- do_thread_loop ( :add_remove_to_zero_via_merge_pair , code , { :loop_count => 5 } . merge ( opts ) ) do |result , cache , options , keys |
304
+ do_thread_loop ( __method__ , code , { :loop_count => 5 } . merge ( opts ) ) do |result , cache , options , keys |
305
305
assert_all_key_mappings_exist ( cache , keys , false )
306
306
assert_equal ( cache . size , sum ( result ) )
307
307
end
0 commit comments