ObsClockModel_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 // This software was developed by Applied Research Laboratories at the
28 // University of Texas at Austin, under contract to an agency or agencies
29 // within the U.S. Department of Defense. The U.S. Government retains all
30 // rights to use, duplicate, distribute, disclose, or release this software.
31 //
32 // Pursuant to DoD Directive 523024
33 //
34 // DISTRIBUTION STATEMENT A: This software has been approved for public
35 // release, distribution is unlimited.
36 //
37 //==============================================================================
38 
39 #include "TestUtil.hpp"
40 #include "ObsClockModel.hpp"
41 
42 using namespace std;
43 using namespace gnsstk;
44 
45 //============================================================
46 // Declarations for test class
47 //============================================================
48 
49 namespace gnsstk
50 {
52  {
53  public:
54  virtual void addEpoch(const ORDEpoch& re) {}
55  virtual double getOffset(const gnsstk::CommonTime& t) const {return(0.0);}
56  virtual bool isOffsetValid(const gnsstk::CommonTime& t) const {return false;}
57  };
58 };
59 
60 
62 {
63  public:
66  int test_constructor();
67  int test_constructor_defaults();
68  int test_getSvMode();
69 
70 };
71 
72 //============================================================
73 // Definitions for test class
74 //============================================================
75 
76 
77 //----------------------------------------
78 // Constructor tests
79 //----------------------------------------
80 
82 {
83  TestUtil test_util( "ObsClockModel", "constructor", __FILE__, __LINE__ );
84  std::string test_desc = "ObsClockModel objects are created with default constructor";
85  std::string test_fail = "class constructor failed";
86 
87  try
88  {
89  ObsClockModel_Child testObsClockModel;
90  test_util.assert( true, "We have successfully constructed an ObsClockModel", __LINE__ );
91  }
92  catch(...)
93  {
94  test_util.assert( false, "constructor threw an exception", __LINE__ );
95  }
96 
97  return( test_util.countFails() );
98 }
99 
100 
102 {
103  TestUtil test_util( "ObsClockModel", "constructor defaults", __FILE__, __LINE__ );
104  std::string test_desc = "ObsClockModel constructor with default values";
105  std::string test_fail = "class constructor failed";
106 
107 
108  try
109  {
110  ObsClockModel_Child testObsClockModel;
111  SatID testSatID( 1, SatelliteSystem::GPS );
112 
113  test_util.assert( testObsClockModel.getSigmaMultiplier() == 2.0 , "Default sigma value is not as expected", __LINE__ );
114  test_util.assert( testObsClockModel.getElevationMask() == 0.0 , "Default elmask value is not as expected", __LINE__ );
115  test_util.assert( testObsClockModel.getSvMode( testSatID ) == ObsClockModel::ALWAYS , "Default SvMode value is not as expected", __LINE__ );
116  test_util.assert( testObsClockModel.getUseWonkyData() == false , "Default useWonkyData value is not as expected", __LINE__ );
117 
118  test_util.assert( true, "We have successfully tested default constructor values for ObsClockModel", __LINE__ );
119  }
120  catch(...)
121  {
122  test_util.assert( false, "constructor threw an exception while testing default data member values", __LINE__ );
123  }
124 
125  return( test_util.countFails() );
126 }
127 
128 //----------------------------------------
129 // Mode test
130 //----------------------------------------
131 
133 {
134  TestUtil test_util( "ObsClockModel", "getSvMode", __FILE__, __LINE__ );
135  std::string test_exception_msg = "test threw an unexpected exception";
136  std::string test_fail_msg = "get SvMode value returned did not match set SvMode value expected";
137 
138  try
139  {
140  ObsClockModel_Child testObsClockModel;
141 
142  // create the SvMode that you will pass into setSvMode, then pass it in.
143  ObsClockModel::SvMode expectedSvMode = ObsClockModel::ALWAYS;
144  const ObsClockModel& dummyModel = testObsClockModel.setSvMode( expectedSvMode );
145 
146  // need at least one SatId in order to extract the SvMode
147  SatID testSatID( 1, SatelliteSystem::GPS );
148  ObsClockModel::SvMode returnedSvMode = testObsClockModel.getSvMode( testSatID );
149 
150  test_util.assert( returnedSvMode == expectedSvMode, test_fail_msg, __LINE__ );
151  }
152  catch(...)
153  {
154  test_util.assert( false, test_exception_msg, __LINE__ );
155  }
156 
157  return( test_util.countFails() );
158 }
159 
160 
161 
162 //============================================================
163 // main() for test application to be executed by CMake/CTest
164 //============================================================
165 
166 int main( )
167 {
168  int errorTotal = 0;
169 
170  ObsClockModel_T testClass;
171 
172  errorTotal += testClass.test_constructor();
173  errorTotal += testClass.test_constructor_defaults();
174  errorTotal += testClass.test_getSvMode();
175 
176  cout << "Total Failures for " << __FILE__ << ": " << errorTotal << endl;
177 
178  return( errorTotal );
179 }
180 
181 //============================================================
182 // The End
183 //============================================================
gnsstk::ObsClockModel::getSvMode
SvMode getSvMode(const SatID &svid) const
Definition: ObsClockModel.cpp:86
gnsstk::TestUtil::countFails
int countFails(void)
Definition: TestUtil.hpp:771
gnsstk::ObsClockModel::SvMode
SvMode
Definition: ObsClockModel.hpp:69
gnsstk::TestUtil::assert
void assert(bool testExpression, const std::string &testMsg, const int lineNumber)
Definition: TestUtil.hpp:607
gnsstk::ObsClockModel_Child::isOffsetValid
virtual bool isOffsetValid(const gnsstk::CommonTime &t) const
Definition: ObsClockModel_T.cpp:56
gnsstk::ObsClockModel::getSigmaMultiplier
double getSigmaMultiplier() const noexcept
Definition: ObsClockModel.hpp:195
gnsstk::ObsClockModel
Definition: ObsClockModel.hpp:66
ObsClockModel_T::ObsClockModel_T
ObsClockModel_T()
Definition: ObsClockModel_T.cpp:64
gnsstk::SatID
Definition: SatID.hpp:89
gnsstk::ObsClockModel::setSvMode
ObsClockModel & setSvMode(const SatID &svid, const SvMode &mode) noexcept
Definition: ObsClockModel.hpp:119
gnsstk
For Sinex::InputHistory.
Definition: BasicFramework.cpp:50
TestUtil.hpp
gnsstk::CommonTime
Definition: CommonTime.hpp:84
gnsstk::ObsClockModel_Child
Definition: ObsClockModel_T.cpp:51
ObsClockModel_T::test_getSvMode
int test_getSvMode()
Definition: ObsClockModel_T.cpp:132
ObsClockModel_T::test_constructor
int test_constructor()
Definition: ObsClockModel_T.cpp:81
gnsstk::ObsClockModel_Child::addEpoch
virtual void addEpoch(const ORDEpoch &re)
Definition: ObsClockModel_T.cpp:54
ObsClockModel_T
Definition: ObsClockModel_T.cpp:61
main
int main()
Definition: ObsClockModel_T.cpp:166
gnsstk::ORDEpoch
Definition: ORDEpoch.hpp:59
std
Definition: Angle.hpp:142
ObsClockModel.hpp
ObsClockModel_T::~ObsClockModel_T
~ObsClockModel_T()
Definition: ObsClockModel_T.cpp:65
gnsstk::ObsClockModel_Child::getOffset
virtual double getOffset(const gnsstk::CommonTime &t) const
Definition: ObsClockModel_T.cpp:55
gnsstk::ObsClockModel::getUseWonkyData
bool getUseWonkyData() const noexcept
Definition: ObsClockModel.hpp:207
gnsstk::ObsClockModel::getElevationMask
double getElevationMask() const noexcept
Definition: ObsClockModel.hpp:201
gnsstk::TestUtil
Definition: TestUtil.hpp:265
ObsClockModel_T::test_constructor_defaults
int test_constructor_defaults()
Definition: ObsClockModel_T.cpp:101


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