BDSD1NavTimeOffset_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 "BDSD1NavTimeOffset.hpp"
40 #include "TestUtil.hpp"
41 #include "BDSWeekSecond.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 
67 {
68  TUDEF("BDSD1NavTimeOffset", "BDSD1NavTimeOffset");
71  TUASSERTFE(0.0, uut.a0);
72  TUASSERTFE(0.0, uut.a1);
73  TUASSERTFE(0.0, uut.a2);
74  TUASSERTFE(0.0, uut.deltatLS);
76  TUASSERTFE(0.0, uut.tot);
77  TUASSERTE(unsigned, 0, uut.wnot);
78  TUASSERTE(unsigned, 0, uut.wnLSF);
79  TUASSERTE(unsigned, 0, uut.dn);
80  TUASSERTFE(0.0, uut.deltatLSF);
82  uut.signal.messageType);
83  TURETURN();
84 }
85 
86 
89 {
90  TUDEF("BDSD1NavTimeOffset", "validate");
92  TUASSERTE(bool, false, offs.validate());
93  offs.a0 = 1;
94  TUASSERTE(bool, true, offs.validate());
95  offs.a1 = 1;
96  TUASSERTE(bool, true, offs.validate());
97  offs.a0 = 0;
98  TUASSERTE(bool, true, offs.validate());
99  offs.dn = 6;
100  TUASSERTE(bool, true, offs.validate());
101  offs.dn = 7;
102  TUASSERTE(bool, false, offs.validate());
103  TURETURN();
104 }
105 
106 
109 {
110  TUDEF("BDSD1NavTimeOffset", "getUserTime");
112  gnsstk::CommonTime exp(gnsstk::BDSWeekSecond(2100,141.0));
113  uut.timeStamp = gnsstk::BDSWeekSecond(2100,135.0);
115  TURETURN();
116 }
117 
118 
121 {
122  TUDEF("BDSD1NavTimeOffset", "getOffset");
124  gnsstk::BDSWeekSecond ws1(2060, 405504.0);
125  gnsstk::BDSWeekSecond ws2(2061, 405504.0);
127  uut.a0 = 1.9790604711E-09;
128  uut.a1 = 7.5495165675E-15;
129  uut.a2 = 0;
130  uut.deltatLS = 18.0;
131  uut.tot = 21600.0;
132  uut.wnot = 2060;
133  uut.refTime = gnsstk::BDSWeekSecond(uut.wnot,uut.tot);
134  double offset;
137  offset));
138  TUASSERTFE(18.000000004877350079, offset);
140  offset));
141  TUASSERTFE(18.000000009443297699, offset);
142  TURETURN();
143 }
144 
145 
148 {
149  TUDEF("BDSD1NavTimeOffset", "getConversions");
150  gnsstk::TimeCvtSet convs;
152  // This looks a bit weird, but basically getConversions is
153  // expected to return a set containing one key pair for BDS to
154  // the target time system, which by default is Unknown.
159  TUCATCH(convs = offs.getConversions());
160  TUASSERTE(size_t, 2, convs.size());
161  TUASSERTE(size_t, 1, convs.count(key1));
162  TUASSERTE(size_t, 1, convs.count(key2));
163  TURETURN();
164 }
165 
166 
167 int main()
168 {
169  BDSD1NavTimeOffset_T testClass;
170  unsigned errorTotal = 0;
171 
172  errorTotal += testClass.constructorTest();
173  errorTotal += testClass.validateTest();
174  errorTotal += testClass.getUserTimeTest();
175  errorTotal += testClass.getOffsetTest();
176  errorTotal += testClass.getConversionsTest();
177 
178  std::cout << "Total Failures for " << __FILE__ << ": " << errorTotal
179  << std::endl;
180 
181  return errorTotal;
182 }
gnsstk::StdNavTimeOffset::deltatLSF
double deltatLSF
Current or future leap second count (UTC only).
Definition: StdNavTimeOffset.hpp:135
gnsstk::NavData::getUserTime
virtual CommonTime getUserTime() const
Definition: NavData.hpp:110
TUCATCH
#define TUCATCH(STATEMENT)
Definition: TestUtil.hpp:193
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
BDSD1NavTimeOffset_T::getConversionsTest
unsigned getConversionsTest()
Definition: BDSD1NavTimeOffset_T.cpp:147
gnsstk::StdNavTimeOffset::tgt
TimeSystem tgt
Target time system.
Definition: StdNavTimeOffset.hpp:121
gnsstk::StringUtils::asString
std::string asString(IonexStoreStrategy e)
Convert a IonexStoreStrategy to a whitespace-free string name.
Definition: IonexStoreStrategy.cpp:46
gnsstk::StdNavTimeOffset::deltatLS
double deltatLS
Current or past leap second count (UTC only).
Definition: StdNavTimeOffset.hpp:125
gnsstk::StdNavTimeOffset::wnot
unsigned wnot
Time data reference week number (storage only).
Definition: StdNavTimeOffset.hpp:129
gnsstk::NavData::signal
NavMessageID signal
Source signal identification for this navigation message data.
Definition: NavData.hpp:175
gnsstk::StdNavTimeOffset::wnLSF
unsigned wnLSF
Leap second reference week number (UTC only).
Definition: StdNavTimeOffset.hpp:133
gnsstk::TimeSystem::Unknown
@ Unknown
unknown time frame; for legacy code compatibility
gnsstk
For Sinex::InputHistory.
Definition: BasicFramework.cpp:50
gnsstk::StdNavTimeOffset::a1
double a1
Drift coefficient of source time scale.
Definition: StdNavTimeOffset.hpp:123
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
BDSD1NavTimeOffset_T::getOffsetTest
unsigned getOffsetTest()
Definition: BDSD1NavTimeOffset_T.cpp:120
gnsstk::StdNavTimeOffset::dn
unsigned dn
Leap second reference day number (UTC only).
Definition: StdNavTimeOffset.hpp:134
TUASSERT
#define TUASSERT(EXPR)
Definition: TestUtil.hpp:63
TestUtil.hpp
gnsstk::StdNavTimeOffset::a2
double a2
Drift rate coefficient of source time scale.
Definition: StdNavTimeOffset.hpp:124
TURETURN
#define TURETURN()
Definition: TestUtil.hpp:232
gnsstk::operator<<
std::ostream & operator<<(std::ostream &s, const ObsEpoch &oe) noexcept
Definition: ObsEpochMap.cpp:54
gnsstk::CommonTime
Definition: CommonTime.hpp:84
BDSD1NavTimeOffset.hpp
gnsstk::BDSD1NavTimeOffset::validate
bool validate() const override
Definition: BDSD1NavTimeOffset.cpp:59
gnsstk::StdNavTimeOffset::getConversions
TimeCvtSet getConversions() const override
Definition: StdNavTimeOffset.cpp:153
gnsstk::TimeSystem
TimeSystem
Definition of various time systems.
Definition: TimeSystem.hpp:51
BDSD1NavTimeOffset_T::getUserTimeTest
unsigned getUserTimeTest()
Definition: BDSD1NavTimeOffset_T.cpp:108
gnsstk::StdNavTimeOffset::getOffset
bool getOffset(TimeSystem fromSys, TimeSystem toSys, const CommonTime &when, double &offset) const override
Definition: StdNavTimeOffset.cpp:56
TUDEF
#define TUDEF(CLASS, METHOD)
Definition: TestUtil.hpp:56
gnsstk::TimeSystem::UTC
@ UTC
Coordinated Universal Time (e.g., from NTP)
gnsstk::BDSD1NavTimeOffset
Definition: BDSD1NavTimeOffset.hpp:67
gnsstk::NavMessageType::TimeOffset
@ TimeOffset
Message containing information about time system offsets.
gnsstk::NavMessageType
NavMessageType
Identify different types of navigation message data.
Definition: NavMessageType.hpp:59
main
int main()
Definition: BDSD1NavTimeOffset_T.cpp:167
BDSD1NavTimeOffset_T::validateTest
unsigned validateTest()
Definition: BDSD1NavTimeOffset_T.cpp:88
BDSWeekSecond.hpp
TUASSERTFE
#define TUASSERTFE(EXP, GOT)
Definition: TestUtil.hpp:103
gnsstk::StdNavTimeOffset::a0
double a0
Bias coefficient of source time scale.
Definition: StdNavTimeOffset.hpp:122
BDSD1NavTimeOffset_T
Definition: BDSD1NavTimeOffset_T.cpp:53
gnsstk::BDSWeekSecond
Definition: BDSWeekSecond.hpp:56
gnsstk::TimeSystem::BDT
@ BDT
BeiDou system Time.
gnsstk::StdNavTimeOffset::refTime
CommonTime refTime
Reference time for computation.
Definition: StdNavTimeOffset.hpp:126
BDSD1NavTimeOffset_T::constructorTest
unsigned constructorTest()
Make sure constructor initializes data members correctly.
Definition: BDSD1NavTimeOffset_T.cpp:66
gnsstk::StdNavTimeOffset::tot
double tot
Time data reference time of week (storage only).
Definition: StdNavTimeOffset.hpp:128


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