( ! dirEntry.
IsFile() ) {
100 stringname =
file.GetName();
106 const stringsFileName =
file.GetName();
107vector<CTempString> vecFileNamePieces;
108 NStr::Split( sFileName,
".", vecFileNamePieces );
109BOOST_REQUIRE(vecFileNamePieces.size() == 2);
112BOOST_REQUIRE(!tsTestName.
empty());
114BOOST_REQUIRE(!tsFileType.
empty());
137BOOST_FAIL(
"Unknown file type "<< sFileName <<
".");
169 if(!mod_name.empty()) {
170mod_info.
name= mod_name;
173 if(!mod_value.empty()) {
187BOOST_FAIL(
"input file "<<
input<<
" does not exist.");
189cerr <<
"Creating new test case from "<<
input<<
" ..."<< endl;
195pSeqEntry->Parentize();
197 auto& bioseq = pSeqEntry->IsSeq() ?
198pSeqEntry->SetSeq() :
199 const_cast<CBioseq&
>(pSeqEntry->SetSet().GetNucFromNucProtSet());
203 autofReportError = [&] (
const CModData& modData,
const string&
msg,
EDiagSevsev,
intsubcode)
208pMessageListener->PutMessage(
225 for(
stringline; getline(ifstr, line);) {
228 autoit = handle_existing_map.
find(line);
229 if(it != handle_existing_map.
end()) {
231mod_handler.
AddMods(mods, handle_existing, rejected_mods, fReportError);
234handle_existing = it->second;
239mods.emplace_back(mod_info.
name, mod_info.
value);
242mod_handler.
AddMods(mods, handle_existing, rejected_mods, fReportError);
247BOOST_FAIL(
"Error: "<<
input<<
" failed during conversion.");
254cerr <<
" Produced new ASN1 file "<<
output<<
"."<< endl;
257 if(pMessageListener->Count() > 0) {
258pMessageListener->Dump(errstr);
261cerr <<
" Produced new error listing "<< errors <<
"."<< endl;
262cerr <<
" ... Done."<< endl;
267 constvector<string> kEmptyStringVec;
279 const string& sName = name_to_info_it->first;
287cerr <<
"Testing "<< testInfo.
mInFile.
GetName() <<
" and "<<
300pSeqEntry->Parentize();
302 auto& bioseq = pSeqEntry->IsSeq() ?
303pSeqEntry->SetSeq() :
304 const_cast<CBioseq&
>(pSeqEntry->SetSet().GetNucFromNucProtSet());
307 autofReportError = [&] (
const CModData& modData,
const string&
msg,
EDiagSevsev,
intsubcode)
312pMessageListener->PutMessage(
330 for(
stringline; getline(ifstr, line);) {
333 autoit = handle_existing_map.
find(line);
334 if(it != handle_existing_map.
end()) {
336mod_handler.
AddMods(mods, handle_existing, rejected_mods, fReportError);
339handle_existing = it->second;
344mods.emplace_back(mod_info.
name, mod_info.
value);
347mod_handler.
AddMods(mods, handle_existing, rejected_mods, fReportError);
351BOOST_ERROR(
"Error: "<< sTestName <<
" failed during conversion.");
356cout <<
"# skipped mods : "<< skipped_mods.size() << endl;
359 if(pMessageListener->Count() > 0) {
360pMessageListener->Dump(errstr);
376BOOST_ERROR(
"Error: "<< sTestName <<
" failed due to post processing diffs.");
388BOOST_ERROR(
"Error: "<< sTestName <<
" failed due to error handling diffs.");
399arg_descrs->AddDefaultKey(
"test-dir",
"TEST_FILE_DIRECTORY",
400 "Set the root directory under which all test files can be found.",
403arg_descrs->AddDefaultKey(
"update-case",
"UPDATE_CASE",
404 "Produce .asn and .error files from given name for new or updated test case.",
407arg_descrs->AddFlag(
"update-all",
408 "Update all test cases to current reader code (dangerous).",
410arg_descrs->AddFlag(
"keep-diffs",
411 "Keep output files that are different from the expected.",
423 CDirtest_cases_dir( args[
"test-dir"].AsDirectory() );
424BOOST_REQUIRE_MESSAGE( test_cases_dir.
IsDir(),
425 "Cannot find dir: "<< test_cases_dir.
GetPath() );
426 boolupdate_all = args[
"update-all"].AsBoolean();
432 stringupdate_case = args[
"update-case"].AsString();
433 if(!update_case.empty()) {
437 constvector<string> kEmptyStringVec;
449 const string& sName = name_to_info_it->first;
450 const STestInfo& testInfo = name_to_info_it->second;
451cout <<
"Verifying: "<< sName << endl;
460 const string& sName = name_to_info_it->first;
461 const STestInfo& testInfo = name_to_info_it->second;
463cout <<
"Running test: "<< sName << endl;
465BOOST_CHECK_NO_THROW(
sRunTest(sName, testInfo, args[
"keep-diffs"]));
static void Apply(const CModHandler &mod_handler, CBioseq &bioseq, TSkippedMods &skipped_mods, FPostMessage fPostMessage=nullptr)
list< CModData > TSkippedMods
list< CModData > TModList
void AddMods(const TModList &mods, EHandleExisting handle_existing, TModList &rejected_mods, FReportError fReportError=nullptr)
static CNcbiApplication * Instance(void)
Singleton method.
CTempString implements a light-weight string on top of a storage buffer whose lifetime management is ...
TTestNameToInfoMap & m_TestNameToInfoMap
void operator()(const CDirEntry &dirEntry)
CTestNameToInfoMapLoader(TTestNameToInfoMap &testNameToInfoMap, const string &extTemplate, const string &extInput, const string &extOutput, const string &extErrors)
const_iterator end() const
const_iterator find(const key_type &key) const
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.
EDiagSev
Severity level for the posted diagnostics.
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 MSerial_AsnText
I/O stream manipulators â.
CRef< C > Ref(C *object)
Helper functions to get CRef<> and CConstRef<> objects.
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 bool EndsWith(const CTempString str, const CTempString end, ECase use_case=eCase)
Check if a string ends with a specified suffix value.
static bool IsBlank(const CTempString str, SIZE_TYPE pos=0)
Check if a string is blank (has no text).
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.
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.
static string TruncateSpaces(const string &str, ETrunc where=eTrunc_Both)
Truncate whitespace in a string.
Defines the CNcbiApplication and CAppException classes for creating NCBI applications.
Defines classes: CDirEntry, CFile, CDir, CSymLink, CMemoryFile, CFileUtil, CFileLock,...
static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
CModHandler::EHandleExisting handle_existing
Utility stuff for more convenient using of Boost.Test library.
BOOST_AUTO_TEST_CASE(RunTests)
const string extErrors("errors")
void sUpdateAll(CDir &test_cases_dir)
map< TTestName, STestInfo > TTestNameToInfoMap
const string dirTestFiles("mod_adder_test_cases")
const string extTemplate("template")
const string extInput("mods")
const string extOutput("asn")
void sUpdateCase(CDir &test_cases_dir, const string &test_name)
static void sGetModInfo(const string &line, SModInfo &mod_info)
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