SEM_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  *
42  * Test program to exercise SEMBase, SEMData, and SEMStream.
43  *
44 // *********************************************************************/
45 #include <iostream>
46 #include <fstream>
47 
48 #include "ReferenceFrame.hpp"
49 #include "SEMData.hpp"
50 #include "SEMStream.hpp"
51 #include "SEMHeader.hpp"
52 #include "SEMBase.hpp"
53 
54 #include "build_config.h"
55 #include "TestUtil.hpp"
56 
57 using namespace std;
58 using namespace gnsstk;
59 
60 class SEM_T
61 {
62 public:
63  unsigned openMissingFileTest();
64  unsigned openInvalidFileTest();
65  unsigned roundTripTest();
66 };
67 
68 
69 unsigned SEM_T ::
71 {
72  TUDEF("SEMStream", "open");
73  const char testfn[] = "wioefoqwief.wiroug04tu24tgjlv";
74  std::ifstream fstr(testfn, std::ios::in);
75  TUASSERT(!fstr);
76  gnsstk::SEMStream str(testfn, std::ios::in);
77  TUASSERT(!str);
78  TURETURN();
79 }
80 
81 
82 unsigned SEM_T ::
84 {
85  TUDEF("SEMStream", "open");
86  std::string testfn(gnsstk::getPathData() + gnsstk::getFileSep() +
87  "timeconvert_2015_200_0.exp");
88  gnsstk::SEMStream str(testfn.c_str(), std::ios::in);
89  TUASSERT((bool)str);
91  str >> header;
92  // reading header should fail
93  TUASSERT(!str);
94  TURETURN();
95 }
96 
97 
99 {
100  TUDEF("SEMData", "operator<<");
101  // read infn, write what should be identical output to outfn
102  string infn(getPathData() + getFileSep() + "test_input_sem387.txt");
103  string outfn(getPathTestTemp() + getFileSep() + "test_output_sem387.out");
104  SEMStream instr(infn.c_str());
105  SEMStream outstr(outfn.c_str(), ios::out);
106  SEMHeader hdr;
107  SEMData data;
108  TUASSERT(static_cast<bool>(instr));
109  TUASSERT(static_cast<bool>(outstr));
110  TUCATCH(instr >> hdr);
111  TUCATCH(outstr << hdr);
112  while (instr >> data)
113  {
114  outstr << data;
115  }
116  instr.close();
117  outstr.close();
118  TUCMPFILE(infn, outfn, 0);
119 
120  TURETURN();
121 }
122 
123 
124 
125 int main( int argc, char * argv[] )
126 {
127  unsigned errorTotal = 0;
128  SEM_T testClass;
129 
130  errorTotal += testClass.openMissingFileTest();
131  errorTotal += testClass.openInvalidFileTest();
132  errorTotal += testClass.roundTripTest();
133 
134  std::cout << "Total Failures for " << __FILE__ << ": " << errorTotal
135  << std::endl;
136 
137  return errorTotal;
138 }
example3.header
header
Definition: example3.py:22
TUCATCH
#define TUCATCH(STATEMENT)
Definition: TestUtil.hpp:193
SEM_T::openMissingFileTest
unsigned openMissingFileTest()
Definition: SEM_T.cpp:70
main
int main(int argc, char *argv[])
Definition: SEM_T.cpp:125
gnsstk::SEMStream
Definition: SEMStream.hpp:68
gnsstk::SEMData
Definition: SEMData.hpp:73
SEM_T::roundTripTest
unsigned roundTripTest()
Definition: SEM_T.cpp:98
SEMHeader.hpp
gnsstk
For Sinex::InputHistory.
Definition: BasicFramework.cpp:50
gnsstk::SEMHeader
Definition: SEMHeader.hpp:72
TUASSERT
#define TUASSERT(EXPR)
Definition: TestUtil.hpp:63
TestUtil.hpp
TURETURN
#define TURETURN()
Definition: TestUtil.hpp:232
SEM_T
Definition: SEM_T.cpp:60
SEM_T::openInvalidFileTest
unsigned openInvalidFileTest()
Definition: SEM_T.cpp:83
SEMBase.hpp
TUDEF
#define TUDEF(CLASS, METHOD)
Definition: TestUtil.hpp:56
SEMData.hpp
TUCMPFILE
#define TUCMPFILE(F1, F2, SKIP)
Definition: TestUtil.hpp:170
example3.data
data
Definition: example3.py:22
std
Definition: Angle.hpp:142
SEMStream.hpp
ReferenceFrame.hpp


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