diff options
Diffstat (limited to 'test/test_timingharness.py')
-rwxr-xr-x | test/test_timingharness.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/test/test_timingharness.py b/test/test_timingharness.py index bf5ecee..8d5ec20 100755 --- a/test/test_timingharness.py +++ b/test/test_timingharness.py @@ -4,12 +4,13 @@ from dfatool import AnalyticModel, TimingData, pta_trace_to_aggregate from parameters import prune_dependent_parameters import unittest + class TestModels(unittest.TestCase): def test_model_singlefile_rf24(self): raw_data = TimingData(['test-data/20190815_111745_nRF24_no-rx.json']) - preprocessed_data = raw_data.get_preprocessed_data(verbose = False) + preprocessed_data = raw_data.get_preprocessed_data(verbose=False) by_name, parameters, arg_count = pta_trace_to_aggregate(preprocessed_data) - model = AnalyticModel(by_name, parameters, arg_count, verbose = False) + model = AnalyticModel(by_name, parameters, arg_count, verbose=False) self.assertEqual(model.names, 'setPALevel setRetries setup write'.split(' ')) static_model = model.get_static() self.assertAlmostEqual(static_model('setPALevel', 'duration'), 146, places=0) @@ -33,10 +34,10 @@ class TestModels(unittest.TestCase): def test_dependent_parameter_pruning(self): raw_data = TimingData(['test-data/20190815_103347_nRF24_no-rx.json']) - preprocessed_data = raw_data.get_preprocessed_data(verbose = False) + preprocessed_data = raw_data.get_preprocessed_data(verbose=False) by_name, parameters, arg_count = pta_trace_to_aggregate(preprocessed_data) prune_dependent_parameters(by_name, parameters) - model = AnalyticModel(by_name, parameters, arg_count, verbose = False) + model = AnalyticModel(by_name, parameters, arg_count, verbose=False) self.assertEqual(model.names, 'getObserveTx setPALevel setRetries setup write'.split(' ')) static_model = model.get_static() self.assertAlmostEqual(static_model('getObserveTx', 'duration'), 75, places=0) @@ -62,9 +63,9 @@ class TestModels(unittest.TestCase): def test_function_override(self): raw_data = TimingData(['test-data/20190815_122531_nRF24_no-rx.json']) - preprocessed_data = raw_data.get_preprocessed_data(verbose = False) + preprocessed_data = raw_data.get_preprocessed_data(verbose=False) by_name, parameters, arg_count = pta_trace_to_aggregate(preprocessed_data) - model = AnalyticModel(by_name, parameters, arg_count, verbose = False, function_override={('write', 'duration'): '(parameter(auto_ack!) * (regression_arg(0) + regression_arg(1) * parameter(max_retry_count) + regression_arg(2) * parameter(retry_delay) + regression_arg(3) * parameter(max_retry_count) * parameter(retry_delay))) + ((1 - parameter(auto_ack!)) * regression_arg(4))'}) + model = AnalyticModel(by_name, parameters, arg_count, verbose=False, function_override={('write', 'duration'): '(parameter(auto_ack!) * (regression_arg(0) + regression_arg(1) * parameter(max_retry_count) + regression_arg(2) * parameter(retry_delay) + regression_arg(3) * parameter(max_retry_count) * parameter(retry_delay))) + ((1 - parameter(auto_ack!)) * regression_arg(4))'}) self.assertEqual(model.names, 'setAutoAck setPALevel setRetries setup write'.split(' ')) static_model = model.get_static() self.assertAlmostEqual(static_model('setAutoAck', 'duration'), 72, places=0) @@ -89,5 +90,6 @@ class TestModels(unittest.TestCase): self.assertAlmostEqual(param_info('write', 'duration')['function']._regression_args[3], 1, places=0) self.assertAlmostEqual(param_info('write', 'duration')['function']._regression_args[4], 1086, places=0) + if __name__ == '__main__': unittest.main() |