void CommandLineTestHelper::setInputFileContents( CommandLine *args, const char *option, const char *extension, const ConstArrayRef<const char *> &contents) { GMX_ASSERT(extension[0] != '.', "Extension should not contain a dot"); std::string fullFilename = impl_->fileManager_.getTemporaryFilePath( formatString("%d.%s", args->argc(), extension)); TextWriter file(fullFilename); ConstArrayRef<const char *>::const_iterator i; for (i = contents.begin(); i != contents.end(); ++i) { file.writeLine(*i); } file.close(); args->addOption(option, fullFilename); }
StringInputStream::StringInputStream(ConstArrayRef<const char *> const &input) : input_(joinStrings(input.begin(), input.end(), "\n")), pos_(0) { input_.append("\n"); }