GPSLNavHealth_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 "GPSLNavHealth.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 GPSLNavHealth_T ::
69 {
70  TUDEF("GPSLNavHealth", "GPSLNavHealth");
72  TUASSERTE(uint8_t, 0x80, obj.svHealth);
74  obj.signal.messageType);
75  TURETURN();
76 }
77 
78 
79 unsigned GPSLNavHealth_T ::
81 {
82  TUDEF("GPSLNavHealth", "getUserTime");
84  obj.timeStamp = gnsstk::GPSWeekSecond(2100,135.0);
86  // 1x 6s subframe
87  exp = exp + 6.0;
89  TURETURN();
90 }
91 
92 
93 unsigned GPSLNavHealth_T ::
95 {
96  TUDEF("GPSLNavHealth", "getHealth");
98  // default should be unhealthy
100  // the one condition that should result in healthy
101  obj.svHealth = 0;
103  // weird looking loop, but basically it just wraps around to 0
104  bool failed = false;
105  for (obj.svHealth = 1; obj.svHealth != 0; obj.svHealth++)
106  {
108  {
109  TUFAIL("health bits " + gnsstk::StringUtils::asString(obj.svHealth) +
110  " should be Unhealthy");
111  failed = true;
112  break;
113  }
114  }
115  if (!failed)
116  {
117  TUPASS("health bits");
118  }
119  TURETURN();
120 }
121 
122 
123 int main()
124 {
125  GPSLNavHealth_T testClass;
126  unsigned errorTotal = 0;
127 
128  errorTotal += testClass.constructorTest();
129  errorTotal += testClass.getUserTimeTest();
130  errorTotal += testClass.getHealthTest();
131 
132  std::cout << "Total Failures for " << __FILE__ << ": " << errorTotal
133  << std::endl;
134 
135  return errorTotal;
136 }
GPSLNavHealth_T::getHealthTest
unsigned getHealthTest()
Definition: GPSLNavHealth_T.cpp:94
gnsstk::NavData::getUserTime
virtual CommonTime getUserTime() const
Definition: NavData.hpp:110
gnsstk::GPSLNavHealth::svHealth
uint8_t svHealth
6-bit or 8-bit health.
Definition: GPSLNavHealth.hpp:80
TUASSERTE
#define TUASSERTE(TYPE, EXP, GOT)
Definition: TestUtil.hpp:81
gnsstk::NavMessageID::messageType
NavMessageType messageType
Definition: NavMessageID.hpp:97
TUFAIL
#define TUFAIL(MSG)
Definition: TestUtil.hpp:228
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
GPSLNavHealth_T::constructorTest
unsigned constructorTest()
Make sure constructor initializes data members correctly.
Definition: GPSLNavHealth_T.cpp:68
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
main
int main()
Definition: GPSLNavHealth_T.cpp:123
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
GPSLNavHealth_T::getUserTimeTest
unsigned getUserTimeTest()
Definition: GPSLNavHealth_T.cpp:80
gnsstk::SVHealth::Healthy
@ Healthy
Satellite is in a healthy and useable state.
TURETURN
#define TURETURN()
Definition: TestUtil.hpp:232
TUPASS
#define TUPASS(MSG)
Definition: TestUtil.hpp:230
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
gnsstk::GPSLNavHealth::getHealth
SVHealth getHealth() const override
Definition: GPSLNavHealth.hpp:76
GPSWeekSecond.hpp
gnsstk::NavMessageType
NavMessageType
Identify different types of navigation message data.
Definition: NavMessageType.hpp:59
gnsstk::SVHealth::Unhealthy
@ Unhealthy
Satellite is unhealthy and should not be used.
GPSLNavHealth_T
Definition: GPSLNavHealth_T.cpp:57
gnsstk::GPSLNavHealth
Definition: GPSLNavHealth.hpp:51


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