-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_run.rb
More file actions
34 lines (26 loc) · 752 Bytes
/
test_run.rb
File metadata and controls
34 lines (26 loc) · 752 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
require './timing_code.rb'
require './array_generator.rb'
class TestRun
attr_reader :counter
TEST_ARRAY_INCREMENT = 5000
TEST_ARRAY_LIMIT = 100000
COUNTER_MAX = TEST_ARRAY_LIMIT/TEST_ARRAY_INCREMENT
def initialize
@counter = 0
@test_run = TimingCode.new
end
def increment_the_counter
@counter += 1
end
def one_test_run(function_to_time, array_to_use)
@array_to_use = ArrayGenerator.new(array_to_use, @counter, TEST_ARRAY_INCREMENT)
@test_run.timing_code(function_to_time, @array_to_use.array)
increment_the_counter
end
def full_run_through(function_to_time, array_to_use)
while @counter <= COUNTER_MAX
one_test_run(function_to_time, array_to_use)
end
@counter = 0
end
end