Ejemplo n.º 1
0
int CommandOption_T::testCommandOptionGroupAnd()
{
    TestUtil  tester( "CommandOptionGroupAnd", "Initialization", __FILE__, __LINE__ );

    defaultCommandOptionList.clear();

    try
    {
        CommandOptionGroupAnd  cmdOpt;
        tester.assert( true, "CommandOptionGroupAnd was created successfully.", __LINE__ );
        tester.assert( (cmdOpt.getCount() == 0), "CommandOptionGroupAnd count should be 0.", __LINE__ );
        tester.assert( (cmdOpt.checkArguments().size() == 0), "CommandOptionGroupAnd checkArguments() should return nothing.", __LINE__ );
        tester.assert( (defaultCommandOptionList.size() == 1), "CommandOptionGroupAnd was not added to the default list.", __LINE__ );

        try
        {
            cmdOpt.addOption(NULL);
            tester.assert( false, "CommandOptionGroupAnd()::addOption() succeeded but should have failed due to an valid option address.", __LINE__ );
        }
        catch ( ... )
        {
            tester.assert( true, "CommandOptionGroupAnd::addOption() threw an exception as expected.", __LINE__ );
        }

        try
        {
            CommandOptionWithAnyArg  cowaa('f', "foo", "Foo", false);
            cmdOpt.addOption(&cowaa);
            tester.assert( true, "CommandOptionGroupAnd()::addOption() succeeded.", __LINE__ );
        }
        catch ( ... )
        {
            tester.assert( false, "CommandOptionGroupAnd::addOption() threw an exception but should not have.", __LINE__ );
        }
    }
    catch ( ... )
    {
        tester.assert( false, "CommandOptionGroupAnd() threw an exception but should not have.", __LINE__ );
    }
    defaultCommandOptionList.clear();

    return tester.countFails();
}
Ejemplo n.º 2
0
void NavSum::additionalSetup()
{
   int option = 0;
   string line;

   if (defaultsOption.getCount() ||
       (seTimeOptions.getCount() && blockOption.getCount() &&
        prnOption.getCount()))
      return;

   while (option != 5)
   {
      cout << endl;
      printCurrentFilter();

      cout << endl
           << "Choose an option by number then push enter:" << endl
           << "\t1) Change the start time" << endl
           << "\t2) Change the end time" << endl
           << "\t3) Select specific PRNs" << endl
           << "\t4) Select specific FIC block numbers" << endl
           << "\t5) Process the file" << endl
           << "use ctrl-c to exit" << endl
           << "? ";
      
      getline(cin, line);
      istringstream optionstr(line);
      optionstr >> option;
      cout << endl;

      switch(option)
      {
         case 1:
            cout << "Entering a new start time..." << endl;
            getNewTime(startTime);
            option = 0;
            break;
         case 2:
            cout << "Entering a new end time..." << endl;
            getNewTime(endTime);
            option = 0;
            break;
         case 3:
            getSVs();
            option = 0;
            break;
         case 4:
            getFICBlocks();
            option = 0;
            break;
         case 5:
            break;
         default:
            cout << '\"' << line << "\" is an invalid option" << endl;
            option = 0;
            break;
      }

      if (startTime > endTime)
         cout << endl
              << "Please check the start and end times because all the data "
              << "will be filtered" << endl
              << "with this setting (startTime > endTime)." << endl;
   }

   cout << "processing..." << endl;
}