CorrectionResults_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 "TestUtil.hpp"
40 #include "CorrectionResults.hpp"
41 
44 {
45 public:
47  { corrType = ct; }
48  bool getCorr(const gnsstk::Position& rxPos, const gnsstk::Position& svPos,
49  const gnsstk::SatID& sat, const gnsstk::ObsID& obs,
50  const gnsstk::CommonTime& when, gnsstk::NavType nav,
51  double& corrOut) override
52  {
53  corrOut = 2.0;
54  return true;
55  }
56  bool getCorr(const gnsstk::Position& rxPos, const gnsstk::Xvt& svPos,
57  const gnsstk::SatID& sat, const gnsstk::ObsID& obs,
58  const gnsstk::CommonTime& when, gnsstk::NavType nav,
59  double& corrOut) override
60  {
61  corrOut = 2.0;
62  return true;
63  }
64 };
65 
66 
68 {
69 public:
70  unsigned constructorTest();
71  unsigned addGetClearResultsTest();
72  unsigned getCorrSumTest();
73 };
74 
75 
78 {
79  TUDEF("CorrectionResults", "CorrectionResults");
81  TUASSERTE(bool, true, uut.getResults().empty());
82  TURETURN();
83 }
84 
85 
88 {
89  TUDEF("CorrectionResults", "addResult/getResults");
91  // Add an arbitrarily chosen number of results and make sure
92  // they all appear to be added properly.
93  for (unsigned i = 1; i < 5; i++)
94  {
96  foo.result = i;
97  TUCATCH(uut.addResult(foo));
98  const gnsstk::CorrectionResultList &results = uut.getResults();
99  TUASSERTE(size_t, i, results.size());
100  TUASSERTFE((double)i, results.rbegin()->result);
101  }
102  TUCSM("clear");
103  uut.clear();
104  TUASSERTE(bool, true, uut.getResults().empty());
105  TURETURN();
106 }
107 
108 
109 unsigned CorrectionResults_T ::
111 {
112  TUDEF("CorrectionResults", "getCorrSum");
114  // create our references for the results to use
115  auto tc1 = std::make_shared<TestCorrector>(gnsstk::CorrectorType::ISC);
116  auto tc2 = std::make_shared<TestCorrector>(gnsstk::CorrectorType::Iono);
117  auto tc3 = std::make_shared<TestCorrector>(gnsstk::CorrectorType::Trop);
118  auto tc4 = std::make_shared<TestCorrector>(gnsstk::CorrectorType::ISC);
119  auto tc5 = std::make_shared<TestCorrector>(gnsstk::CorrectorType::Multipath);
120  // create our "results"
121  gnsstk::CorrectionResult r1(1.0, tc1);
122  gnsstk::CorrectionResult r2(2.0, tc2);
123  gnsstk::CorrectionResult r3(4.0, tc3);
124  gnsstk::CorrectionResult r4(8.0, tc4);
125  gnsstk::CorrectionResult r5(16.0, tc5);
126  // Add the results.
127  uut.addResult(r1);
128  uut.addResult(r2);
129  uut.addResult(r3);
130  uut.addResult(r4);
131  uut.addResult(r5);
132  // Now check the getCorrSum() method.
136  TURETURN();
137 }
138 
139 
140 int main()
141 {
142  unsigned errorTotal = 0;
143  CorrectionResults_T testClass;
144 
145  errorTotal += testClass.constructorTest();
146  errorTotal += testClass.addGetClearResultsTest();
147  errorTotal += testClass.getCorrSumTest();
148 
149  std::cout << "Total Failures for " << __FILE__ << ": " << errorTotal
150  << std::endl;
151 
152  return errorTotal;
153 }
TUCSM
#define TUCSM(METHOD)
Definition: TestUtil.hpp:59
gnsstk::CorrectionResults::clear
void clear()
Empty the contents of results.
Definition: CorrectionResults.cpp:105
TestCorrector::TestCorrector
TestCorrector(gnsstk::CorrectorType ct)
Definition: CorrectionResults_T.cpp:46
CorrectionResults_T
Definition: CorrectionResults_T.cpp:67
TUCATCH
#define TUCATCH(STATEMENT)
Definition: TestUtil.hpp:193
gnsstk::CorrectorType
CorrectorType
Identify different sources of pseudorange bias.
Definition: CorrectorType.hpp:52
gnsstk::CorrectorType::Trop
@ Trop
Troposphere (weather) corrector.
CorrectionResults_T::getCorrSumTest
unsigned getCorrSumTest()
Definition: CorrectionResults_T.cpp:110
TUASSERTE
#define TUASSERTE(TYPE, EXP, GOT)
Definition: TestUtil.hpp:81
gnsstk::SatID
Definition: SatID.hpp:89
gnsstk::CorrDupHandling::UseFirst
@ UseFirst
Sum includes first valid correction of type, all computed.
gnsstk::CorrectionResults::getCorrSum
double getCorrSum(CorrDupHandling dups) const
Definition: CorrectionResults.cpp:59
gnsstk::CorrectionResult
Definition: CorrectionResult.hpp:55
gnsstk::CorrectionResult::result
double result
Computed bias in meters.
Definition: CorrectionResult.hpp:68
gnsstk::CorrDupHandling::ComputeLast
@ ComputeLast
Sum includes last valid correction of a type.
TestUtil.hpp
TURETURN
#define TURETURN()
Definition: TestUtil.hpp:232
CorrectionResults_T::addGetClearResultsTest
unsigned addGetClearResultsTest()
Definition: CorrectionResults_T.cpp:87
gnsstk::ObsID
Definition: ObsID.hpp:82
gnsstk::CorrDupHandling::ComputeFirst
@ ComputeFirst
Sum includes first valid correction, no duplication.
gnsstk::CommonTime
Definition: CommonTime.hpp:84
gnsstk::CorrectionResults::getResults
const CorrectionResultList & getResults() const
Get the ordered list of results.
Definition: CorrectionResults.cpp:52
gnsstk::Xvt
Definition: Xvt.hpp:60
TUDEF
#define TUDEF(CLASS, METHOD)
Definition: TestUtil.hpp:56
gnsstk::CorrectorType::Multipath
@ Multipath
Multipath corrector.
gnsstk::CorrectorType::ISC
@ ISC
Inter-signal bias corrector.
gnsstk::CorrectionResults
Definition: CorrectionResults.hpp:52
gnsstk::CorrectionResults::addResult
void addResult(const CorrectionResult &res)
Definition: CorrectionResults.cpp:45
main
int main()
Definition: CorrectionResults_T.cpp:140
TUASSERTFE
#define TUASSERTFE(EXP, GOT)
Definition: TestUtil.hpp:103
gnsstk::Position
Definition: Position.hpp:136
TestCorrector
Simple class that lets us set the corrType field directly.
Definition: CorrectionResults_T.cpp:43
CorrectionResults.hpp
gnsstk::CorrectionResultList
std::list< CorrectionResult > CorrectionResultList
Just an ordered list of group path correction results.
Definition: CorrectionResult.hpp:73
gnsstk::NavType
NavType
Supported navigation types.
Definition: NavType.hpp:58
CorrectionResults_T::constructorTest
unsigned constructorTest()
Definition: CorrectionResults_T.cpp:77
gnsstk::CorrectorType::Iono
@ Iono
Ionospheric corrector.
gnsstk::GroupPathCorrector::corrType
CorrectorType corrType
Set by child classes, indicates what type of bias is computed.
Definition: GroupPathCorrector.hpp:87
TestCorrector::getCorr
bool getCorr(const gnsstk::Position &rxPos, const gnsstk::Position &svPos, const gnsstk::SatID &sat, const gnsstk::ObsID &obs, const gnsstk::CommonTime &when, gnsstk::NavType nav, double &corrOut) override
Definition: CorrectionResults_T.cpp:48
gnsstk::GroupPathCorrector
Definition: GroupPathCorrector.hpp:61
TestCorrector::getCorr
bool getCorr(const gnsstk::Position &rxPos, const gnsstk::Xvt &svPos, const gnsstk::SatID &sat, const gnsstk::ObsID &obs, const gnsstk::CommonTime &when, gnsstk::NavType nav, double &corrOut) override
Definition: CorrectionResults_T.cpp:56


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