From c4ca92d205f19c3e851eadffb85f9e84d77ffc47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jose=20Nu=C3=B1ez?= Date: Fri, 22 Sep 2023 18:41:31 +0200 Subject: [PATCH] test requirements --- src/vse_sync_pp/requirements.py | 6 ++--- tests/vse_sync_pp/test_requirements.py | 37 ++++++++++++++++++++------ 2 files changed, 32 insertions(+), 11 deletions(-) diff --git a/src/vse_sync_pp/requirements.py b/src/vse_sync_pp/requirements.py index 0b0ecb0..3c3f693 100644 --- a/src/vse_sync_pp/requirements.py +++ b/src/vse_sync_pp/requirements.py @@ -6,11 +6,11 @@ 'G.8272/PRTC-A': { 'maximum-time-interval-error-in-locked-mode/us': { (None, 273): lambda t: 0.000275 * t + 0.025, - (273, None): lambda t: 0.10 + (274, None): lambda t: 0.10 }, 'time-deviation-in-locked-mode/ns': { (None, 100): lambda t: 3, - (100, 1000): lambda t: 0.03 * t, + (101, 1000): lambda t: 0.03 * t, (1001, 10000): lambda t: 30 }, 'time-error-in-locked-mode/ns': 100, @@ -22,7 +22,7 @@ }, 'time-deviation-in-locked-mode/ns': { (None, 100): lambda t: 1, - (100, 500): lambda t: 0.01 * t, + (101, 500): lambda t: 0.01 * t, (501, 100000): lambda t: 5 }, 'time-error-in-locked-mode/ns': 40, diff --git a/tests/vse_sync_pp/test_requirements.py b/tests/vse_sync_pp/test_requirements.py index 0153d35..d12640b 100644 --- a/tests/vse_sync_pp/test_requirements.py +++ b/tests/vse_sync_pp/test_requirements.py @@ -13,18 +13,39 @@ class TestRequirements(TestCase): """Test cases for vse_sync_pp.requirements.REQUIREMENTS""" def test_g8272_prtc_a(self): """Test G.8272/PRTC-A requirement values""" - self.assertEqual( - REQUIREMENTS['G.8272/PRTC-A'], - { - 'time-error-in-locked-mode/ns': 100, - }, - ) + + self.assertEqual(REQUIREMENTS['G.8272/PRTC-A']['time-error-in-locked-mode/ns'], 100) + + (a, f1), (c, f2) = REQUIREMENTS['G.8272/PRTC-A']['maximum-time-interval-error-in-locked-mode/us'].items() + + self.assertEqual(f1(100), 0.052500000000000005) + self.assertEqual(f2(300), 0.10) + + (a, f1), (c, f2), (e, f3) = REQUIREMENTS['G.8272/PRTC-A']['time-deviation-in-locked-mode/ns'].items() + self.assertEqual(f1(100), 3) + self.assertEqual(f2(150), 4.5) + self.assertEqual(f3(550), 30) def test_g8272_prtc_b(self): """Test G.8272/PRTC-B requirement values""" + + self.assertEqual(REQUIREMENTS['G.8272/PRTC-B']['time-error-in-locked-mode/ns'], 40) + + (a, f1), (c, f2) = REQUIREMENTS['G.8272/PRTC-B']['maximum-time-interval-error-in-locked-mode/us'].items() + + self.assertEqual(f1(100), 0.052500000000000005) + self.assertEqual(f2(300), 0.04) + + (a, f1), (c, f2), (e, f3) = REQUIREMENTS['G.8272/PRTC-B']['time-deviation-in-locked-mode/ns'].items() + self.assertEqual(f1(100), 1) + self.assertEqual(f2(150), 1.5) + self.assertEqual(f3(550), 5) + + def test_workload_RAN(self): + """Test workload/RAN requirement values""" self.assertEqual( - REQUIREMENTS['G.8272/PRTC-B'], + REQUIREMENTS['workload/RAN'], { - 'time-error-in-locked-mode/ns': 40, + 'time-error-in-locked-mode/ns': 100, }, )