InterSigCorr_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 //
28 // This software was developed by Applied Research Laboratories at the
29 // University of Texas at Austin, under contract to an agency or agencies
30 // within the U.S. Department of Defense. The U.S. Government retains all
31 // rights to use, duplicate, distribute, disclose, or release this software.
32 //
33 // Pursuant to DoD Directive 523024
34 //
35 // DISTRIBUTION STATEMENT A: This software has been approved for public
36 // release, distribution is unlimited.
37 //
38 //==============================================================================
39 #include <math.h>
40 #include "InterSigCorr.hpp"
41 #include "TestUtil.hpp"
42 
43 namespace gnsstk
44 {
45  std::ostream& operator<<(std::ostream& s, gnsstk::NavMessageType e)
46  {
47  s << StringUtils::asString(e);
48  return s;
49  }
50 }
51 
53 class TestClass : public gnsstk::InterSigCorr
54 {
55 public:
57  { refOids.insert(oid); }
59  { validOids.insert(oid); }
60  bool isRefOidsEmpty() const
61  { return refOids.empty(); }
62  bool isValidOidsEmpty() const
63  { return validOids.empty(); }
64  bool validate() const override
65  { return true; }
66  gnsstk::NavDataPtr clone() const override
67  { return std::make_shared<TestClass>(*this); }
68 };
69 
70 
72 {
73 public:
75  : oid1(gnsstk::ObservationType::Unknown,
77  gnsstk::TrackingCode::CA),
78  oid2(gnsstk::ObservationType::Unknown,
80  gnsstk::TrackingCode::Y)
81  {}
83  unsigned constructorTest();
85  unsigned getISCSFTest();
87  unsigned getISCDFTest();
88 
90 };
91 
92 
93 unsigned InterSigCorr_T ::
95 {
96  TUDEF("InterSigCorr", "InterSigCorr");
97  TestClass uut;
99  uut.signal.messageType);
100  TUASSERTE(int, 1, isnan(uut.isc));
101  TUASSERTE(bool, true, uut.isRefOidsEmpty());
102  TUASSERTE(bool, true, uut.isValidOidsEmpty());
103  TURETURN();
104 }
105 
106 
107 unsigned InterSigCorr_T ::
109 {
110  TUDEF("InterSigCorr", "getISC(single-frequency)");
111  TestClass uut;
112  // isc should be nan, and refOids should be empty
113  double corr = 0.123456;
114  double expCorr1 = 0.123456;
115  double expCorr2 = 6.519258E-09;
116  double expCorr3 = 1.0736855745e-08;
117  TUASSERTE(bool, false, uut.getISC(oid1, corr));
118  TUASSERTFE(expCorr1, corr); // corr should not change.
119  // set isc, refOids should still be empty causing false return
120  uut.isc = -6.519258E-09;
121  TUASSERTE(bool, false, uut.getISC(oid1, corr));
122  TUASSERTFE(expCorr1, corr); // corr should not change.
123  // add something to refOids, now we should get something
124  uut.addRefOID(oid1);
125  TUASSERTE(bool, true, uut.getISC(oid1, corr));
126  TUASSERTFE(expCorr2, corr);
127  // Attempt to get ISC for a different band/code, which should fail
128  corr = expCorr1;
129  TUASSERTE(bool, false, uut.getISC(oid2, corr));
130  TUASSERTFE(expCorr1, corr);
131  // Try again after adding the secondary code to validOids
132  uut.addValidOID(oid2);
133  TUASSERTE(bool, true, uut.getISC(oid2, corr));
134  TUASSERTFE(expCorr3, corr);
135  TURETURN();
136 }
137 
138 
139 unsigned InterSigCorr_T ::
141 {
142  TUDEF("InterSigCorr", "getISC(dual-frequency)");
143  TestClass uut;
144  double corr = 0.123456;
145  // dual frequency getISC should always return 0 for this class
146  TUASSERTE(bool, true, uut.getISC(oid1, oid2, corr));
147  TUASSERTFE(0, corr);
148  corr = 0.123456;
149  TUASSERTE(bool, true, uut.getISC(oid2, oid1, corr));
150  TUASSERTFE(0, corr);
151  TURETURN();
152 }
153 
154 
155 int main()
156 {
157  InterSigCorr_T testClass;
158  unsigned errorTotal = 0;
159 
160  errorTotal += testClass.constructorTest();
161  errorTotal += testClass.getISCSFTest();
162  errorTotal += testClass.getISCDFTest();
163 
164  std::cout << "Total Failures for " << __FILE__ << ": " << errorTotal
165  << std::endl;
166 
167  return errorTotal;
168 }
gnsstk::NavDataPtr
std::shared_ptr< NavData > NavDataPtr
Factories instantiate these in response to find() requests.
Definition: NavData.hpp:62
gnsstk::NavMessageType::ISC
@ ISC
Inter-signal corrections.
InterSigCorr_T::oid1
gnsstk::ObsID oid1
Definition: InterSigCorr_T.cpp:89
L1
gnsstk::Matrix< double > L1
Definition: Matrix_LUDecomp_T.cpp:46
InterSigCorr_T::oid2
gnsstk::ObsID oid2
Definition: InterSigCorr_T.cpp:89
TUASSERTE
#define TUASSERTE(TYPE, EXP, GOT)
Definition: TestUtil.hpp:81
gnsstk::CarrierBand
CarrierBand
Definition: CarrierBand.hpp:54
example5.oid
oid
Definition: example5.py:29
gnsstk::StringUtils::asString
std::string asString(IonexStoreStrategy e)
Convert a IonexStoreStrategy to a whitespace-free string name.
Definition: IonexStoreStrategy.cpp:46
TestClass::clone
gnsstk::NavDataPtr clone() const override
Definition: InterSigCorr_T.cpp:66
main
int main()
Definition: InterSigCorr_T.cpp:155
gnsstk
For Sinex::InputHistory.
Definition: BasicFramework.cpp:50
TestClass::validate
bool validate() const override
Definition: InterSigCorr_T.cpp:64
TestClass::isRefOidsEmpty
bool isRefOidsEmpty() const
Definition: InterSigCorr_T.cpp:60
TestUtil.hpp
TURETURN
#define TURETURN()
Definition: TestUtil.hpp:232
TestClass::addValidOID
void addValidOID(const gnsstk::ObsID &oid)
Definition: InterSigCorr_T.cpp:58
gnsstk::ObsID
Definition: ObsID.hpp:82
TestClass::isValidOidsEmpty
bool isValidOidsEmpty() const
Definition: InterSigCorr_T.cpp:62
InterSigCorr_T::getISCSFTest
unsigned getISCSFTest()
Single frequency ISC test.
Definition: InterSigCorr_T.cpp:108
gnsstk::operator<<
std::ostream & operator<<(std::ostream &s, const ObsEpoch &oe) noexcept
Definition: ObsEpochMap.cpp:54
TUDEF
#define TUDEF(CLASS, METHOD)
Definition: TestUtil.hpp:56
InterSigCorr_T
Definition: InterSigCorr_T.cpp:71
TestClass::addRefOID
void addRefOID(const gnsstk::ObsID &oid)
Definition: InterSigCorr_T.cpp:56
gnsstk::InterSigCorr
Definition: InterSigCorr.hpp:106
InterSigCorr_T::InterSigCorr_T
InterSigCorr_T()
Definition: InterSigCorr_T.cpp:74
InterSigCorr_T::constructorTest
unsigned constructorTest()
Make sure constructor initializes data members correctly.
Definition: InterSigCorr_T.cpp:94
gnsstk::TrackingCode
TrackingCode
Definition: TrackingCode.hpp:64
gnsstk::NavMessageType
NavMessageType
Identify different types of navigation message data.
Definition: NavMessageType.hpp:59
TestClass
Make GroupPathCorrector instantiatable for testing.
Definition: GroupPathCorrector_T.cpp:56
TUASSERTFE
#define TUASSERTFE(EXP, GOT)
Definition: TestUtil.hpp:103
InterSigCorr.hpp
L2
gnsstk::Matrix< double > L2
Definition: Matrix_LUDecomp_T.cpp:46
InterSigCorr_T::getISCDFTest
unsigned getISCDFTest()
Dual frequency ISC test.
Definition: InterSigCorr_T.cpp:140
gnsstk::ObservationType
ObservationType
The type of observation, mostly used by ObsID.
Definition: ObservationType.hpp:55


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