Skip to content

Commit

Permalink
test requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
jnunyez committed Sep 22, 2023
1 parent 3e7f2e0 commit c4ca92d
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 11 deletions.
6 changes: 3 additions & 3 deletions src/vse_sync_pp/requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
37 changes: 29 additions & 8 deletions tests/vse_sync_pp/test_requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
)

0 comments on commit c4ca92d

Please sign in to comment.