A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://www.ncbi.nlm.nih.gov/IEB/ToolBox/CPP_DOC/doxyhtml/unit__test__import_8cpp_source.html below:

NCBI C++ ToolKit: src/objtools/import/unit_test/unit_test_import.cpp Source File

55  const string

& testEntry,

59

vector<string>& commandArgs)

67

vector<string> testParts;

69  if

(testParts.empty()) {

72

inputFile = testParts[0];

73  auto

lastDot = inputFile.find_last_of(

'.'

);

74

inputFormat = inputFile.substr(lastDot + 1);

75

commandArgs.assign(testParts.begin() + 1, testParts.end());

83  const string

& testName,

84  const string

& testFormat)

87  auto

singleCase = args[

"single-case"

].AsString();

88  if

(!singleCase.empty()) {

89  return

(singleCase != testName);

91  auto

singleFormat = args[

"single-format"

].AsString();

92  if

(!singleFormat.empty()) {

93  return

(singleFormat != testFormat);

101  const string

& testName,

103  const

vector<string>& commandArgs,

104  const string

& inputName,

105  const string

& goldenNameAnnot,

106  const string

& goldenNameErrors,

107  const string

& outputNameAnnot,

108  const string

& outputNameErrors,

109  const string

& diffName,

113

cerr <<

"Running test "

<< testName <<

" ...\n"

;

116

unique_ptr<CFeatImporter> pImporter(

125

pImporter->ReadSeqAnnot(iStr, annot);

126  const auto

& annotData = annot.

GetData

();

127  if

(!annotData.IsFtable() || annotData.GetFtable().empty()) {

138  catch

(std::exception& err) {

139

BOOST_ERROR(

"Error: Test \""

<< testName <<

"\" failed during import:"

);

140

BOOST_ERROR(

" "

<< err.what());

145

msgHandler.

Dump

(oStrErrors);

153  "Error: Test \""

<< testName <<

"\" failed due to annotation diffs."

);

157  if

(!successErrors) {

159  "Error: Test \""

<< testName <<

"\" failed due to error diffs."

);

194

arg_descrs->AddDefaultKey(

196  "TEST_DATA_DIRECTORY"

,

197  "Set the root directory under which all test files can be found."

,

200

arg_descrs->AddDefaultKey(

203  "Limit to only the given case."

,

206

arg_descrs->AddDefaultKey(

208  "TEST_SINGLE_FORMAT"

,

209  "Limit to only the given format."

,

214  "Update all test cases to current reader code."

,

216

arg_descrs->AddFlag(

"keep-diffs"

,

217  "Keep output files that are different from the expected."

,

233  string dataDir

( args[

"data-dir"

].AsString() );

234  bool

updateAll = args[

"update-all"

].AsBoolean();

235  bool

keepDiffs = args[

"keep-diffs"

].AsBoolean();

237  const string

fileTestCases(

dataDir

+

"/"

+

"test-cases.txt"

);

238  const string

dirInput(

dataDir

+

"/input/"

);

239  const string

dirGolden(

dataDir

+

"/golden/"

);

240  const string

dirOutput(

dataDir

+

"/output/"

);

241  const string

dirDiffs(

dataDir

+

"/diffs/"

);

243

BOOST_REQUIRE_MESSAGE(

244  CFile

(fileTestCases).Exists(),

245  "Cannot find test data file: "

<< fileTestCases);

249  for

(

auto

oldFile: oldOutputFiles) {

255  while

(!testCaseStream.AtEOF()) {

256  auto

testDescription = *(++testCaseStream);

258  if

(testDescription.empty()) {

264  string

testName, inputFile, inputFormat;

265

vector<string> commandArgs;

266

BOOST_REQUIRE_MESSAGE(

268  "Invalid test description: \""

<< testDescription <<

"\""

);

269  if

(

sSkipTest

(args, testName, inputFormat)) {

272  auto

inFile = dirInput + inputFile;

273  auto

goldenFile = dirGolden + testName +

".asn1"

;

274  auto

errorsFile = dirGolden + testName +

".errors"

;

275  auto

outputFileAnnot = dirOutput + testName +

".asn1"

;

276  auto

outputFileErrors = dirOutput + testName +

".errors"

;

277  string

diffsFile =

""

;

279

diffsFile = dirDiffs + testName +

".diff"

;

281

BOOST_CHECK_NO_THROW(

283

testName, inputFormat, commandArgs,

284

inFile, goldenFile, errorsFile,

285

outputFileAnnot, outputFileErrors, diffsFile,

static CFeatImporter * Get(const std::string &, unsigned int, CImportMessageHandler &)

CImportError::ErrorLevel GetWorstErrorLevel() const

void Dump(CNcbiOstream &out)

static CNcbiApplication * Instance(void)

Singleton method.

Simple implementation of ILineReader for i(o)streams.

static int RunTests(void)

Code to iterate through all tests to run.

virtual const CArgs & GetArgs(void) const

Get parsed command line arguments.

@ eString

An arbitrary string.

TEntries GetEntries(const string &mask=kEmptyStr, TGetEntriesFlags flags=0) const

Get directory entries based on the specified "mask".

virtual bool Copy(const string &new_path, TCopyFlags flags=fCF_Default, size_t buf_size=0) const

Copy a file.

virtual bool Remove(TRemoveFlags flags=eRecursive) const

Remove a directory entry.

bool CompareTextContents(const string &file, ECompareText mode, size_t buf_size=0) const

Compare files contents in text form.

@ fCF_Overwrite

The following flags define what to do when the destination entry already exists:

@ fIgnoreRecursive

Suppress "self recursive" elements (the directories "." and "..").

IO_PREFIX::ofstream CNcbiOfstream

Portable alias for ofstream.

IO_PREFIX::ifstream CNcbiIfstream

Portable alias for ifstream.

static list< string > & Split(const CTempString str, const CTempString delim, list< string > &arr, TSplitFlags flags=0, vector< SIZE_TYPE > *token_pos=NULL)

Split a string using specified delimiters.

static void TruncateSpacesInPlace(string &str, ETrunc where=eTrunc_Both)

Truncate whitespace in a string (in-place)

static bool StartsWith(const CTempString str, const CTempString start, ECase use_case=eCase)

Check if a string starts with a specified prefix value.

static bool SplitInTwo(const CTempString str, const CTempString delim, string &str1, string &str2, TSplitFlags flags=0)

Split a string into two pieces using the specified delimiters.

#define NCBITEST_INIT_CMDLINE(var_name)

Macro for introducing function initializing argument descriptions for tests.

#define NCBITEST_AUTO_FINI()

Macro for introducing finalization function which will be called after actual tests execution even if...

#define NCBITEST_AUTO_INIT()

Macro for introducing initialization function which will be called before tests execution and only if...

const TData & GetData(void) const

Get the Data member data.

The blob sat and sat key Both must be positive integers</td > n< td > Non empty string The interpretation of the blob id depends on a processor Cassandra n processor expects the following format

Lightweight interface for getting lines of data with minimal memory copying.

Defines the CNcbiApplication and CAppException classes for creating NCBI applications.

Defines classes: CDirEntry, CFile, CDir, CSymLink, CMemoryFile, CFileUtil, CFileLock,...

Utility stuff for more convenient using of Boost.Test library.

bool sSkipTest(const CArgs &args, const string &testName, const string &testFormat)

void sRunTest(const string &testName, const string &format, const vector< string > &commandArgs, const string &inputName, const string &goldenNameAnnot, const string &goldenNameErrors, const string &outputNameAnnot, const string &outputNameErrors, const string &diffName, bool updateAll)

bool sGetTestParameters(const string &testEntry, string &testName, string &inputFile, string &inputFormat, vector< string > &commandArgs)

BOOST_AUTO_TEST_CASE(TestUsingArg)


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4