test_constants.py
Go to the documentation of this file.
1 #!/usr/env python
2 
3 import unittest, sys, os
4 sys.path.insert(0, os.path.abspath(".."))
5 from gnsstk.test_utils import args,run_unit_tests
6 import gnsstk
7 
8 
9 class TestConstants(unittest.TestCase):
10  """Tests the various constants defined in the gnsstk"""
11  def testConstants(self):
12  """Tests a subset of the gnsstk constants since there are so many.
13  Add more as we mature the testing."""
14  self.assertEqual(gnsstk.C_MPS, 299792458)
15  self.assertEqual(gnsstk.CA_CHIP_FREQ_GPS, 1023000)
16  self.assertEqual(gnsstk.L1_FREQ_GPS, 1575420000)
17  self.assertEqual(gnsstk.L2_FREQ_GPS, 1227600000)
18  self.assertAlmostEqual(gnsstk.PI, 3.14159265359, places=12)
19  self.assertEqual(gnsstk.ZCOUNT_PER_DAY, 57600)
20  with self.assertRaises(AttributeError):
21  print(gnsstk.foo.bar)
22 
23 class GPS_consants_test(unittest.TestCase):
24  def test_constants(self):
25  self.assertEqual(32, gnsstk.MAX_PRN)
26  self.assertEqual(32, gnsstk.MAX_PRN_GPS)
27 
28 
29 class Geometry_test(unittest.TestCase):
30  def test_constants(self):
31  self.assertEqual(1.7453292519943e-2, gnsstk.DEG_TO_RAD)
32  self.assertEqual(57.295779513082, gnsstk.RAD_TO_DEG)
33 
34 
35 class GNSSconstants_test(unittest.TestCase):
36  def test_constants(self):
37  self.assertEqual(gnsstk.PI, 3.141592653589793238462643383280)
38  self.assertEqual(gnsstk.OSC_FREQ_GPS, 10.23e6)
39  self.assertEqual(gnsstk.L6_FREQ_GAL, 1278.75e6)
40 
41  def test_functions(self):
42  self.assertEqual(4, gnsstk.getLegacyFitInterval(15, 27))
43  self.assertAlmostEqual(0.190293672798, gnsstk.getWavelength(gnsstk.SatelliteSystem.GPS, 1),)
44  self.assertAlmostEqual(1.2833333333333334, gnsstk.getBeta(1, 1, 2))
45  self.assertAlmostEqual(0.6469444444444448, gnsstk.getAlpha(1, 1, 2))
46 
47 if __name__ == '__main__':
tests.test_constants.GNSSconstants_test.test_constants
def test_constants(self)
Definition: test_constants.py:36
tests.test_constants.Geometry_test
Definition: test_constants.py:29
gnsstk::getWavelength
double getWavelength(SatelliteSystem sys, int rinexBandNum, int gloChan=0) noexcept
Definition: FreqConsts.hpp:191
gnsstk::getAlpha
double getAlpha(SatelliteSystem sys, int na, int nb) noexcept
Definition: FreqConsts.hpp:286
tests.test_constants.GNSSconstants_test.test_functions
def test_functions(self)
Definition: test_constants.py:41
tests.test_constants.TestConstants.testConstants
def testConstants(self)
Definition: test_constants.py:11
tests.test_constants.TestConstants
Definition: test_constants.py:9
gnsstk::getLegacyFitInterval
short getLegacyFitInterval(const short iodc, const short fiti)
Definition: GNSSconstants.hpp:111
tests.test_constants.GPS_consants_test.test_constants
def test_constants(self)
Definition: test_constants.py:24
gnsstk::getBeta
double getBeta(SatelliteSystem sys, int na, int nb) noexcept
Definition: FreqConsts.hpp:271
tests.test_constants.GPS_consants_test
Definition: test_constants.py:23
tests.test_constants.GNSSconstants_test
Definition: test_constants.py:35
tests.test_constants.Geometry_test.test_constants
def test_constants(self)
Definition: test_constants.py:30
test_utils.run_unit_tests
def run_unit_tests()
Definition: test_utils.py:51


gnsstk
Author(s):
autogenerated on Wed Oct 25 2023 02:40:41