BDSD1NavHealth_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 "BDSD1NavHealth.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  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 BDSD1NavHealth_T ::
69 {
70  TUDEF("BDSD1NavHealth", "BDSD1NavHealth");
72  TUASSERTE(bool, true, obj.isAlmHealth);
73  TUASSERTE(bool, true, obj.satH1);
74  TUASSERTE(uint8_t, 0xff, obj.svHealth);
76  obj.signal.messageType);
77  TURETURN();
78 }
79 
80 
81 unsigned BDSD1NavHealth_T ::
83 {
84  TUDEF("BDSD1NavHealth", "getUserTime");
86  obj.timeStamp = gnsstk::BDSWeekSecond(2100,135.0);
88  // 1x 6s subframe
89  exp = exp + 6.0;
91  TURETURN();
92 }
93 
94 
95 unsigned BDSD1NavHealth_T ::
97 {
98  TUDEF("BDSD1NavHealth", "getHealth");
100  // default should be unhealthy
102  // the one condition that should result in healthy
103  uut.svHealth = 0;
105  // weird looking loop, but basically it just wraps around to 0
106  bool failed = false;
107  for (uut.svHealth = 1; uut.svHealth != 0; uut.svHealth++)
108  {
110  {
111  TUFAIL("health bits " + gnsstk::StringUtils::asString(uut.svHealth) +
112  " should be Unhealthy");
113  failed = true;
114  break;
115  }
116  }
117  if (!failed)
118  {
119  TUPASS("health bits");
120  }
121  uut.isAlmHealth = false;
122  uut.satH1 = false;
124  uut.satH1 = true;
126  TURETURN();
127 }
128 
129 
130 int main()
131 {
132  BDSD1NavHealth_T testClass;
133  unsigned errorTotal = 0;
134 
135  errorTotal += testClass.constructorTest();
136  errorTotal += testClass.getUserTimeTest();
137  errorTotal += testClass.getHealthTest();
138 
139  std::cout << "Total Failures for " << __FILE__ << ": " << errorTotal
140  << std::endl;
141 
142  return errorTotal;
143 }
BDSD1NavHealth_T::getHealthTest
unsigned getHealthTest()
Definition: BDSD1NavHealth_T.cpp:96
gnsstk::NavData::getUserTime
virtual CommonTime getUserTime() const
Definition: NavData.hpp:110
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
gnsstk::BDSD1NavHealth::isAlmHealth
bool isAlmHealth
If true, svHealth is representative, otherwise satH1 is.
Definition: BDSD1NavHealth.hpp:99
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::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
BDSD1NavHealth_T::getUserTimeTest
unsigned getUserTimeTest()
Definition: BDSD1NavHealth_T.cpp:82
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
main
int main()
Definition: BDSD1NavHealth_T.cpp:130
TUDEF
#define TUDEF(CLASS, METHOD)
Definition: TestUtil.hpp:56
gnsstk::BDSD1NavHealth::satH1
bool satH1
Ephemeris health (autonomous satellite health flag).
Definition: BDSD1NavHealth.hpp:101
BDSD1NavHealth.hpp
gnsstk::BDSD1NavHealth::svHealth
uint16_t svHealth
9-bit health from subframes 4.
Definition: BDSD1NavHealth.hpp:103
BDSD1NavHealth_T::constructorTest
unsigned constructorTest()
Make sure constructor initializes data members correctly.
Definition: BDSD1NavHealth_T.cpp:68
gnsstk::NavMessageType
NavMessageType
Identify different types of navigation message data.
Definition: NavMessageType.hpp:59
BDSD1NavHealth_T
Definition: BDSD1NavHealth_T.cpp:57
BDSWeekSecond.hpp
gnsstk::BDSWeekSecond
Definition: BDSWeekSecond.hpp:56
gnsstk::BDSD1NavHealth::getHealth
SVHealth getHealth() const override
Definition: BDSD1NavHealth.cpp:58
gnsstk::SVHealth::Unhealthy
@ Unhealthy
Satellite is unhealthy and should not be used.
gnsstk::BDSD1NavHealth
Definition: BDSD1NavHealth.hpp:51


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