-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathtest.py
53 lines (40 loc) · 1.5 KB
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from lorawan_toa_cal import get_toa
import unittest
class TestUM(unittest.TestCase):
def setUp(self):
pass
def test_11(self):
toa = get_toa(32, 12)["t_packet"]
self.assertEqual( toa, 1810.432 )
def test_12(self):
toa = get_toa(32, 11)["t_packet"]
self.assertEqual( toa, 987.136 )
def test_13(self):
toa = get_toa(32, 12, n_bw=250)["t_packet"]
self.assertEqual( toa, 905.216 )
def test_14(self):
toa = get_toa(32, 12, n_bw=125, enable_auto_ldro=False, enable_ldro=True)["t_packet"]
self.assertEqual( toa, 1810.432 )
def test_21(self):
toa = get_toa(64, 12, enable_eh=False)["t_packet"]
self.assertEqual( toa, 2793.472 )
def test_22(self):
toa = get_toa(64, 12, enable_crc=False)["t_packet"]
self.assertEqual( toa, 2793.472 )
def test_31(self):
toa = get_toa(12, 7)["t_packet"]
self.assertEqual( toa, 41.216 )
def test_41(self):
toa = get_toa(12, 7, n_bw=500, enable_eh=False, enable_crc=False,
n_cr=4, n_preamble=6)["t_packet"]
self.assertEqual( toa, 10.816 )
def test_99(self):
toa = get_toa(8, 12, n_bw=500,
enable_auto_ldro=False, enable_ldro=False,
enable_eh=False, enable_crc=True,
n_cr=1, n_preamble=6)["t_packet"]
self.assertEqual( toa, 190.464 )
if __name__ == '__main__':
unittest.main()