ViolaJones/python/project_test.py
2024-07-22 22:03:30 +02:00

16 lines
771 B
Python

from toolbox_unit_test import format_time_test, format_time_ns_test
from toolbox import header, footer, formatted_row, formatted_line
from toolbox import format_time_ns, benchmark_function
from time import perf_counter_ns
if __name__ == '__main__':
unit_timestamp = perf_counter_ns()
unit_gaps = [27, -18, 29]
header(unit_gaps, ['Unit testing', 'Time spent (ns)', 'Formatted time spent'])
benchmark_function('testing format_time', unit_gaps[0], format_time_test)
benchmark_function('testing format_time_ns', unit_gaps[0], format_time_ns_test)
time_spent = perf_counter_ns() - unit_timestamp
formatted_line(unit_gaps, '', '', '', '')
formatted_row(unit_gaps, ['Unit testing summary', f'{time_spent:,}', format_time_ns(time_spent)])
footer(unit_gaps)