& filename) {
62 mStream.open(filename.c_str());
89 if(!err.
SeqId().empty()) {
93 if(err.
Line() == 0) {
95<<
"None (Encountered during pre or post processing)"<< endl;
103 mStream<<
"Problem : "<< codeStr <<
"."<< subCodeStr << endl;
106vector<string> messageLines;
108 if(!messageLines.empty()) {
109 mStream<<
"Message : "<< messageLines.front() << endl;
110 for(
auto i=1;
i< messageLines.size(); ++
i) {
111 mStream<<
" "<< messageLines[
i] << endl;
116 if(!qualName.empty()) {
117 mStream<<
"Mod Name : "<< qualName << endl;
121 if(!qualValue.empty()) {
122 mStream<<
"Mod Value : "<< qualValue << endl;
170 if(!dirEntry.
IsFile()) {
175 stringname =
file.GetName();
183 const stringsFileName =
file.GetName();
184vector<CTempString> vecFileNamePieces;
186BOOST_REQUIRE(vecFileNamePieces.size() == 2);
189BOOST_REQUIRE(!tsTestName.
empty());
191BOOST_REQUIRE(!tsFileType.
empty());
194(*m_pTestNameToInfoMap)[vecFileNamePieces[0]];
211BOOST_FAIL(
"Unknown file type "<< sFileName <<
".");
225 const string& testName,
233pReader->SetUseNexusInfo(
false);
240 const string& testName)
252BOOST_FAIL(
"input file "<<
input<<
" does not exist.");
254cerr <<
"Creating new test case from "<<
input<<
" ..."<< endl;
267pReader->Read(
flags, &logger);
270 catch(std::exception&) {
273cerr <<
" Produced new error listing "<<
output<<
"."<< endl;
280cerr <<
" Produced new ASN1 file "<<
output<<
"."<< endl;
281cerr <<
" ... Done."<< endl;
287 constvector<string> kEmptyStringVec;
299 const string& sName = name_to_info_it->first;
307cerr <<
"Testing "<< testInfo.
mInFile.
GetName() <<
" against "<<
317unique_ptr<CAlnReader> pReader(
sGetReader(sTestName, ifstr));
326pReader->Read(
flags, &logger);
327pEntry = pReader->GetSeqEntry(
sGetFastaFlags(sTestName), &logger);
344 if(!successOutput) {
350 if(!successErrors) {
356 if(!successOutput || !successErrors) {
357BOOST_ERROR(
"Error: "<< sTestName <<
" failed due to post processing diffs.");
370arg_descrs->AddDefaultKey(
"test-dir",
"TEST_FILE_DIRECTORY",
371 "Set the root directory under which all test files can be found.",
375arg_descrs->AddDefaultKey(
"update-case",
"UPDATE_CASE",
376 "Produce .asn and .error files from given name for new or updated test case.",
380arg_descrs->AddFlag(
"update-all",
381 "Update all test cases to current reader code (dangerous).",
384arg_descrs->AddFlag(
"keep-diffs",
385 "Keep output files that are different from the expected.",
387arg_descrs->AddDefaultKey(
"single-case",
389 "Run specified case only",
403 CDirtest_cases_dir( args[
"test-dir"].AsDirectory() );
404BOOST_REQUIRE_MESSAGE( test_cases_dir.
IsDir(),
405 "Cannot find dir: "<< test_cases_dir.
GetPath() );
407 boolupdate_all = args[
"update-all"].AsBoolean();
413 stringupdate_case = args[
"update-case"].AsString();
414 if(!update_case.empty()) {
419 stringsingle_case = args[
"single-case"].AsString();
420 if(!single_case.empty()) {
428BOOST_CHECK_NO_THROW(
429 sRunTest(single_case, testInfo, args[
"keep-diffs"]));
433 constvector<string> kEmptyStringVec;
443 const string& sName = name_to_info_it->first;
444 const STestInfo& testInfo = name_to_info_it->second;
445cout <<
"Verifying: "<< sName << endl;
455 const string& sName = name_to_info_it->first;
456 const STestInfo& testInfo = name_to_info_it->second;
457cout <<
"Running test: "<< sName << endl;
459BOOST_CHECK_NO_THROW(
sRunTest(sName, testInfo, args[
"keep-diffs"]));
class CAlnReader supports importing a large variety of text-based alignment formats into standard dat...
int TReadFlags
binary OR of EReadFlags
objects::CFastaDeflineReader::TFastaFlags TFastaFlags
bool PutError(const ILineError &err)
Store error in the container, and return true if error was stored fine, and return false if the calle...
CErrorLogger(const string &filename)
size_t Count() const override
void StoreError(const ILineError &err)
static CNcbiApplication * Instance(void)
Singleton method.
CTempString implements a light-weight string on top of a storage buffer whose lifetime management is ...
TTestNameToInfoMap * m_pTestNameToInfoMap
void operator()(const CDirEntry &dirEntry)
CTestNameToInfoMapLoader(TTestNameToInfoMap *pTestNameToInfoMap, const string &extInput, const string &extOutput, const string &extErrors)
virtual const string & QualifierName(void) const =0
virtual EDiagSev Severity(void) const
virtual string Message() const
virtual int GetCode(void) const
virtual int GetSubCode(void) const
string SeverityStr() const
virtual const string & SeqId(void) const =0
virtual unsigned int Line(void) const =0
virtual const string & QualifierValue(void) const =0
Operators to edit gaps in sequences.
static SQLCHAR output[256]
static int RunTests(void)
Code to iterate through all tests to run.
static char test_name[128]
virtual const CArgs & GetArgs(void) const
Get parsed command line arguments.
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
@ eString
An arbitrary string.
@ eDirectory
Name of file directory.
@ eDiag_Fatal
Fatal error â guarantees exit(or abort)
#define NCBI_THROW2(exception_class, err_code, message, extra)
Throw exception with extra parameter.
void FindFilesInDir(const CDir &dir, const vector< string > &masks, const vector< string > &masks_subdir, TFindFunc &find_func, TFindFiles flags=fFF_Default)
Find files in the specified directory.
virtual bool Remove(TRemoveFlags flags=eRecursive) const
Remove a directory entry.
bool IsDir(EFollowLinks follow=eFollowLinks) const
Check whether a directory entry is a directory.
bool CompareTextContents(const string &file, ECompareText mode, size_t buf_size=0) const
Compare files contents in text form.
bool IsFile(EFollowLinks follow=eFollowLinks) const
Check whether a directory entry is a file.
static string GetTmpName(ETmpFileCreationMode mode=eTmpFileGetName)
Get temporary file name.
static string ConcatPath(const string &first, const string &second)
Concatenate two parts of the path for the current OS.
string GetName(void) const
Get the base entry name with extension (if any).
const string & GetPath(void) const
Get entry path.
virtual bool Copy(const string &new_path, TCopyFlags flags=fCF_Default, size_t buf_size=0) const
Copy the entry to a location specified by "new_path".
virtual bool Exists(void) const
Check existence of file.
@ fFF_Recursive
descend into sub-dirs
@ fFF_Default
default behavior
#define ENUM_METHOD_NAME(EnumName)
#define MSerial_AsnText
I/O stream manipulators â.
@ fAddMods
Parse defline mods and add to SeqEntry.
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 SIZE_TYPE FindNoCase(const CTempString str, const CTempString pattern, SIZE_TYPE start, SIZE_TYPE end, EOccurrence which=eFirst)
Find the pattern in the specified range of a string using a case insensitive search.
static bool EndsWith(const CTempString str, const CTempString end, ECase use_case=eCase)
Check if a string ends with a specified suffix value.
bool empty(void) const
Return true if the represented string is empty (i.e., the length is zero)
static bool StartsWith(const CTempString str, const CTempString start, ECase use_case=eCase)
Check if a string starts with a specified prefix value.
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.
BOOST_AUTO_TEST_CASE(RunTests)
const string dirTestFiles("alnreader_test_cases")
const string extErrors("errors")
CAlnReader * sGetReader(const string &testName, ifstream &ifstr)
CAlnReader::TFastaFlags sGetFastaFlags(const string &testName)
void sUpdateAll(CDir &test_cases_dir)
const string extInput("aln")
const string extOutput("asn")
void sUpdateCase(CDir &test_cases_dir, const string &test_name)
const string extKeep("new")
void sRunTest(const string &sTestName, const STestInfo &testInfo, bool keep)
NCBITEST_INIT_CMDLINE(arg_descrs)
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