blob: 2c06f1a6b316d41e0492d3734f866dd383cd4ab1 (
plain)
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
|
def test_benchmark_api args, assert
result = args.gtk.benchmark iterations: 100,
only_one: -> () {
r = 0
(1..100).each do |i|
r += 1
end
}
assert.equal! result.first_place.name, :only_one
result = args.gtk.benchmark iterations: 100,
iterations_100: -> () {
r = 0
(1..100).each do |i|
r += 1
end
},
iterations_50: -> () {
r = 0
(1..50).each do |i|
r += 1
end
}
assert.equal! result.first_place.name, :iterations_50
result = args.gtk.benchmark iterations: 1,
iterations_100: -> () {
r = 0
(1..100).each do |i|
r += 1
end
},
iterations_50: -> () {
r = 0
(1..50).each do |i|
r += 1
end
}
assert.equal! result.too_small_to_measure, true
end
|