Convhelp_T.cpp
Go to the documentation of this file.
1 //==============================================================================
2 //
3 // This file is part of GNSSTk, the ARL:UT GNSS Toolkit.
4 //
5 // The GNSSTk is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU Lesser General Public License as published
7 // by the Free Software Foundation; either version 3.0 of the License, or
8 // any later version.
9 //
10 // The GNSSTk is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public
16 // License along with GNSSTk; if not, write to the Free Software Foundation,
17 // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
18 //
19 // This software was developed by Applied Research Laboratories at the
20 // University of Texas at Austin.
21 // Copyright 2004-2022, The Board of Regents of The University of Texas System
22 //
23 //==============================================================================
24 
25 //==============================================================================
26 //
27 // This software was developed by Applied Research Laboratories at the
28 // University of Texas at Austin, under contract to an agency or agencies
29 // within the U.S. Department of Defense. The U.S. Government retains all
30 // rights to use, duplicate, distribute, disclose, or release this software.
31 //
32 // Pursuant to DoD Directive 523024
33 //
34 // DISTRIBUTION STATEMENT A: This software has been approved for public
35 // release, distribution is unlimited.
36 //
37 //==============================================================================
38 
39 #include <iostream>
40 #include <cmath>
41 
42 #include "convhelp.hpp"
43 #include "GPSEllipsoid.hpp"
44 
45 #include "TestUtil.hpp"
46 
47 int main()
48 {
49  TUDEF("convhelp", "");
50  double eps = 1e-12;
51 
54 
55  testFramework.changeSourceMethod("WGS84Ellipsoid cycles2meters");
56  TUASSERTFEPS(gnsstk::cycles2meters(100000., 400000.,wem), 74948114.5, eps);
57  TUASSERTFEPS(gnsstk::cycles2meters(0,5,wem), 0, eps);
58  TUASSERTFEPS(gnsstk::cycles2meters(-100000.,400000.,wem), -74948114.5, eps);
59 
60  testFramework.changeSourceMethod("GPSEllipsoid cycles2meters");
61  TUASSERTFEPS(gnsstk::cycles2meters(100000.,400000.,gem), 74948114.5, eps);
62  TUASSERTFEPS(gnsstk::cycles2meters(0,5,gem), 0, eps);
63  TUASSERTFEPS(gnsstk::cycles2meters(-100000.,400000.,gem), -74948114.5, eps);
64 
65  testFramework.changeSourceMethod("WGS84Ellipsoid meters2cycles");
66  TUASSERTFEPS(gnsstk::meters2cycles(74948114.5,400000.,wem), 100000, eps);
67  TUASSERTFEPS(gnsstk::meters2cycles(0,5,wem), 0, eps);
68  TUASSERTFEPS(gnsstk::meters2cycles(-74948114.5,400000.,wem), -100000, eps);
69 
70  testFramework.changeSourceMethod("GPSEllipsoid meters2cycles");
71  TUASSERTFEPS(gnsstk::meters2cycles(74948114.5,400000.,gem), 100000, eps);
72  TUASSERTFEPS(gnsstk::meters2cycles(0,5,gem), 0, eps);
73  TUASSERTFEPS(gnsstk::meters2cycles(-74948114.5,400000.,gem), -100000, eps);
74 
75  testFramework.changeSourceMethod("cel2far");
76  TUASSERTFEPS(gnsstk::cel2far(100), 212, eps);
77  TUASSERTFEPS(gnsstk::cel2far(0), 32, eps);
78  TUASSERTFEPS(gnsstk::cel2far(-100), -148, eps);
79 
80  testFramework.changeSourceMethod("far2cel");
81  TUASSERTFEPS(gnsstk::far2cel(212), 100, eps);
82  TUASSERTFEPS(gnsstk::far2cel(32), 0, eps);
83  TUASSERTFEPS(gnsstk::far2cel(-148), -100, eps);
84 
85  testFramework.changeSourceMethod("mb2hg");
86  TUASSERTFEPS(gnsstk::mb2hg(100), 2.9529987508079487, eps);
87  TUASSERTFEPS(gnsstk::mb2hg(0), 0, eps);
88  TUASSERTFEPS(gnsstk::mb2hg(-100), -2.9529987508079487, eps);
89 
90  testFramework.changeSourceMethod("hg2mb");
91  TUASSERTFEPS(gnsstk::hg2mb(2.9529987508079487), 100, eps);
92  TUASSERTFEPS(gnsstk::hg2mb(0), 0, eps);
93  TUASSERTFEPS(gnsstk::hg2mb(-2.9529987508079487), -100, eps);
94 
95  std::cout << "Total Failures for " << __FILE__ << ": " << testFramework.countFails() << std::endl;
96 
97  return testFramework.countFails();
98 }
gnsstk::far2cel
double far2cel(double f)
Definition: convhelp.hpp:97
gnsstk::hg2mb
double hg2mb(double hg)
Definition: convhelp.hpp:119
gnsstk::mb2hg
double mb2hg(double mb)
Definition: convhelp.hpp:108
gnsstk::GPSEllipsoid
Definition: GPSEllipsoid.hpp:67
gnsstk::WGS84Ellipsoid
Definition: WGS84Ellipsoid.hpp:56
TestUtil.hpp
gnsstk::meters2cycles
double meters2cycles(double range, double freq, EllipsoidModel &ellipsoid)
Definition: convhelp.hpp:75
TUASSERTFEPS
#define TUASSERTFEPS(EXP, GOT, EPS)
Definition: TestUtil.hpp:126
TUDEF
#define TUDEF(CLASS, METHOD)
Definition: TestUtil.hpp:56
GPSEllipsoid.hpp
gnsstk::cycles2meters
double cycles2meters(double phase, double freq, EllipsoidModel &ellipsoid)
Definition: convhelp.hpp:62
convhelp.hpp
main
int main()
Definition: Convhelp_T.cpp:47
gnsstk::cel2far
double cel2far(double c)
Definition: convhelp.hpp:86


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