CommandOptionWithCommonTimeArg_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 
40 #include "CommandOptionParser.hpp"
41 #include "YDSTime.hpp"
42 #include "TestUtil.hpp"
43 #include <iostream>
44 
45 using namespace std;
46 using namespace gnsstk;
47 
49 {
50 public:
53 
54  int testInitialization();
55 };
56 
57 
59 {
60  TestUtil tester( "CommandOptionWithCommonTimeArg", "Initialization", __FILE__, __LINE__ );
61 
62  CommandOptionVec testCmdOptVec;
63 
65 
66  try // Unset parameterss
67  {
68  CommandOptionWithCommonTimeArg cmdOpt(0, "", "", "", false);
69  tester.assert( false, "CommandOptionWithDecimalArg creation should have failed due to missing short and long options.", __LINE__ );
70  }
71  catch ( ... )
72  {
73  tester.assert( true, "CommandOptionWithDecimalArg() threw an exception as expected.", __LINE__ );
74  }
75 
77 
78  try
79  {
80  CommandOptionWithCommonTimeArg cmdOpt('t', "time", "%Y %j %s", "Time", false);
81  tester.assert( true, "CommandOptionWithCommonTimeArg was created successfully.", __LINE__ );
82  tester.assert( (cmdOpt.getCount() == 0), "CommandOptionWithCommonTimeArg count should be 0.", __LINE__ );
83  tester.assert( (cmdOpt.getValue().size() == 0), "CommandOptionWithCommonTimeArg value size should be 0.", __LINE__ );
84  tester.assert( (cmdOpt.getOrder() == 0), "CommandOptionWithCommonTimeArg order should be 0.", __LINE__ );
85  tester.assert( (cmdOpt.checkArguments().size() == 0), "CommandOptionWithCommonTimeArg checkArguments() should return nothing.", __LINE__ );
86  tester.assert( (defaultCommandOptionList.size() == 1), "CommandOptionWithCommonTimeArg was not added to the default list.", __LINE__ );
87  }
88  catch ( ... )
89  {
90  tester.assert( false, "CommandOptionWithCommonTimeArg() threw an exception but should not have.", __LINE__ );
91  }
92 
94 
95  return tester.countFails();
96 }
97 
98 
103 int main(int argc, char *argv[])
104 {
105  int errorTotal = 0;
106 
108 
109  errorTotal += testClass.testInitialization();
110 
111  std::cout << "Total Failures for " << __FILE__ << ": " << errorTotal << std::endl;
112 
113  return( errorTotal );
114 
115 } // main()
YDSTime.hpp
gnsstk::TestUtil::countFails
int countFails(void)
Definition: TestUtil.hpp:771
gnsstk::TestUtil::assert
void assert(bool testExpression, const std::string &testMsg, const int lineNumber)
Definition: TestUtil.hpp:607
gnsstk::defaultCommandOptionList
CommandOptionVec defaultCommandOptionList
Definition: CommandOption.cpp:55
gnsstk::CommandOption::getOrder
unsigned long getOrder(unsigned long idx=-1) const
Definition: CommandOption.cpp:158
gnsstk::CommandOption::getCount
virtual unsigned long getCount() const
Definition: CommandOption.hpp:188
CommandOptionParser.hpp
CommandOptionWithCommonTimeArg_T::CommandOptionWithCommonTimeArg_T
CommandOptionWithCommonTimeArg_T()
Definition: CommandOptionWithCommonTimeArg_T.cpp:51
gnsstk
For Sinex::InputHistory.
Definition: BasicFramework.cpp:50
CommandOptionWithCommonTimeArg_T
Definition: CommandOptionWithCommonTimeArg_T.cpp:48
main
int main(int argc, char *argv[])
Definition: CommandOptionWithCommonTimeArg_T.cpp:103
TestUtil.hpp
gnsstk::CommandOptionVec
std::vector< CommandOption * > CommandOptionVec
Definition: CommandOption.hpp:66
gnsstk::CommandOptionWithCommonTimeArg::checkArguments
virtual std::string checkArguments()
Validate arguments passed using this option (and store them).
Definition: CommandOptionWithCommonTimeArg.cpp:52
CommandOptionWithCommonTimeArg_T::testInitialization
int testInitialization()
Definition: CommandOptionWithCommonTimeArg_T.cpp:58
CommandOptionWithCommonTimeArg.hpp
std
Definition: Angle.hpp:142
gnsstk::CommandOption::getValue
const std::vector< std::string > & getValue() const
Definition: CommandOption.hpp:194
CommandOptionWithCommonTimeArg_T::~CommandOptionWithCommonTimeArg_T
~CommandOptionWithCommonTimeArg_T()
Definition: CommandOptionWithCommonTimeArg_T.cpp:52
gnsstk::CommandOptionWithCommonTimeArg
Definition: CommandOptionWithCommonTimeArg.hpp:62
gnsstk::TestUtil
Definition: TestUtil.hpp:265


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