( ! dirEntry.
IsFile() ) {
83 stringname =
file.GetName();
89 const stringsFileName =
file.GetName();
90vector<CTempString> vecFileNamePieces;
92BOOST_REQUIRE(vecFileNamePieces.size() == 2);
95BOOST_REQUIRE(!tsTestName.
empty());
97BOOST_REQUIRE(!tsFileType.
empty());
116BOOST_FAIL(
"Unknown file type "<< sFileName <<
".");
135 const char* s = line.
data() + start;
137 intnested_brackets = -1;
138 while(
i< line.
size())
144 if(nested_brackets == 0)
155 if(nested_brackets == 0)
164 if(nested_brackets < 0) {
181 while(pos < title.
size()) {
182 size_tlb_pos, end_pos, eq_pos;
186 if(eq_pos < end_pos) {
198 return!mods.
empty();
211 if(handle_existing ==
"replace") {
215 if(handle_existing ==
"preserve") {
219 if(handle_existing ==
"append-replace") {
223 if(handle_existing ==
"append-preserve") {
238vector<string> info_vec;
241 if(info_vec.size() < 2) {
246mod_info.
name= info_vec[0];
248 if(info_vec.size() == 3) {
249mod_info.
value= info_vec[1];
254 if(info_vec.size() == 2) {
262cerr <<
"Testing "<< testInfo.
mInFile.
GetName() <<
" against "<<
274 for(
stringline; getline(ifstr, line);) {
277mod_handler.AddMod(mod_info.
name,
283 for(
automod_entry : mod_handler.GetNormalizedMods()) {
284 for(
const auto& value_attrib : mod_entry.second) {
285ofstr << mod_entry.first <<
" "<< value_attrib.GetValue() << endl;
293BOOST_ERROR(
"Error: "<< sTestName <<
" failed during conversion.");
310BOOST_ERROR(
"Error: "<< sTestName <<
" failed due to post processing diffs.");
323arg_descrs->AddDefaultKey(
"test-dir",
"TEST_FILE_DIRECTORY",
324 "Set the root directory under which all test files can be found.",
327arg_descrs->AddDefaultKey(
"update-case",
"UPDATE_CASE",
328 "Produce .asn and .error files from given name for new or updated test case.",
331arg_descrs->AddFlag(
"update-all",
332 "Update all test cases to current reader code (dangerous).",
334arg_descrs->AddFlag(
"keep-diffs",
335 "Keep output files that are different from the expected.",
349 CDirtest_cases_dir( args[
"test-dir"].AsDirectory() );
350BOOST_REQUIRE_MESSAGE( test_cases_dir.
IsDir(),
351 "Cannot find dir: "<< test_cases_dir.
GetPath() );
353 boolupdate_all = args[
"update-all"].AsBoolean();
359 stringupdate_case = args[
"update-case"].AsString();
360 if(!update_case.empty()) {
365 constvector<string> kEmptyStringVec;
377 const string& sName = name_to_info_it->first;
378 const STestInfo& testInfo = name_to_info_it->second;
379cout <<
"Verifying: "<< sName << endl;
388 const string& sName = name_to_info_it->first;
389 const STestInfo& testInfo = name_to_info_it->second;
391cout <<
"Running test: "<< sName << endl;
393BOOST_CHECK_NO_THROW(
sRunTest(sName, testInfo, args[
"keep-diffs"]));
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
CTestNameToInfoMapLoader(TTestNameToInfoMap &testNameToInfoMap, const string &extInput, const string &extOutput, const string &extErrors)
void operator()(const CDirEntry &dirEntry)
static int RunTests(void)
Code to iterate through all tests to run.
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.
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.
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
IO_PREFIX::ofstream CNcbiOfstream
Portable alias for ofstream.
IO_PREFIX::ifstream CNcbiIfstream
Portable alias for ifstream.
static CTempString TruncateSpaces_Unsafe(const CTempString str, ETrunc where=eTrunc_Both)
Truncate whitespace in a string.
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).
const char * data(void) const
Return a pointer to the array represented.
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.
CTempString substr(size_type pos) const
Obtain a substring from this string, beginning at a given offset.
size_type size(void) const
Return the length of the represented array.
static const size_type npos
@ fSplit_Tokenize
All delimiters are merged and trimmed, to get non-empty tokens only.
const struct ncbi::grid::netcache::search::fields::KEY key
const GenericPointer< typename T::ValueType > T2 value
Defines the CNcbiApplication and CAppException classes for creating NCBI applications.
Defines classes: CDirEntry, CFile, CDir, CSymLink, CMemoryFile, CFileUtil, CFileLock,...
CModHandler::EHandleExisting handle_existing
Utility stuff for more convenient using of Boost.Test library.
BOOST_AUTO_TEST_CASE(RunTests)
static CModHandler::EHandleExisting sGetHandleExisting(const string &handle_existing)
const string extErrors("errors")
const string extOutput("output")
static bool sFindBrackets(const CTempString &line, size_t &start, size_t &stop, size_t &eq_pos)
static void sGetModInfo(const string &line, SModInfo &mod_info)
const string dirTestFiles("mod_handler_test_cases")
const string extInput("input")
static bool sGetMods(const CTempString &title, multimap< string, string > &mods)
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