MetReader_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 "MetReader.hpp"
40 #include "build_config.h"
41 #include "TestUtil.hpp"
42 
43 using namespace std;
44 
46 {
47 public:
48  unsigned constructorTest();
49  unsigned readTest();
50  static const string goodMet, nonExist;
51 };
52 
53 const string MetReader_T::goodMet(gnsstk::getPathData() + gnsstk::getFileSep() +
54  "arlm2000.15m");
55 const string MetReader_T::nonExist(gnsstk::getFileSep() + "hi" +
56  gnsstk::getFileSep() + "there");
57 
58 unsigned MetReader_T ::
60 {
61  TUDEF("MetReader", "MetReader");
62  gnsstk::MetReader uut1;
63  TUASSERTE(unsigned, 0, uut1.verboseLevel);
64  try
65  {
66  gnsstk::MetReader uut2(goodMet);
67  TUPASS("file read");
68  TUASSERTE(unsigned, 96, uut2.wx.obs.size());
69  }
70  catch (...)
71  {
72  TUFAIL("Unexpected exception opening \"" + goodMet + "\"");
73  }
74  try
75  {
76  gnsstk::MetReader uut3(nonExist);
77  TUFAIL("file read");
78  }
79  catch (gnsstk::FileMissingException)
80  {
81  TUPASS("Caught the right exception");
82  }
83  catch (...)
84  {
85  TUFAIL("Caught wrong exception");
86  }
87  TURETURN();
88 }
89 
90 
91 unsigned MetReader_T ::
93 {
94  TUDEF("MetReader", "read");
96  TUASSERTE(bool, true, uut.read(goodMet));
97  TUASSERTE(unsigned, 96, uut.wx.obs.size());
98  TUASSERTE(bool, false, uut.read(nonExist));
99  TURETURN();
100 }
101 
102 
103 int main()
104 {
105  unsigned errorTotal = 0;
106  MetReader_T testClass;
107 
108  errorTotal += testClass.constructorTest();
109  errorTotal += testClass.readTest();
110 
111  cout << "Total Failures for " << __FILE__ << ": " << errorTotal << endl;
112 
113  return errorTotal;
114 }
gnsstk::MetReader
Definition: MetReader.hpp:51
gnsstk::MetReader::wx
gnsstk::WxObsData wx
The storage for all weather data read.
Definition: MetReader.hpp:73
TUASSERTE
#define TUASSERTE(TYPE, EXP, GOT)
Definition: TestUtil.hpp:81
TUFAIL
#define TUFAIL(MSG)
Definition: TestUtil.hpp:228
MetReader.hpp
MetReader_T
Definition: MetReader_T.cpp:45
MetReader_T::readTest
unsigned readTest()
Definition: MetReader_T.cpp:92
gnsstk::MetReader::read
bool read(const std::string &fn)
Definition: MetReader.cpp:72
gnsstk::MetReader::verboseLevel
unsigned verboseLevel
Definition: MetReader.hpp:70
main
int main()
Definition: MetReader_T.cpp:103
MetReader_T::goodMet
static const string goodMet
Definition: MetReader_T.cpp:50
TestUtil.hpp
TURETURN
#define TURETURN()
Definition: TestUtil.hpp:232
TUPASS
#define TUPASS(MSG)
Definition: TestUtil.hpp:230
MetReader_T::nonExist
static const string nonExist
Definition: MetReader_T.cpp:50
gnsstk::WxObsData::obs
WxObsMap obs
The actual data.
Definition: WxObsMap.hpp:133
TUDEF
#define TUDEF(CLASS, METHOD)
Definition: TestUtil.hpp:56
std
Definition: Angle.hpp:142
MetReader_T::constructorTest
unsigned constructorTest()
Definition: MetReader_T.cpp:59


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