28 lines
802 B
Python
28 lines
802 B
Python
import random
|
|
|
|
|
|
print("Testing Time Presets")
|
|
successful_counts = 0
|
|
for _ in range(5000):
|
|
preset_time = round(0.5 + random.random() / 3, 2)
|
|
count(t=preset_time)
|
|
if elapsedtime()[0] < (preset_time - 1e-6) or ch1()[0] < 1:
|
|
print(f'Failed Test with preset {preset_time} and elapsed {elapsedtime()[0]}')
|
|
raise Exception('Failed')
|
|
|
|
successful_counts += 1
|
|
print(f'completed {successful_counts} counts')
|
|
|
|
|
|
print("Testing Count Presets")
|
|
successful_counts = 0
|
|
for _ in range(5000):
|
|
preset_count = 10 + random.randint(-2,2)
|
|
count(ch1 = preset_count)
|
|
if ch1()[0] != preset_count:
|
|
print(f'CH1 was {ch1()[0]} and preset was {preset_count}')
|
|
raise Exception('Failed')
|
|
|
|
successful_counts += 1
|
|
print(f'completed {successful_counts} counts')
|