GPSCNav2Health_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 "GPSCNav2Health.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  std::ostream& operator<<(std::ostream& s, gnsstk::SVHealth e)
51  {
52  s << StringUtils::asString(e);
53  return s;
54  }
55 }
56 
58 {
59 public:
61  unsigned constructorTest();
62  unsigned getUserTimeTest();
63  unsigned getHealthTest();
64 };
65 
66 
67 unsigned GPSCNav2Health_T ::
69 {
70  TUDEF("GPSCNav2Health", "GPSCNav2Health");
72  TUASSERTE(uint8_t, true, uut.health);
74  uut.signal.messageType);
75  TURETURN();
76 }
77 
78 
79 unsigned GPSCNav2Health_T ::
81 {
82  TUDEF("GPSCNav2Health", "getUserTime");
84  uut.timeStamp = gnsstk::GPSWeekSecond(2100,135.0);
85  // eph = 12s, alm = 5.48s
86  gnsstk::CommonTime expEph = uut.timeStamp + 12.0;
87  gnsstk::CommonTime expAlm = uut.timeStamp + 5.48;
88  uut.setEph(true);
90  uut.setEph(false);
92  TURETURN();
93 }
94 
95 
96 unsigned GPSCNav2Health_T ::
98 {
99  TUDEF("GPSCNav2Health", "getHealth");
101  // default should be unhealthy
103  // the one condition that should result in healthy
104  uut.health = false;
106  TURETURN();
107 }
108 
109 
110 int main()
111 {
112  GPSCNav2Health_T testClass;
113  unsigned errorTotal = 0;
114 
115  errorTotal += testClass.constructorTest();
116  errorTotal += testClass.getUserTimeTest();
117  errorTotal += testClass.getHealthTest();
118 
119  std::cout << "Total Failures for " << __FILE__ << ": " << errorTotal
120  << std::endl;
121 
122  return errorTotal;
123 }
gnsstk::NavData::getUserTime
virtual CommonTime getUserTime() const
Definition: NavData.hpp:110
gnsstk::GPSCNav2Health::setEph
void setEph(bool e)
Definition: GPSCNav2Health.cpp:97
TUASSERTE
#define TUASSERTE(TYPE, EXP, GOT)
Definition: TestUtil.hpp:81
gnsstk::NavMessageID::messageType
NavMessageType messageType
Definition: NavMessageID.hpp:97
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
main
int main()
Definition: GPSCNav2Health_T.cpp:110
GPSCNav2Health_T::getUserTimeTest
unsigned getUserTimeTest()
Definition: GPSCNav2Health_T.cpp:80
gnsstk::SVHealth
SVHealth
Identify different types of SV health states.
Definition: SVHealth.hpp:52
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::GPSWeekSecond
Definition: GPSWeekSecond.hpp:56
gnsstk::NavData::timeStamp
CommonTime timeStamp
Definition: NavData.hpp:173
TestUtil.hpp
gnsstk::SVHealth::Healthy
@ Healthy
Satellite is in a healthy and useable state.
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
TUDEF
#define TUDEF(CLASS, METHOD)
Definition: TestUtil.hpp:56
GPSWeekSecond.hpp
gnsstk::NavMessageType
NavMessageType
Identify different types of navigation message data.
Definition: NavMessageType.hpp:59
GPSCNav2Health_T::constructorTest
unsigned constructorTest()
Make sure constructor initializes data members correctly.
Definition: GPSCNav2Health_T.cpp:68
gnsstk::GPSCNav2Health
Wrapper for the 1-bit health status in GPS CNav2 subframe 2 or 3.
Definition: GPSCNav2Health.hpp:50
gnsstk::GPSCNav2Health::health
bool health
1-bit health.
Definition: GPSCNav2Health.hpp:86
GPSCNav2Health_T
Definition: GPSCNav2Health_T.cpp:57
GPSCNav2Health_T::getHealthTest
unsigned getHealthTest()
Definition: GPSCNav2Health_T.cpp:97
gnsstk::SVHealth::Unhealthy
@ Unhealthy
Satellite is unhealthy and should not be used.
GPSCNav2Health.hpp
gnsstk::GPSCNav2Health::getHealth
SVHealth getHealth() const override
Definition: GPSCNav2Health.hpp:75


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