Ejemplo n.º 1
0
void CommandLineTestBase::testWriteHelp(ICommandLineModule *module)
{
    StringOutputStream     stream;
    CommandLineHelpContext context(&stream, eHelpOutputFormat_Console, nullptr, "test");
    context.setModuleDisplayName(formatString("%s %s", "test", module->name()));
    module->writeHelp(context);
    TestReferenceChecker   checker(rootChecker());
    checker.checkTextBlock(stream.toString(), "HelpOutput");
}
Ejemplo n.º 2
0
void
AbstractTrajectoryAnalysisModuleTestFixture::runTest(const CommandLine &args)
{
    TrajectoryAnalysisModule &module = impl_->module();
    // Skip first argument if it is the module name.
    int firstArg = (args.arg(0)[0] == '-' ? 0 : 1);
    for (int i = firstArg; i < args.argc(); ++i)
    {
        impl_->cmdline_.append(args.arg(i));
    }

    TestReferenceChecker rootChecker(impl_->data_.rootChecker());

    rootChecker.checkString(args.toString(), "CommandLine");

    if (!impl_->outputDatasets_.empty())
    {
        TestReferenceChecker               dataChecker(
                rootChecker.checkCompound("OutputData", "Data"));
        Impl::DatasetNames::const_iterator dataset;
        for (dataset = impl_->outputDatasets_.begin();
             dataset != impl_->outputDatasets_.end();
             ++dataset)
        {
            const char           *name    = dataset->c_str();
            AbstractAnalysisData &dataset = module.datasetFromName(name);
            AnalysisDataTestFixture::addReferenceCheckerModule(
                    dataChecker, name, &dataset);
        }
    }

    TrajectoryAnalysisCommandLineRunner runner(&module);
    runner.setPrintCopyright(false);
    int rc = 0;
    EXPECT_NO_THROW_GMX(rc = runner.run(impl_->cmdline_.argc(), impl_->cmdline_.argv()));
    EXPECT_EQ(0, rc);

    if (!impl_->outputFiles_.empty())
    {
        TestReferenceChecker                 outputChecker(
                rootChecker.checkCompound("OutputFiles", "Files"));
        Impl::OutputFileList::const_iterator outfile;
        for (outfile = impl_->outputFiles_.begin();
             outfile != impl_->outputFiles_.end();
             ++outfile)
        {
            std::string output = File::readToString(outfile->path);
            outputChecker.checkStringBlock(output, outfile->option.c_str());
        }
    }
}
Ejemplo n.º 3
0
void CommandLineTestBase::checkOutputFiles()
{
    impl_->helper_.checkOutputFiles(rootChecker());
}