Yuma_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 /*********************************************************************
40 *
41 * Test program to exercise YumaBase, YumaData, YumaStream.
42 *
43 // *********************************************************************/
44 // System
45 #include <iostream>
46 #include <fstream>
47 
48 #include "YumaData.hpp"
49 #include "YumaStream.hpp"
50 #include "YumaBase.hpp"
51 
52 #include "build_config.h"
53 #include "TestUtil.hpp"
54 
55 class Yuma_T
56 {
57 public:
58  unsigned openMissingFileTest();
59  unsigned openInvalidFileTest();
60  unsigned roundTripTest();
61 };
62 
63 
64 unsigned Yuma_T ::
66 {
67  TUDEF("YumaStream", "open");
68  const char testfn[] = "wioefoqwief.wiroug04tu24tgjlv";
69  std::ifstream fstr(testfn, std::ios::in);
70  TUASSERT(!fstr);
71  gnsstk::YumaStream str(testfn, std::ios::in);
72  TUASSERT(!str);
73  TURETURN();
74 }
75 
76 
77 unsigned Yuma_T ::
79 {
80  TUDEF("YumaStream", "open");
81  std::string testfn(gnsstk::getPathData() + gnsstk::getFileSep() +
82  "timeconvert_2015_200_0.exp");
83  gnsstk::YumaStream str(testfn.c_str(), std::ios::in);
84  // opening works because there's no header.
85  TUASSERT((bool)str);
87  str >> data;
88  // reading data should fail
89  TUASSERT(!str);
90  TURETURN();
91 }
92 
93 
94 unsigned Yuma_T ::
96 {
97  TUDEF("YumaData", "operator<</>>");
98  std::string testfn(gnsstk::getPathData() + gnsstk::getFileSep() +
99  "test_input_yuma377.txt");
100  std::string outfn(gnsstk::getPathTestTemp() + gnsstk::getFileSep() +
101  "test_output_yuma377.out");
102  gnsstk::YumaStream istr(testfn.c_str(), std::ios::in);
103  TUASSERT(static_cast<bool>(istr));
104  gnsstk::YumaStream ostr(outfn.c_str(), std::ios::out);
105  TUASSERT(static_cast<bool>(ostr));
107  while (istr >> data)
108  {
109  ostr << data;
110  }
111  istr.close();
112  ostr.close();
113  // We need to use df_diff externally to compare the files
114  // because of slight spacing changes as well as slight
115  // formatting differences for numbers, e.g.
116  // 5.9690475460E-03 vs
117  // 0.5969047546E-002
120  TURETURN();
121 }
122 
123 using namespace std;
124 using namespace gnsstk;
125 
126 int main( int argc, char * argv[] )
127 {
128  int errorTotal = 0;
129  Yuma_T testClass;
130 
131  errorTotal += testClass.openMissingFileTest();
132  errorTotal += testClass.openInvalidFileTest();
133  errorTotal += testClass.roundTripTest();
134 
135  cout << "Total Failures for " << __FILE__ << ": " << errorTotal << endl;
136 
137  return errorTotal;
138 }
gnsstk
For Sinex::InputHistory.
Definition: BasicFramework.cpp:50
main
int main(int argc, char *argv[])
Definition: Yuma_T.cpp:126
YumaData.hpp
TUASSERT
#define TUASSERT(EXPR)
Definition: TestUtil.hpp:63
YumaStream.hpp
TestUtil.hpp
YumaBase.hpp
TURETURN
#define TURETURN()
Definition: TestUtil.hpp:232
Yuma_T
Definition: Yuma_T.cpp:55
gnsstk::YumaData
Definition: YumaData.hpp:70
Yuma_T::openInvalidFileTest
unsigned openInvalidFileTest()
Definition: Yuma_T.cpp:78
gnsstk::YumaStream
Definition: YumaStream.hpp:65
TUDEF
#define TUDEF(CLASS, METHOD)
Definition: TestUtil.hpp:56
example3.data
data
Definition: example3.py:22
std
Definition: Angle.hpp:142
Yuma_T::roundTripTest
unsigned roundTripTest()
Definition: Yuma_T.cpp:95
Yuma_T::openMissingFileTest
unsigned openMissingFileTest()
Definition: Yuma_T.cpp:65


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