YumaNavDataFactory_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 "YumaNavDataFactory.hpp"
40 #include "TestUtil.hpp"
41 #include "GPSLNavEph.hpp"
42 #include "GPSLNavHealth.hpp"
43 
44 namespace gnsstk
45 {
46  std::ostream& operator<<(std::ostream& s, gnsstk::NavMessageType e)
47  {
48  s << StringUtils::asString(e);
49  return s;
50  }
51 }
52 
56 {
57 public:
60  { return data; }
61 };
62 
65 {
66 public:
68  unsigned constructorTest();
70  unsigned loadIntoMapTest();
76  template <class NavClass>
77  void verifyDataType(gnsstk::TestUtil& testFramework,
79 };
80 
81 
84 {
85  TUDEF("YumaNavDataFactory", "YumaNavDataFactory");
87  // check for expected signal support
92  TUASSERT(fact.supportedSignals.count(nsid1));
93  TURETURN();
94 }
95 
96 
99 {
100  TUDEF("YumaNavDataFactory", "loadIntoMap");
101 
102  // test loading YUMA 2 nav
104  std::string f2name = gnsstk::getPathData() + gnsstk::getFileSep() +
105  "test_input_yuma377.txt";
106  // this should implicitly load into the data map
107  TUASSERT(f2.addDataSource(f2name));
108  TUASSERTE(size_t, 60, f2.size());
109 
110  TestClass f4;
111  std::string f4name = gnsstk::getPathData() + gnsstk::getFileSep() +
112  "test_input_yuma377.txt";
113  TUCATCH(f4.setTypeFilter({gnsstk::NavMessageType::Almanac}));
114  // this should implicitly load into the data map
115  TUASSERT(f4.addDataSource(f4name));
116  TUASSERTE(size_t, 30, f4.size());
117  gnsstk::NavMessageMap &nmm4(f4.getData());
118  // only one message type
119  TUASSERTE(size_t, 1, nmm4.size());
120  // and it's almanac.
122  nmm4.begin()->first);
123  TUCSM("convertToOrbit/fillNavData");
124  verifyDataType<gnsstk::GPSLNavAlm>(testFramework, nmm4);
125  TUCSM("loadIntoMap");
126 
127  TestClass f5;
128  std::string f5name = gnsstk::getPathData() + gnsstk::getFileSep() +
129  "test_input_yuma377.txt";
130  TUCATCH(f5.setTypeFilter({gnsstk::NavMessageType::Health}));
131  // this should implicitly load into the data map
132  TUASSERT(f5.addDataSource(f5name));
133  TUASSERTE(size_t, 30, f5.size());
134  gnsstk::NavMessageMap &nmm5(f5.getData());
135  // only one message type
136  TUASSERTE(size_t, 1, nmm5.size());
137  // and it's health.
139  nmm5.begin()->first);
140  TUCSM("convertToHealth/fillNavData");
141  verifyDataType<gnsstk::GPSLNavHealth>(testFramework, nmm5);
142  TUCSM("loadIntoMap");
143 
144  TestClass f6;
145  std::string f6name = gnsstk::getPathData() + gnsstk::getFileSep() +
146  "test_input_yuma377.txt";
147  TUCATCH(f6.setTypeFilter({gnsstk::NavMessageType::Ephemeris}));
148  // this should implicitly load into the data map
149  TUASSERT(f6.addDataSource(f6name));
150  // except there isn't any data, because Yuma nav doesn't contain ephemeris
151  TUASSERTE(size_t, 0, f6.size());
152 
153  // test loading something that isn't yuma
154  TestClass f7;
155  std::string f7name = gnsstk::getPathData() + gnsstk::getFileSep() +
156  "test_input_SP3a.sp3";
157  TUASSERT(!f7.addDataSource(f7name));
158  TUASSERTE(size_t, 0, f7.size());
159 
160  TURETURN();
161 }
162 
163 
164 template <class NavClass>
168 {
169  for (auto& nmti : nmm)
170  {
171  for (auto& sati : nmti.second)
172  {
173  for (auto& ti : sati.second)
174  {
175  TUASSERT(dynamic_cast<NavClass*>(ti.second.get()) != nullptr);
176  }
177  }
178  }
179 }
180 
181 
182 int main()
183 {
184  YumaNavDataFactory_T testClass;
185  unsigned errorTotal = 0;
186 
187  errorTotal += testClass.constructorTest();
188  errorTotal += testClass.loadIntoMapTest();
189 
190  std::cout << "Total Failures for " << __FILE__ << ": " << errorTotal
191  << std::endl;
192 
193  return errorTotal;
194 }
TestClass::addDataSource
bool addDataSource(const std::string &source) override
Definition: NavDataFactory_T.cpp:76
TUCSM
#define TUCSM(METHOD)
Definition: TestUtil.hpp:59
main
int main()
Definition: YumaNavDataFactory_T.cpp:182
TUCATCH
#define TUCATCH(STATEMENT)
Definition: TestUtil.hpp:193
gnsstk::NavMessageMap
std::map< NavMessageType, NavSatMap > NavMessageMap
Map nav message type to the rest of the storage.
Definition: NavData.hpp:71
TUASSERTE
#define TUASSERTE(TYPE, EXP, GOT)
Definition: TestUtil.hpp:81
gnsstk::NavMessageType::Health
@ Health
SV health status information message.
gnsstk::StringUtils::asString
std::string asString(IonexStoreStrategy e)
Convert a IonexStoreStrategy to a whitespace-free string name.
Definition: IonexStoreStrategy.cpp:46
GPSLNavHealth.hpp
YumaNavDataFactory_T::constructorTest
unsigned constructorTest()
Make sure the constructor does what it's supposed to.
Definition: YumaNavDataFactory_T.cpp:83
gnsstk
For Sinex::InputHistory.
Definition: BasicFramework.cpp:50
gnsstk::NavType::GPSLNAV
@ GPSLNAV
gnsstk::SatelliteSystem::GPS
@ GPS
gnsstk::TrackingCode::CA
@ CA
Legacy GPS civil code.
YumaNavDataFactory_T::loadIntoMapTest
unsigned loadIntoMapTest()
Exercise loadIntoMap by loading data with different options in place.
Definition: YumaNavDataFactory_T.cpp:98
gnsstk::YumaNavDataFactory
Definition: YumaNavDataFactory.hpp:54
gnsstk::NavDataFactoryWithStoreFile::addDataSource
bool addDataSource(const std::string &source) override
Definition: NavDataFactoryWithStoreFile.hpp:64
TUASSERT
#define TUASSERT(EXPR)
Definition: TestUtil.hpp:63
TestUtil.hpp
gnsstk::NavDataFactoryWithStore::size
virtual size_t size() const
Return the number of nav messages in data.
Definition: NavDataFactoryWithStore.cpp:1005
TURETURN
#define TURETURN()
Definition: TestUtil.hpp:232
TestClass::getData
gnsstk::NavMessageMap & getData()
Grant access to protected data.
Definition: YumaNavDataFactory_T.cpp:59
gnsstk::operator<<
std::ostream & operator<<(std::ostream &s, const ObsEpoch &oe) noexcept
Definition: ObsEpochMap.cpp:54
gnsstk::CarrierBand::L1
@ L1
GPS L1, Galileo E1, SBAS L1, QZSS L1, BeiDou L1.
TUDEF
#define TUDEF(CLASS, METHOD)
Definition: TestUtil.hpp:56
example3.data
data
Definition: example3.py:22
gnsstk::NavSignalID
Class used to identify navigation data signal types.
Definition: NavSignalID.hpp:54
gnsstk::NavMessageType
NavMessageType
Identify different types of navigation message data.
Definition: NavMessageType.hpp:59
YumaNavDataFactory_T
Automated tests for gnsstk::YumaNavDataFactory.
Definition: YumaNavDataFactory_T.cpp:64
TestClass
Make GroupPathCorrector instantiatable for testing.
Definition: GroupPathCorrector_T.cpp:56
YumaNavDataFactory.hpp
gnsstk::NavDataFactory::supportedSignals
NavSignalSet supportedSignals
Definition: NavDataFactory.hpp:379
GPSLNavEph.hpp
gnsstk::TestUtil
Definition: TestUtil.hpp:265
gnsstk::NavMessageType::Almanac
@ Almanac
Low-precision orbits for other than the transmitting SV.
YumaNavDataFactory_T::verifyDataType
void verifyDataType(gnsstk::TestUtil &testFramework, gnsstk::NavMessageMap &nmm)
Definition: YumaNavDataFactory_T.cpp:166


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