& testEntry,
59vector<string>& commandArgs)
67vector<string> testParts;
69 if(testParts.empty()) {
72inputFile = testParts[0];
73 autolastDot = inputFile.find_last_of(
'.');
74inputFormat = inputFile.substr(lastDot + 1);
75commandArgs.assign(testParts.begin() + 1, testParts.end());
83 const string& testName,
84 const string& testFormat)
87 autosingleCase = args[
"single-case"].AsString();
88 if(!singleCase.empty()) {
89 return(singleCase != testName);
91 autosingleFormat = args[
"single-format"].AsString();
92 if(!singleFormat.empty()) {
93 return(singleFormat != testFormat);
101 const string& testName,
103 constvector<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,
113cerr <<
"Running test "<< testName <<
" ...\n";
116unique_ptr<CFeatImporter> pImporter(
125pImporter->ReadSeqAnnot(iStr, annot);
126 const auto& annotData = annot.
GetData();
127 if(!annotData.IsFtable() || annotData.GetFtable().empty()) {
138 catch(std::exception& err) {
139BOOST_ERROR(
"Error: Test \""<< testName <<
"\" failed during import:");
140BOOST_ERROR(
" "<< err.what());
145msgHandler.
Dump(oStrErrors);
153 "Error: Test \""<< testName <<
"\" failed due to annotation diffs.");
157 if(!successErrors) {
159 "Error: Test \""<< testName <<
"\" failed due to error diffs.");
194arg_descrs->AddDefaultKey(
196 "TEST_DATA_DIRECTORY",
197 "Set the root directory under which all test files can be found.",
200arg_descrs->AddDefaultKey(
203 "Limit to only the given case.",
206arg_descrs->AddDefaultKey(
208 "TEST_SINGLE_FORMAT",
209 "Limit to only the given format.",
214 "Update all test cases to current reader code.",
216arg_descrs->AddFlag(
"keep-diffs",
217 "Keep output files that are different from the expected.",
233 string dataDir( args[
"data-dir"].AsString() );
234 boolupdateAll = args[
"update-all"].AsBoolean();
235 boolkeepDiffs = args[
"keep-diffs"].AsBoolean();
237 const stringfileTestCases(
dataDir+
"/"+
"test-cases.txt");
238 const stringdirInput(
dataDir+
"/input/");
239 const stringdirGolden(
dataDir+
"/golden/");
240 const stringdirOutput(
dataDir+
"/output/");
241 const stringdirDiffs(
dataDir+
"/diffs/");
243BOOST_REQUIRE_MESSAGE(
244 CFile(fileTestCases).Exists(),
245 "Cannot find test data file: "<< fileTestCases);
249 for(
autooldFile: oldOutputFiles) {
255 while(!testCaseStream.AtEOF()) {
256 autotestDescription = *(++testCaseStream);
258 if(testDescription.empty()) {
264 stringtestName, inputFile, inputFormat;
265vector<string> commandArgs;
266BOOST_REQUIRE_MESSAGE(
268 "Invalid test description: \""<< testDescription <<
"\"");
269 if(
sSkipTest(args, testName, inputFormat)) {
272 autoinFile = dirInput + inputFile;
273 autogoldenFile = dirGolden + testName +
".asn1";
274 autoerrorsFile = dirGolden + testName +
".errors";
275 autooutputFileAnnot = dirOutput + testName +
".asn1";
276 autooutputFileErrors = dirOutput + testName +
".errors";
277 stringdiffsFile =
"";
279diffsFile = dirDiffs + testName +
".diff";
281BOOST_CHECK_NO_THROW(
283testName, inputFormat, commandArgs,
284inFile, goldenFile, errorsFile,
285outputFileAnnot, 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