GLOCNavUT1TimeOffset_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 "TestUtil.hpp"
41 #include "GLOCNavUT1TimeOffset.hpp"
42 #include "CivilTime.hpp"
43 #include "GLONASSTime.hpp"
44 
45 namespace gnsstk
46 {
47  std::ostream& operator<<(std::ostream& s, gnsstk::NavMessageType e)
48  {
49  s << StringUtils::asString(e);
50  return s;
51  }
52 }
53 
54 
56 {
57 public:
58  unsigned constructorTest();
59  unsigned validateTest();
60  unsigned getUserTimeTest();
61  unsigned getOffsetTest();
62  unsigned getConversionsTest();
63 };
64 
65 
68 {
69  TUDEF("GLOCNavUT1TimeOffset", "GLOCNavUT1TimeOffset");
71  TUASSERTFE(0.0, uut.B0);
72  TUASSERTFE(0.0, uut.B1);
73  TUASSERTFE(0.0, uut.B2);
74  TUASSERTE(unsigned, -1, uut.NB);
75  TUASSERTE(int, 1, isnan(uut.UTCTAI));
78  uut.signal.messageType);
79  TURETURN();
80 }
81 
82 
85 {
86  TUDEF("GLOCNavUT1TimeOffset", "validate");
89  TUASSERTE(bool, true, uut.validate());
90  TURETURN();
91 }
92 
93 
96 {
97  TUDEF("GLOCNavUT1TimeOffset", "getUserTime");
99  uut.timeStamp = gnsstk::CivilTime(2006, 10, 01, 0, 15, 0,
101  // 1x 2s string
102  gnsstk::CommonTime exp(uut.timeStamp + 3.0);
104  TURETURN();
105 }
106 
107 
110 {
111  TUDEF("GLOCNavUT1TimeOffset", "getOffset");
113  uut.B0 = -9.692382812E-02;
114  uut.B1 = 5.950927734E-04;
115  uut.B2 = 0.0;
116  uut.NB = 853;
117  uut.refTime = gnsstk::GLONASSTime(7, uut.NB);
118  uut.UTCTAI = -37;
119  double offset;
120  gnsstk::CommonTime when1(uut.refTime),
121  when2(gnsstk::GLONASSTime(7, uut.NB, 43208));
124  when1, offset));
125  TUASSERTFE(-0.096923828119999999586, offset);
127  when2, offset));
128  TUASSERTFE(-0.096626226632117270809, offset);
129  TURETURN();
130 }
131 
132 
135 {
136  TUDEF("GLOCNavUT1TimeOffset", "getConversions");
137  gnsstk::TimeCvtSet convs;
141  TUCATCH(convs = uut.getConversions());
142  TUASSERTE(size_t, 2, convs.size());
143  TUASSERTE(size_t, 1, convs.count(key1));
144  TUASSERTE(size_t, 1, convs.count(key2));
145  TURETURN();
146 }
147 
148 
149 int main()
150 {
151  GLOCNavUT1TimeOffset_T testClass;
152  unsigned errorTotal = 0;
153 
154  errorTotal += testClass.constructorTest();
155  errorTotal += testClass.validateTest();
156  errorTotal += testClass.getUserTimeTest();
157  errorTotal += testClass.getOffsetTest();
158  errorTotal += testClass.getConversionsTest();
159 
160  std::cout << "Total Failures for " << __FILE__ << ": " << errorTotal
161  << std::endl;
162 
163  return errorTotal;
164 }
gnsstk::NavData::getUserTime
virtual CommonTime getUserTime() const
Definition: NavData.hpp:110
gnsstk::GLOCNavUT1TimeOffset
Definition: GLOCNavUT1TimeOffset.hpp:58
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
gnsstk::GLOCNavUT1TimeOffset::B1
double B1
Time drift in s/s.
Definition: GLOCNavUT1TimeOffset.hpp:104
gnsstk::GLOCNavUT1TimeOffset::getConversions
TimeCvtSet getConversions() const override
Definition: GLOCNavUT1TimeOffset.cpp:146
gnsstk::GLOCNavUT1TimeOffset::B0
double B0
Time bias in seconds.
Definition: GLOCNavUT1TimeOffset.hpp:103
gnsstk::StringUtils::asString
std::string asString(IonexStoreStrategy e)
Convert a IonexStoreStrategy to a whitespace-free string name.
Definition: IonexStoreStrategy.cpp:46
GLOCNavUT1TimeOffset_T
Definition: GLOCNavUT1TimeOffset_T.cpp:55
GLOCNavUT1TimeOffset_T::constructorTest
unsigned constructorTest()
Definition: GLOCNavUT1TimeOffset_T.cpp:67
gnsstk::NavData::signal
NavMessageID signal
Source signal identification for this navigation message data.
Definition: NavData.hpp:175
gnsstk
For Sinex::InputHistory.
Definition: BasicFramework.cpp:50
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
gnsstk::GLONASSTime
Definition: GLONASSTime.hpp:59
gnsstk::GLOCNavUT1TimeOffset::validate
bool validate() const override
Definition: GLOCNavUT1TimeOffset.cpp:155
TUASSERT
#define TUASSERT(EXPR)
Definition: TestUtil.hpp:63
GLOCNavUT1TimeOffset_T::getConversionsTest
unsigned getConversionsTest()
Definition: GLOCNavUT1TimeOffset_T.cpp:134
TestUtil.hpp
gnsstk::GLOCNavUT1TimeOffset::B2
double B2
Time drift rate in s/s**2.
Definition: GLOCNavUT1TimeOffset.hpp:105
gnsstk::GLOCNavUT1TimeOffset::NB
unsigned NB
Day since the most recent leap year-aligned 4 years.
Definition: GLOCNavUT1TimeOffset.hpp:102
TURETURN
#define TURETURN()
Definition: TestUtil.hpp:232
GLOCNavUT1TimeOffset_T::getUserTimeTest
unsigned getUserTimeTest()
Definition: GLOCNavUT1TimeOffset_T.cpp:95
gnsstk::operator<<
std::ostream & operator<<(std::ostream &s, const ObsEpoch &oe) noexcept
Definition: ObsEpochMap.cpp:54
gnsstk::CommonTime
Definition: CommonTime.hpp:84
GLOCNavUT1TimeOffset_T::getOffsetTest
unsigned getOffsetTest()
Definition: GLOCNavUT1TimeOffset_T.cpp:109
CivilTime.hpp
gnsstk::GLOCNavUT1TimeOffset::getOffset
bool getOffset(TimeSystem fromSys, TimeSystem toSys, const CommonTime &when, double &offset) const override
Definition: GLOCNavUT1TimeOffset.cpp:124
TUDEF
#define TUDEF(CLASS, METHOD)
Definition: TestUtil.hpp:56
gnsstk::TimeSystem::GLO
@ GLO
GLONASS system time (aka UTC(SU))
gnsstk::TimeSystem::UTC
@ UTC
Coordinated Universal Time (e.g., from NTP)
GLONASSTime.hpp
gnsstk::CivilTime
Definition: CivilTime.hpp:55
gnsstk::NavMessageType::TimeOffset
@ TimeOffset
Message containing information about time system offsets.
gnsstk::GLOCNavUT1TimeOffset::UTCTAI
double UTCTAI
Leap seconds - not really used.
Definition: GLOCNavUT1TimeOffset.hpp:106
gnsstk::NavMessageType
NavMessageType
Identify different types of navigation message data.
Definition: NavMessageType.hpp:59
TUASSERTFE
#define TUASSERTFE(EXP, GOT)
Definition: TestUtil.hpp:103
main
int main()
Definition: GLOCNavUT1TimeOffset_T.cpp:149
GLOCNavUT1TimeOffset_T::validateTest
unsigned validateTest()
Definition: GLOCNavUT1TimeOffset_T.cpp:84
GLOCNavUT1TimeOffset.hpp
gnsstk::GLOCNavUT1TimeOffset::refTime
CommonTime refTime
Reference time for computation.
Definition: GLOCNavUT1TimeOffset.hpp:101


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