1#!/usr/bin/env python
2
3import unittest, sys, os
4sys.path.insert(0, os.path.abspath(".."))
5from gpstk.test_utils import args,run_unit_tests
6import gpstk
7
8class EnumConversion_test(unittest.TestCase):
9    """
10    Overkill?  Maybe... but it does catch swig errors related to Enumeration passing.
11    """
12
13    def test_SatelliteSystem(self):
14        with self.assertRaises(TypeError):
15            _ = gpstk.SatelliteSystem()
16            self.fail("No default constructor")
17        self.assertEqual(gpstk.SatelliteSystem(2), gpstk.SatelliteSystem.Galileo, msg='int Galileo')
18        self.assertEqual(gpstk.SatelliteSystem(1), gpstk.SatelliteSystem.GPS, msg='int GPS')
19        self.assertEqual(gpstk.SatelliteSystem(gpstk.SatelliteSystem.GPS), gpstk.SatelliteSystem.GPS, msg='gpstk enum GPS')
20        self.assertEqual(gpstk.SatelliteSystem(gpstk.SatelliteSystem.Galileo), gpstk.SatelliteSystem.Galileo, msg='gpstk enum Galileo')
21        self.assertEqual(gpstk.asSatelliteSystem('GPS'), gpstk.SatelliteSystem.GPS, msg='str GPS')
22        self.assertEqual(gpstk.asSatelliteSystem('Galileo'), gpstk.SatelliteSystem.Galileo, msg='str Galileo')
23        # TODO: Odd that enum -> str -> enum doesn't work.
24        #self.assertEqual(gpstk.asSatelliteSystem(str(gpstk.SatelliteSystem.Glonass)), gpstk.SatelliteSystem.Glonass, msg='str enum Glonass')
25
26    def test_CarrierBand(self):
27        with self.assertRaises(TypeError):
28            _ = gpstk.CarrierBand()
29            self.fail("No default constructor")
30        self.assertEqual(gpstk.CarrierBand(4), gpstk.CarrierBand.L2, msg='int L2')
31        self.assertEqual(gpstk.CarrierBand(2), gpstk.CarrierBand.L1L2, msg='int L1L2')
32        self.assertEqual(gpstk.CarrierBand(gpstk.CarrierBand.L2), gpstk.CarrierBand.L2, msg='gpstk enum GPS')
33        self.assertEqual(gpstk.CarrierBand(gpstk.CarrierBand.L1L2), gpstk.CarrierBand.L1L2, msg='gpstk enum L1L2')
34        self.assertEqual(gpstk.asCarrierBand('L2'), gpstk.CarrierBand.L2, msg='str GPS')
35        # TODO: Odd that enum -> str -> enum doesn't work.
36        #self.assertEqual(gpstk.asCarrierBand(str(gpstk.CarrierBand.L1L2)), gpstk.CarrierBand.L1L2, msg='str enum str L1L2')
37
38    def test_TrackingCode(self):
39        with self.assertRaises(TypeError):
40            _ = gpstk.TrackingCode()
41            self.fail("No default constructor")
42        self.assertEqual(gpstk.TrackingCode(4), gpstk.TrackingCode.Y, msg='int Y')
43        self.assertEqual(gpstk.TrackingCode(2), gpstk.TrackingCode.CA, msg='int CA')
44        self.assertEqual(gpstk.TrackingCode(gpstk.TrackingCode.Y), gpstk.TrackingCode.Y, msg='gpstk enum Y')
45        self.assertEqual(gpstk.TrackingCode(gpstk.TrackingCode.CA), gpstk.TrackingCode.CA, msg='gpstk enum CA')
46        self.assertEqual(gpstk.asTrackingCode('Y'), gpstk.TrackingCode.Y, msg='str Y')
47        self.assertEqual(gpstk.asTrackingCode('CA'), gpstk.TrackingCode.CA, msg='str CA')
48        # TODO: Odd that enum -> str -> enum doesn't work.
49        #self.assertEqual(gpstk.asTrackingCode(str(gpstk.TrackingCode.CA)), gpstk.TrackingCode.CA, msg='str enum str CA')
50
51    def test_ObservationType(self):
52        with self.assertRaises(TypeError):
53            _ = gpstk.ObservationType()
54            self.fail("No default constructor")
55        self.assertEqual(gpstk.ObservationType(4), gpstk.ObservationType.Doppler, msg='int Doppler')
56        self.assertEqual(gpstk.ObservationType(2), gpstk.ObservationType.Range, msg='int Range')
57        self.assertEqual(gpstk.ObservationType(gpstk.ObservationType.Range), gpstk.ObservationType.Range, msg='gpstk enum Range')
58        self.assertEqual(gpstk.ObservationType(gpstk.ObservationType.Doppler), gpstk.ObservationType.Doppler, msg='gpstk enum Doppler')
59        self.assertEqual(gpstk.asObservationType('Range'), gpstk.ObservationType.Range, msg='str Range')
60        self.assertEqual(gpstk.asObservationType('Doppler'), gpstk.ObservationType.Doppler, msg='str Doppler')
61        # TODO: Odd that enum -> str -> enum doesn't work.
62        #self.assertEqual(gpstk.asObservationType(str(gpstk.ObservationType.Range)), gpstk.ObservationType.Range, msg='str enum str Range')
63
64    def test_NavType(self):
65        with self.assertRaises(TypeError):
66            _ = gpstk.NavType()
67            self.fail("No default constructor")
68        self.assertEqual(gpstk.NavType(4), gpstk.NavType.GPSMNAV, msg='int GPSMNAV')
69        self.assertEqual(gpstk.NavType(2), gpstk.NavType.GPSCNAVL5, msg='int GPS')
70        self.assertEqual(gpstk.NavType(gpstk.NavType.GPSCNAVL5), gpstk.NavType.GPSCNAVL5, msg='gpstk enum GPSCNAVL5')
71        self.assertEqual(gpstk.NavType(gpstk.NavType.GPSMNAV), gpstk.NavType.GPSMNAV, msg='gpstk enum GPSMNAV')
72
73        self.assertEqual(gpstk.asNavType('GPS_CNAV_L5'), gpstk.NavType.GPSCNAVL5, msg='str GPSCNAVL5')
74        self.assertEqual(gpstk.asNavType('GPS_MNAV'), gpstk.NavType.GPSMNAV, msg='str GPSMNAV')
75        # TODO: Odd that enum -> str -> enum doesn't work.
76        #self.assertEqual(gpstk.asNavType(str(gpstk.NavType.GPSCNAVL5)), gpstk.NavType.GPSCNAVL5, msg='str enum str GPSCNAVL5')
77
78    def test_TimeSystem(self):
79        with self.assertRaises(TypeError):
80            _ = gpstk.TimeSystem()
81            self.fail("No default constructor")
82        self.assertEqual(gpstk.TimeSystem(4), gpstk.TimeSystem.GAL, msg='int GAL')
83        self.assertEqual(gpstk.TimeSystem(2), gpstk.TimeSystem.GPS, msg='int GPS')
84        self.assertEqual(gpstk.TimeSystem(gpstk.TimeSystem.GPS), gpstk.TimeSystem.GPS, msg='gpstk enum GPS')
85        self.assertEqual(gpstk.TimeSystem(gpstk.TimeSystem.GAL), gpstk.TimeSystem.GAL, msg='gpstk enum GAL')
86        self.assertEqual(gpstk.asTimeSystem('GPS'), gpstk.TimeSystem.GPS, msg='str GPS')
87        self.assertEqual(gpstk.asTimeSystem('GAL'), gpstk.TimeSystem.GAL, msg='str GAL')
88        # TODO: Odd that enum -> str -> enum doesn't work.
89        #self.assertEqual(gpstk.asTimeSystem(str(gpstk.TimeSystem.GPS)), gpstk.TimeSystem.GPS, msg='str GPS')
90
91    def test_ReferenceFrame(self):
92        with self.assertRaises(TypeError):
93            _ = gpstk.ReferenceFrame()
94            self.fail("No default constructor")
95        self.assertEqual(gpstk.ReferenceFrame(4), gpstk.ReferenceFrame.WGS84G1150, msg='int WGS84G1150')
96        self.assertEqual(gpstk.ReferenceFrame(2), gpstk.ReferenceFrame.WGS84G730, msg='int WGS84G730')
97        self.assertEqual(gpstk.ReferenceFrame(gpstk.ReferenceFrame.WGS84G1150), gpstk.ReferenceFrame.WGS84G1150, msg='gpstk enum WGS84G1150')
98        self.assertEqual(gpstk.ReferenceFrame(gpstk.ReferenceFrame.WGS84G730), gpstk.ReferenceFrame.WGS84G730, msg='gpstk enum WGS84G730')
99        self.assertEqual(gpstk.asReferenceFrame('WGS84(G1150)'), gpstk.ReferenceFrame.WGS84G1150, msg='str WGS84G1150')
100        self.assertEqual(gpstk.asReferenceFrame('WGS84(G730)'), gpstk.ReferenceFrame.WGS84G730, msg='str WGS84G730')
101        # TODO: Odd that enum -> str -> enum doesn't work.
102        #self.assertEqual(gpstk.asReferenceFrame(str(gpstk.ReferenceFrame.WGS84G730)), gpstk.ReferenceFrame.WGS84G730, msg='str WGS84G730')
103
104class SatID_test(unittest.TestCase):
105    def test_validity(self):
106        s = gpstk.SatID(1, gpstk.SatelliteSystem.GPS)
107        self.assertTrue(s.isValid())
108
109    def test_invalid(self):
110        s = gpstk.SatID()  # creates an invalid SatID (id=-1)
111        self.assertFalse(s.isValid())
112
113    def test_str(self):
114        a = gpstk.SatID(3, gpstk.SatelliteSystem.Glonass)
115        self.assertEqual('GLONASS 3', str(a))
116
117        b = gpstk.SatID(1, gpstk.SatelliteSystem.LEO)
118        self.assertEqual('LEO 1', str(b))
119
120        c = gpstk.SatID(4)  # optional arg should be SatelliteSystem.GPS
121        self.assertEqual('GPS 4', str(c))
122
123
124class Triple_test(unittest.TestCase):
125    def test_copy_constructor(self):
126        t = gpstk.Triple(1.0, 2.0, 3.0)
127        u = gpstk.Triple(t)
128        v = gpstk.Triple(1.0, 2.0, 3.0)
129        self.assertTrue(t == u)
130        self.assertTrue(u == v)
131
132    def test_access(self):
133        t = gpstk.Triple(1.5, 2.0, -3.0)
134        self.assertEqual(1.5, t[0])
135        self.assertEqual(2.0, t[1])
136        self.assertEqual(-3.0, t[2])
137
138    def test_operators(self):
139        a = gpstk.Triple(1.0, 2.0, 4.0)
140        b = gpstk.Triple(5.0, 6.0, 5.0)
141        #      +   --------------
142        c = gpstk.Triple(6.0, 8.0, 9.0)
143        self.assertEqual(c, a + b)
144
145    def test_methods(self):
146        t = gpstk.Triple(1.5, 2.0, -3.0)
147        u = gpstk.Triple(10.0, 5.0, 2.0)
148        self.assertEqual(15.25, t.dot(t))
149
150        expected = gpstk.Triple(4.0, 6.0, 8.0)
151        self.assertEqual(expected, gpstk.Triple(2.0, 3.0, 4.0).scale(2.0))
152
153        self.assertAlmostEqual(3.905124837953327, t.mag())
154        self.assertAlmostEqual(5.345455469884399, t.elvAngle(u))
155        self.assertAlmostEqual(0.42837471052408865, t.cosVector(u))
156
157
158class Position_test(unittest.TestCase):
159    def test(self):
160        p1 = gpstk.Position(1.5, 6.2, 3.5)   # constructor with 3 floats
161        p2 = gpstk.Position([1.0, 1.8, 0.5]) # constructor with a list-like of 3 floats
162        self.assertAlmostEqual(5.348831648126533, gpstk.range(p1, p2))
163
164    def test_spherical_cartesian(self):
165        orig = gpstk.Triple(45.0, 30.0, 12.0)
166        p = gpstk.Position.convertSphericalToCartesian(orig)
167        q = gpstk.Position.convertCartesianToSpherical(p)
168        self.assertAlmostEqual(45.0, q[0], places=4)
169        self.assertAlmostEqual(30.0, q[1], places=4)
170        self.assertAlmostEqual(12.0, q[2], places=4)
171
172    def test_cartesian_geodetic(self):
173        a = gpstk.PZ90Ellipsoid().a()
174        eccSq = gpstk.PZ90Ellipsoid().eccSquared()
175        orig = gpstk.Position(100000.0, 20000.0, 30000.0)
176        p = gpstk.Position.convertCartesianToGeodetic(orig, a, eccSq)
177        q = gpstk.Position.convertGeodeticToCartesian(p, a, eccSq)
178        self.assertAlmostEqual(25.33498527029081, p[0], places=4)
179        self.assertAlmostEqual(11.30993247402015, p[1], places=4)
180        self.assertAlmostEqual(-6269217.08416736, p[2], places=4)
181        self.assertAlmostEqual(99999.26269737557, q[0], places=4)
182        self.assertAlmostEqual(19999.85253947465, q[1], places=4)
183        self.assertAlmostEqual(29999.83821484564, q[2], places=4)
184
185    def test_geocentric_geodetic(self):
186        a = gpstk.PZ90Ellipsoid().a()
187        eccSq = gpstk.PZ90Ellipsoid().eccSquared()
188        orig = gpstk.Position(40.0, 100.0, 2.5e5, gpstk.Position.Geocentric)
189        p = gpstk.Position.convertGeocentricToGeodetic(orig, a, eccSq)
190        q = gpstk.Position.convertGeodeticToGeocentric(p, a, eccSq)
191        self.assertAlmostEqual(44.90696703221949, p[0], places=4)
192        self.assertAlmostEqual(100.0, p[1], places=4)
193        self.assertAlmostEqual(-6118405.153409380, p[2], places=4)
194        self.assertAlmostEqual(40.00000265961031, q[0], places=4)
195        self.assertAlmostEqual(100.0, q[1], places=4)
196        self.assertAlmostEqual(249998.49546297366, q[2], places=4)
197
198    def test_cartesian_geocentric(self):
199        orig = gpstk.Triple(4000.0, 5000.0, 7000.0)
200        p = gpstk.Position.convertCartesianToGeocentric(orig)
201        q = gpstk.Position.convertGeocentricToCartesian(p)
202        self.assertAlmostEqual(47.54984445710891, p[0], places=4)
203        self.assertAlmostEqual(51.34019174590962, p[1], places=4)
204        self.assertAlmostEqual(9486.832980505136, p[2], places=4)
205        self.assertAlmostEqual(orig[0], q[0], places=4)
206        self.assertAlmostEqual(orig[1], q[1], places=4)
207        self.assertAlmostEqual(orig[2], q[2], places=4)
208
209    def test_functions(self):
210        system = gpstk.Position.Cartesian
211        ell = gpstk.PZ90Ellipsoid()
212        frame = gpstk.ReferenceFrame.PZ90
213        p = gpstk.Position(10000.0, 150000.0, 200000.0, system, ell, frame)
214        q = gpstk.Position(20000.0, 160000.0, 190000.0, system, ell, frame)
215        self.assertAlmostEqual(1.32756277187, q.elevation(p))
216        self.assertAlmostEqual(86.18592516570916, p.getPhi())
217        self.assertAlmostEqual(57.5141089193572, p.geodeticLatitude())
218        self.assertAlmostEqual(10000.0, p.X())
219
220    def test_helpers(self):
221        p = gpstk.cartesian(100, 200, 300)
222        self.assertEqual(gpstk.Position.Cartesian, p.getCoordinateSystem())
223        p = gpstk.spherical(45, 60, 100000, model=gpstk.PZ90Ellipsoid())
224        self.assertEqual(gpstk.Position.Spherical, p.getCoordinateSystem())
225        p = gpstk.geodetic(frame=gpstk.ReferenceFrame.WGS84)
226        self.assertEqual(gpstk.Position.Geodetic, p.getCoordinateSystem())
227        p = gpstk.geocentric(latitude=60, radius=10000)
228        self.assertEqual(gpstk.Position.Geocentric, p.getCoordinateSystem())
229
230
231class GPS_URA_test(unittest.TestCase):
232    def test(self):
233        self.assertEqual(15, gpstk.SV_ACCURACY_GPS_MAX_INDEX_VALUE)
234        self.assertEqual(9, gpstk.accuracy2ura(100.1))
235        self.assertEqual(0.0, gpstk.sv_accuracy_gps_min_index(0))
236        self.assertEqual(2.4, gpstk.sv_accuracy_gps_min_index(1))
237        self.assertRaises(gpstk.IndexOutOfBoundsException, gpstk.sv_accuracy_gps_min_index, 16)
238
239
240class ObsID_test(unittest.TestCase):
241    def test(self):
242        o1 = gpstk.ObsID(gpstk.ObservationType.Range, gpstk.CarrierBand.Any, gpstk.TrackingCode.E1A)
243        self.assertEqual('AnyBand GALA pseudorange', str(o1))
244
245
246class std_template_test(unittest.TestCase):
247    def test_vector(self):
248        v = gpstk.vector_int()
249        v.push_back(5)
250        v.push_back(3)
251        v.push_back(10)
252        self.assertEqual(5, v[0])
253        self.assertEqual(3, v[1])
254        self.assertEqual(10, v[2])
255        v = gpstk.vector_double()
256        v.push_back(1.5)
257        v.push_back(2.5)
258        self.assertEqual(1.5, v[0])
259        self.assertEqual(2.5, v[1])
260        self.assertEqual(2, len(v))
261
262    def test_vector_iter(self):
263        v = gpstk.vector_int()
264        v.push_back(5)
265        v.push_back(3)
266        v.push_back(10)
267        i = 0
268        for x in v:
269            self.assertEqual(v[i], x)
270            i += 1
271
272    def test_vector_conversions(self):
273        def same_seq(seq1, seq2):
274            self.assertEqual(len(seq1), len(seq2))
275            for i in range(len(seq1)):
276                self.assertEqual(seq1[i], seq2[i])
277
278        list = [1.1, 2.2, 3.3]
279        v = gpstk.seqToVector(list)
280        self.assertIsInstance(v, gpstk.vector_double)
281        same_seq(list, v)
282
283        list = [1.1, 2.2, 3.3]
284        v = gpstk.seqToVector(list, outtype='vector_double')
285        self.assertIsInstance(v, gpstk.vector_double)
286        same_seq(list, v)
287
288        list = ['bar!', 'foo?']
289        v = gpstk.seqToVector(list)
290        self.assertIsInstance(v, gpstk.vector_string)
291        same_seq(list, v)
292
293        v = gpstk.vector_int()
294        v.push_back(3)
295        v.push_back(5)
296        list = gpstk.vectorToSeq(v)
297        same_seq(list, v)
298
299        list = [1.1, 2.2, 3.3]
300        self.assertRaises(TypeError, gpstk.seqToVector, list, 'vector_doesnotexist')
301
302        list = [1, 2.2, 'c']  # mismatching types not allowed
303        self.assertRaises(TypeError, gpstk.seqToVector, list)
304
305    def test_map(self):
306        map = gpstk.map_int_char()
307        map[1] = 'A'
308        map[100] = 'z'
309        self.assertEqual('A', map[1])
310        self.assertEqual('z', map[100])
311        map = gpstk.map_string_int()
312        map['key1'] = 123
313        map['key2'] = 321
314        self.assertEqual(123, map['key1'])
315        self.assertEqual(321, map['key2'])
316
317    def test_map_iter(self):
318        map = gpstk.map_int_string()
319        map[5] = 'five'
320        map[6] = 'six'
321        list = []
322        for key in map:
323            list.append(key)
324        self.assertEqual([5,6], sorted(list))
325
326    def test_map_len(self):
327        map = gpstk.map_int_string()
328        map[5] = 'five'
329        map[6] = 'six'
330        self.assertEqual(2, len(map))
331
332    def test_map_conversions(self):
333        def same(a, b):
334            self.assertEqual(len(a), len(b))
335            for x in a:
336                self.assertEqual(a[x], b[x])
337
338        d = {1: 'A', 2: 'B', 3: 'C'}
339        m = gpstk.dictToMap(d)
340        same(d, m)
341        self.assertIsInstance(m, gpstk.map_int_string)
342        same(d, gpstk.mapToDict(m))
343
344        d = {'A': 1.1, 'B': 2.2, 'C': 3.3}
345        m = gpstk.dictToMap(d)
346        same(d, m)
347        self.assertIsInstance(m, gpstk.map_string_double)
348        same(d, gpstk.mapToDict(m))
349
350        d = {'A': 1, 'B': 1.1}
351        self.assertRaises(TypeError, gpstk.dictToMap, d)
352
353
354class convhelp_test(unittest.TestCase):
355    def test(self):
356        self.assertAlmostEqual(32.0, gpstk.cel2far(0.0))
357        self.assertAlmostEqual(0.0, gpstk.far2cel(32.0))
358        self.assertAlmostEqual(121.1, gpstk.cel2far(49.5))
359
360
361class Xvt_test(unittest.TestCase):
362    def test(self):
363        data = gpstk.Xvt()
364        data.x = gpstk.Triple(1000.0, 2000.0, 1500.0)
365        data.v = gpstk.Triple(50.0, 25.0, -500.0)
366        data.clkbias = 0.0001
367        data.clkdrift = 0.05
368        data.relcorr = 0.83
369        data.frame = gpstk.ReferenceFrame.WGS84
370        self.assertAlmostEqual(0.0001, data.getClockBias())
371
372        expected = 1.446445072869704e-11
373        self.assertAlmostEqual(expected, data.computeRelativityCorrection())
374
375        expected = ('x:(1000, 2000, 1500), v:(50, 25, -500), clk bias:0.0001, '
376                    'clk drift:0.05, relcorr:1.44645e-11')
377        self.assertEqual(expected, str(data))
378
379
380class AstronomicalFunctions_test(unittest.TestCase):
381    def test_functions(self):
382        c = gpstk.CommonTime()
383        c.addSeconds(12345678)
384        self.assertAlmostEqual(10.934294925420545, gpstk.UTC2SID(c))
385
386    def test_constants(self):
387        self.assertAlmostEqual(1.49597870e11, gpstk.AU_CONST)
388        self.assertAlmostEqual(0.0174532925199432957692369, gpstk.D2R)
389        self.assertAlmostEqual(9.80665,  gpstk.EarthGrav)
390
391
392class Positioning_test(unittest.TestCase):
393    def test_moon(self):
394        t = gpstk.CivilTime(2000).toCommonTime()
395        # object way:
396        pos = gpstk.MoonPosition().getPosition(t)
397        self.assertAlmostEqual(-89651219.03579193, pos[0])
398        # functional way:
399        pos = gpstk.moonPosition(t)
400        self.assertAlmostEqual(-89651219.03579193, pos[0])
401
402    def test_sun(self):
403        t = gpstk.CivilTime(2000).toCommonTime()
404        # object way:
405        pos = gpstk.SunPosition().getPosition(t)
406        self.assertAlmostEqual(-136909966557.8461 , pos[0], places=3)
407        # functional way:
408        pos = gpstk.sunPosition(t)
409        self.assertAlmostEqual(-136909966557.8461 , pos[0], places=3)
410
411
412class Tides_test(unittest.TestCase):
413    def test_pole_tides(self):
414        t = gpstk.CivilTime(2000).toCommonTime()
415        p = gpstk.Position(1000.0, 2000.0, 3000.0)
416        x = 5.0
417        y = 10.0
418        trip = gpstk.poleTides(t, p, x, y)
419        self.assertAlmostEqual(-0.03128457731297798, trip[0])
420
421    def test_solid_tides(self):
422        t = gpstk.CivilTime(2000).toCommonTime()
423        p = gpstk.Position(1000.0, 2000.0, 3000.0)
424        trip = gpstk.solidTides(t, p)
425        self.assertAlmostEqual(-2.2479508782610997e-15, trip[0])
426
427
428class Expression_test(unittest.TestCase):
429    def test_class(self):
430        e = gpstk.Expression('1 + 1')
431        self.assertAlmostEqual(2.0, e.evaluate())
432
433        e = gpstk.Expression('1.12*(4.0/2.0 - 0.1)')
434        self.assertAlmostEqual(2.128, e.evaluate())
435
436        e = gpstk.Expression('1 + 2*x')
437        e.set('x', 5.5)
438        self.assertAlmostEqual(12.0, e.evaluate())
439
440        e = gpstk.Expression('L1 + L2')
441        e.setGPSConstants()
442        self.assertAlmostEqual(2803020000.0, e.evaluate())
443
444    def test_function(self):
445        self.assertAlmostEqual(2.0, gpstk.eval('1 + 1'))
446        self.assertAlmostEqual(2.128, gpstk.eval('1.12*(4.0/2.0 - 0.1)'))
447        self.assertAlmostEqual(12.0, gpstk.eval('1 + 2*x', x=5.5))
448        self.assertAlmostEqual(2803020000.0, gpstk.eval('L1 + L2'))
449
450        e = gpstk.Expression('1 + 2*x')
451        self.assertAlmostEqual(12.0, gpstk.eval(e, x=5.5))
452
453
454
455if __name__ == '__main__':
456    run_unit_tests()
457