RinexTimeOffset_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 "RinexTimeOffset.hpp"
40 #include "TestUtil.hpp"
41 #include "GPSWeekSecond.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 
52 
54 {
55 public:
57  unsigned constructorTest();
58  unsigned validateTest();
59  unsigned getUserTimeTest();
60  unsigned getOffsetTest();
61  unsigned getConversionsTest();
62 };
63 
64 
65 unsigned RinexTimeOffset_T ::
67 {
68  TUDEF("RinexTimeOffset", "RinexTimeOffset");
71  gnsstk::TimeSystemCorrection::CorrType::Unknown, uut.type);
74  TUASSERTFE(0.0, uut.A0);
75  TUASSERTFE(0.0, uut.A1);
77  uut.refTime);
78  TUASSERTE(std::string, "", uut.geoProvider);
79  TUASSERTE(int, 0, uut.geoUTCid);
81  uut.signal.messageType);
82  TURETURN();
83 }
84 
85 
86 unsigned RinexTimeOffset_T ::
88 {
89  TUDEF("RinexTimeOffset", "validate");
93  TURETURN();
94 }
95 
96 
97 unsigned RinexTimeOffset_T ::
99 {
100  TUDEF("RinexTimeOffset", "getUserTime");
102  gnsstk::CommonTime exp(gnsstk::GPSWeekSecond(2100,135.0));
103  uut.timeStamp = gnsstk::GPSWeekSecond(2100,135.0);
105  TURETURN();
106 }
107 
108 
109 unsigned RinexTimeOffset_T ::
111 {
112  TUDEF("RinexTimeOffset", "getOffset");
114  gnsstk::GPSWeekSecond ws1(2060, 405504.0);
115  gnsstk::GPSWeekSecond ws2(2061, 405504.0);
119  uut.A0 = 18.0 + 1.9790604711E-09;
120  uut.A1 = 7.5495165675E-15;
121  uut.refTime = gnsstk::GPSWeekSecond(2060,21600);
122  double offset = 666;
126  offset));
127  TUASSERTFE(18.000000004877350079, offset);
130  offset));
131  TUASSERTFE(18.000000009443297699, offset);
132  TURETURN();
133 }
134 
135 
136 unsigned RinexTimeOffset_T ::
138 {
139  TUDEF("RinexTimeOffset", "getConversions");
140  gnsstk::TimeCvtSet convs;
148  TUCATCH(convs = uut.getConversions());
149  TUASSERTE(size_t, 2, convs.size());
150  TUASSERTE(size_t, 1, convs.count(key1));
151  TUASSERTE(size_t, 1, convs.count(key2));
152  TURETURN();
153 }
154 
155 
156 int main()
157 {
158  RinexTimeOffset_T testClass;
159  unsigned errorTotal = 0;
160 
161  errorTotal += testClass.constructorTest();
162  errorTotal += testClass.validateTest();
163  errorTotal += testClass.getUserTimeTest();
164  errorTotal += testClass.getOffsetTest();
165  errorTotal += testClass.getConversionsTest();
166 
167  std::cout << "Total Failures for " << __FILE__ << ": " << errorTotal
168  << std::endl;
169 
170  return errorTotal;
171 }
RinexTimeOffset_T::getUserTimeTest
unsigned getUserTimeTest()
Definition: RinexTimeOffset_T.cpp:98
RinexTimeOffset_T::validateTest
unsigned validateTest()
Definition: RinexTimeOffset_T.cpp:87
gnsstk::TimeTag::setTimeSystem
void setTimeSystem(const TimeSystem &timeSys)
Set method for internal variable timeSystem (enum).
Definition: TimeTag.hpp:165
TUCATCH
#define TUCATCH(STATEMENT)
Definition: TestUtil.hpp:193
gnsstk::TimeSystemCorrection::type
CorrType type
Definition: TimeSystemCorr.hpp:164
gnsstk::TimeSystemCorrection::A1
double A1
Definition: TimeSystemCorr.hpp:166
TUASSERTE
#define TUASSERTE(TYPE, EXP, GOT)
Definition: TestUtil.hpp:81
gnsstk::TimeCvtKey
std::pair< TimeSystem, TimeSystem > TimeCvtKey
Definition: TimeOffsetData.hpp:53
gnsstk::NavMessageID::messageType
NavMessageType messageType
Definition: NavMessageID.hpp:97
gnsstk::TimeSystemCorrection::refTime
CommonTime refTime
reference time for polynominal
Definition: TimeSystemCorr.hpp:167
RinexTimeOffset_T
Definition: RinexTimeOffset_T.cpp:53
gnsstk::TimeSystemCorrection::A0
double A0
Definition: TimeSystemCorr.hpp:166
gnsstk::StringUtils::asString
std::string asString(IonexStoreStrategy e)
Convert a IonexStoreStrategy to a whitespace-free string name.
Definition: IonexStoreStrategy.cpp:46
gnsstk::CommonTime::BEGINNING_OF_TIME
static const GNSSTK_EXPORT CommonTime BEGINNING_OF_TIME
earliest representable CommonTime
Definition: CommonTime.hpp:102
gnsstk::NavData::signal
NavMessageID signal
Source signal identification for this navigation message data.
Definition: NavData.hpp:175
gnsstk::TimeSystem::Unknown
@ Unknown
unknown time frame; for legacy code compatibility
gnsstk
For Sinex::InputHistory.
Definition: BasicFramework.cpp:50
gnsstk::TimeSystemCorrection::CorrType
CorrType
Supported time system correction types, cf. RINEX version 3 spec.
Definition: TimeSystemCorr.hpp:64
gnsstk::GPSWeekSecond
Definition: GPSWeekSecond.hpp:56
gnsstk::TimeCvtSet
std::set< TimeCvtKey > TimeCvtSet
Define a unique set of time system conversions.
Definition: TimeOffsetData.hpp:55
gnsstk::NavData::timeStamp
CommonTime timeStamp
Definition: NavData.hpp:173
TUASSERT
#define TUASSERT(EXPR)
Definition: TestUtil.hpp:63
gnsstk::TimeSystemCorrection::geoUTCid
int geoUTCid
Definition: TimeSystemCorr.hpp:169
TestUtil.hpp
RinexTimeOffset.hpp
TURETURN
#define TURETURN()
Definition: TestUtil.hpp:232
RinexTimeOffset_T::getOffsetTest
unsigned getOffsetTest()
Definition: RinexTimeOffset_T.cpp:110
gnsstk::operator<<
std::ostream & operator<<(std::ostream &s, const ObsEpoch &oe) noexcept
Definition: ObsEpochMap.cpp:54
gnsstk::CommonTime
Definition: CommonTime.hpp:84
gnsstk::TimeSystemCorrection::toTS
TimeSystem toTS
Definition: TimeSystemCorr.hpp:165
gnsstk::TimeSystemCorrection::GPUT
@ GPUT
GPS to UTC using A0, A1.
Definition: TimeSystemCorr.hpp:67
gnsstk::TimeSystem
TimeSystem
Definition of various time systems.
Definition: TimeSystem.hpp:51
RinexTimeOffset_T::getConversionsTest
unsigned getConversionsTest()
Definition: RinexTimeOffset_T.cpp:137
TUDEF
#define TUDEF(CLASS, METHOD)
Definition: TestUtil.hpp:56
gnsstk::RinexTimeOffset
Definition: RinexTimeOffset.hpp:52
gnsstk::RinexTimeOffset::getOffset
bool getOffset(TimeSystem fromSys, TimeSystem toSys, const CommonTime &when, double &offset) const override
Definition: RinexTimeOffset.cpp:131
gnsstk::TimeSystem::UTC
@ UTC
Coordinated Universal Time (e.g., from NTP)
gnsstk::NavMessageType::TimeOffset
@ TimeOffset
Message containing information about time system offsets.
main
int main()
Definition: RinexTimeOffset_T.cpp:156
GPSWeekSecond.hpp
RinexTimeOffset_T::constructorTest
unsigned constructorTest()
Make sure constructor initializes data members correctly.
Definition: RinexTimeOffset_T.cpp:66
gnsstk::TimeSystem::GPS
@ GPS
GPS system time.
gnsstk::NavMessageType
NavMessageType
Identify different types of navigation message data.
Definition: NavMessageType.hpp:59
TUASSERTFE
#define TUASSERTFE(EXP, GOT)
Definition: TestUtil.hpp:103
gnsstk::TimeSystemCorrection::frTS
TimeSystem frTS
Definition: TimeSystemCorr.hpp:165
gnsstk::TimeSystemCorrection::geoProvider
std::string geoProvider
string 'EGNOS' 'WAAS' or 'MSAS'
Definition: TimeSystemCorr.hpp:168
gnsstk::RinexTimeOffset::getUserTime
CommonTime getUserTime() const override
Definition: RinexTimeOffset.cpp:70
gnsstk::RinexTimeOffset::getConversions
TimeCvtSet getConversions() const override
Definition: RinexTimeOffset.cpp:152


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