summaryrefslogtreecommitdiff
path: root/test/test_timingharness.py
diff options
context:
space:
mode:
authorDaniel Friesel <daniel.friesel@uos.de>2019-07-26 11:11:48 +0200
committerDaniel Friesel <daniel.friesel@uos.de>2019-07-26 11:11:48 +0200
commit4972286f8291b12b1a62393dc297a4a0362cbbc0 (patch)
treecf6324be0686e8f951343c8b32eeedae01fab715 /test/test_timingharness.py
parent1f4b1cf511a4a7a3132c8085e4556e9760f241cf (diff)
tests: follow unittest naming scheme
Diffstat (limited to 'test/test_timingharness.py')
-rwxr-xr-xtest/test_timingharness.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/test_timingharness.py b/test/test_timingharness.py
new file mode 100755
index 0000000..ed908c5
--- /dev/null
+++ b/test/test_timingharness.py
@@ -0,0 +1,27 @@
+#!/usr/bin/env python3
+
+from dfatool import AnalyticModel, TimingData, pta_trace_to_aggregate
+import unittest
+
+class TestModels(unittest.TestCase):
+ def test_model_singlefile_rf24(self):
+ raw_data = TimingData(['../data/20190724_161440_nRF24_no-rx.json'])
+ 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, verbose = False)
+ self.assertEqual(model.names, 'setAutoAck setPALevel setRetries setup startListening stopListening write'.split(' '))
+ static_model = model.get_static()
+ self.assertAlmostEqual(static_model('setAutoAck', 'duration'), 72, places=0)
+ self.assertAlmostEqual(static_model('setPALevel', 'duration'), 145, places=0)
+ self.assertAlmostEqual(static_model('setRetries', 'duration'), 72, places=0)
+ self.assertAlmostEqual(static_model('setup', 'duration'), 6464, places=0)
+ self.assertAlmostEqual(static_model('startListening', 'duration'), 455, places=0)
+ self.assertAlmostEqual(static_model('stopListening', 'duration'), 487, places=0)
+ self.assertAlmostEqual(static_model('write', 'duration'), 5877, places=0)
+
+ for transition in 'setAutoAck setPALevel setRetries setup startListening stopListening'.split(' '):
+ self.assertAlmostEqual(model.stats.param_dependence_ratio(transition, 'duration', 'channel'), 0, places=2)
+
+
+if __name__ == '__main__':
+ unittest.main()