Ignore:
Timestamp:
Aug 21, 2008, 10:29:49 PM (15 years ago)
Author:
Peter
Message:

refs #418 - added a test for this bug. The test is not active in the sense it does not affect the retunred value, but in verbose mode there is some output.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/0.4-stable/test/commandline_test.cc

    r1392 r1431  
    149149  OptionArg<std::string> input(cmd, "i,input", "input file");
    150150  OptionArg<unsigned int> n(cmd, "n", "number of lines");
     151  OptionArg<double> x(cmd, "x", "a float number");
    151152
    152153  suite.err() << "Testing OptionArg existence -i file...";
     
    242243      ok =false;
    243244    }
     245  }
     246
     247  suite.err() << "Testing OptionArg double value -x -6...";
     248  try {
     249    int ac = 3;
     250    char* av[] = { "test_prog", "-x", "-6" };
     251    cmd.parse(ac,av);
     252    if (x.value()==-6)
     253      suite.err() << "ok\n";
     254    else {
     255      suite.err() << "failed\n";
     256      ok =false;
     257    }
     258  }
     259  catch (std::runtime_error& e) {
     260    suite.err() << "failed\nexception thrown with what(): " << e.what() << "\n";
     261    suite.err() << "Error: this is an expected error; see ticket:418\n";
    244262  }
    245263
Note: See TracChangeset for help on using the changeset viewer.