NCBI C++ ToolKit
unit_test_agp_converter.cpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: unit_test_agp_converter.cpp 99483 2023-04-04 17:43:43Z stakhovv $
2 * ===========================================================================
3 *
4 * PUBLIC DOMAIN NOTICE
5 * National Center for Biotechnology Information
6 *
7 * This software/database is a "United States Government Work" under the
8 * terms of the United States Copyright Act. It was written as part of
9 * the author's official duties as a United States Government employee and
10 * thus cannot be copyrighted. This software/database is freely available
11 * to the public for use. The National Library of Medicine and the U.S.
12 * Government have not placed any restriction on its use or reproduction.
13 *
14 * Although all reasonable efforts have been taken to ensure the accuracy
15 * and reliability of the software and data, the NLM and the U.S.
16 * Government do not and cannot warrant the performance or results that
17 * may be obtained by using this software or data. The NLM and the U.S.
18 * Government disclaim all warranties, express or implied, including
19 * warranties of performance, merchantability or fitness for any particular
20 * purpose.
21 *
22 * Please cite the author in any work or product based on this material.
23 *
24 * ===========================================================================
25 *
26 * Author: Michael Kornbluh, based on template by Pavel Ivanov, NCBI
27 *
28 * File Description:
29 * Unit test functions in agpconvert.cpp (the library, not the app which shares its name)
30 *
31 *
32 * ===========================================================================
33 */
34 
35 #include <ncbi_pch.hpp>
36 
37 #include <corelib/ncbiapp.hpp>
38 #include <corelib/ncbifile.hpp>
39 #include <corelib/ncbi_system.hpp>
40 #include <corelib/rwstream.hpp>
41 #include <corelib/stream_utils.hpp>
44 #include <objmgr/scope.hpp>
45 #include <objmgr/bioseq_ci.hpp>
46 #include <objmgr/seqdesc_ci.hpp>
49 #include <map>
50 
51 // This header must be included before all Boost.Test headers if there are any
52 #include <corelib/test_boost.hpp>
53 
54 #include <serial/objistrasn.hpp>
55 
57 
59 USING_SCOPE(unit_test_util);
60 
61 namespace {
62 
63  bool s_InVerboseMode(void) {
64  return CNcbiApplication::Instance()->GetArgs()["v"];
65  }
66 
67  typedef pair<CAgpConverter::EError,string> TErrInfo;
68  typedef vector<TErrInfo> TErrInfoVec;
69 
70  class CErrorCollector : public CAgpConverter::CErrorHandler
71  {
72  public:
73  virtual ~CErrorCollector() { }
74  virtual void HandleError(CAgpConverter::EError eError, const string & sMessage ) const {
75  m_errInfoVec.push_back(make_pair(eError, sMessage));
76  }
77 
78  typedef pair<CAgpConverter::EError,string> TErrInfo;
79  typedef vector<TErrInfo> TErrInfoVec;
80 
81  const TErrInfoVec & GetErrInfoVec(void) const { return m_errInfoVec; }
82 
83  private:
84  mutable TErrInfoVec m_errInfoVec;
85  };
86 
87  string s_NormalizeErrorString( const string & sErrMsg )
88  {
89  // build answer here
90  string sAnswer;
91  ITERATE(string, ch_iter, sAnswer) {
92  const char ch = *ch_iter;
93  if( isspace(ch) ) {
94  // all whitespace becomes ' '
95  sAnswer += ' ';
96  } else if( isalpha(ch) ) {
97  sAnswer += tolower(ch);
98  } else {
99  // ignore all other characters
100  }
101  }
102 
104  return sAnswer;
105  }
106 
107  template<class TClass>
108  CRef<TClass> s_Asn1TextToClass(const char *pchAsn1Text)
109  {
110  CRef<TClass> pAnswer( new TClass );
111 
112  string sAsn1Text(pchAsn1Text);
113  CStringReader sAsn1TextReader(sAsn1Text);
114  CRStream rstrm(&sAsn1TextReader);
115  rstrm >> MSerial_AsnText >> *pAnswer;
116  return pAnswer;
117  }
118 
119  template<class TClass>
120  CRef<TClass> s_Asn1TextFileToClass(const CFile & aFile )
121  {
122  CRef<TClass> pAnswer( new TClass );
123 
124  CNcbiIfstream ifstrm( aFile.GetPath().c_str() );
125  ifstrm >> MSerial_AsnText >> *pAnswer;
126  return pAnswer;
127  }
128 
129  string s_ErrInfoToStr(const TErrInfo *pErrInfo)
130  {
131  if( ! pErrInfo ) {
132  return "(NO-ERROR)";
133  }
134 
135  string sAnswer;
136  sAnswer += '(';
137  sAnswer += NStr::NumericToString(static_cast<int>(pErrInfo->first));
138  sAnswer += ',';
139  sAnswer += pErrInfo->second;
140  sAnswer += ')';
141 
142  return sAnswer;
143  }
144 
145  // This function is needed because the create and update date
146  // are set to *now*, so they're time dependent so we have to
147  // set them to the same value in both the expected and the
148  // resulting CBioseq-set's.
149  void s_UpdateCreateAndUpdateDate(CBioseq_set & bioseq_set)
150  {
151  // single-threaded, so don't worry about locks
152  static CRef<CDate> s_pTodaysDate;
153  if( ! s_pTodaysDate ) {
154  s_pTodaysDate.Reset(
157  }
158 
159  for (CTypeIterator<CSeqdesc> desc_it(Begin(bioseq_set)); desc_it; ++desc_it ) {
160  CSeqdesc & desc = *desc_it;
161  if( desc.IsCreate_date() ) {
162  desc.SetCreate_date(*s_pTodaysDate);
163  } else if( desc.IsUpdate_date() ) {
164  desc.SetUpdate_date( *s_pTodaysDate );
165  }
166  }
167  }
168 
169  CRef<CSerialObject> s_RunTests(
170  CConstRef<CBioseq> pTemplateBioseq,
171  CConstRef<CSubmit_block> pSubmitBlock, // can be NULL
172  CAgpConverter::TOutputFlags fOutputFlags,
173  const vector<string> & vecAgpFileNames,
174  const TErrInfoVec & expectedErrInfoVec
175  )
176  {
177  CRef<CErrorCollector> pErrorCollector( new CErrorCollector );
178  CRef<CAgpConverter::CErrorHandler> pErrorHandler( pErrorCollector.GetPointer() );
179  CAgpConverter agpConvert(
180  pTemplateBioseq,
181  pSubmitBlock.GetPointerOrNull(),
182  fOutputFlags,
183  pErrorHandler );
184 
185  stringstream ostrm;
186  agpConvert.OutputBioseqs(
187  ostrm,
188  vecAgpFileNames,
190 
191  if( s_InVerboseMode() ) {
192  cerr << "OutputBioseqs output: " << ostrm.str() << endl;
193  }
194 
195  // check for unexpected errors
196  const TErrInfoVec & resultingErrInfoVec = pErrorCollector->GetErrInfoVec();
197  const size_t highest_err_idx =
198  max(expectedErrInfoVec.size(),
199  resultingErrInfoVec.size());
200  for( size_t err_idx = 0; err_idx < highest_err_idx; ++err_idx ) {
201  const TErrInfo * pExpectedErrInfo =
202  ( (err_idx < expectedErrInfoVec.size()) ?
203  &expectedErrInfoVec[err_idx] :
204  nullptr );
205  const TErrInfo * pResultingErrInfo =
206  ( (err_idx < resultingErrInfoVec.size()) ?
207  &resultingErrInfoVec[err_idx] :
208  nullptr );
209  // skip this iteration if they match
210  if( pExpectedErrInfo && pResultingErrInfo &&
211  pExpectedErrInfo->first == pResultingErrInfo->first &&
212  s_NormalizeErrorString(pResultingErrInfo->second) ==
213  s_NormalizeErrorString(pExpectedErrInfo->second) )
214  {
215  continue;
216  }
217 
218  // otherwise, print out what we have
219  BOOST_ERROR("At index " << err_idx << ", expected error was: "
220  << s_ErrInfoToStr(pExpectedErrInfo) << ", but got: "
221  << s_ErrInfoToStr(pResultingErrInfo) );
222  }
223 
224  CRef<CSerialObject> pAnswer;
225  if( pSubmitBlock ) {
226  pAnswer.Reset( new CSeq_submit );
227  } else {
228  pAnswer.Reset( new CBioseq_set );
229  }
230  BOOST_CHECK_NO_THROW( ostrm >> MSerial_AsnText >> *pAnswer );
231  if( ! pAnswer ) {
232  BOOST_ERROR("Could not parse this answer: " << ostrm.str() );
233  }
234  return pAnswer;
235  }
236 
237  // wrapper for one AGP file
238  CRef<CSerialObject> s_RunTests(
239  CConstRef<CBioseq> pTemplateBioseq,
240  CConstRef<CSubmit_block> pSubmitBlock, // can be NULL
241  CAgpConverter::TOutputFlags fOutputFlags,
242  const string & vecAgpFileName,
243  const TErrInfoVec & expectedErrInfoVec = TErrInfoVec() // usually we expect no errors
244  )
245  {
246  vector<string> vecAgpFileNames;
247  vecAgpFileNames.push_back(vecAgpFileName);
248  return s_RunTests(
249  pTemplateBioseq,
250  pSubmitBlock,
251  fOutputFlags,
252  vecAgpFileNames,
253  expectedErrInfoVec );
254  }
255 
256  // use this as a sort of ostream operator
257  // that prints CConstRef of CSerialObjects (but with
258  // the ability to handle NULL by printing "(NULL)")
259  struct SSerialObjectPtrToAsnText {
260  SSerialObjectPtrToAsnText(
261  const CSerialObject * pObject )
262  : m_pObject(pObject) { }
263 
264  const CSerialObject * m_pObject;
265  };
266  ostream & operator<<(ostream & ostrm,
267  const SSerialObjectPtrToAsnText & stream_op )
268  {
269  if( stream_op.m_pObject ) {
270  BOOST_CHECK_NO_THROW( ostrm << MSerial_AsnText << *stream_op.m_pObject );
271  return ostrm;
272  } else {
273  return ostrm << "(NULL)";
274  }
275  }
276 }
277 
279 {
280  descrs->AddDefaultKey(
281  "test-cases-dir",
282  "DIRECTORY",
283  "Use this to change the directory where test cases are sought.",
285  "agp_converter_test_cases");
286 
287  descrs->AddFlag("v",
288  "Set this to print a lot of extra data to help with debugging.");
289 }
290 
292 {
293  const CArgs & args = CNcbiApplication::Instance()->GetArgs();
294 
295  class CAgpConverterTestRunner : public unit_test_util::ITestRunner
296  {
297  public:
298  virtual void RunTest(
299  const string & sTestName,
300  const TMapSuffixToFile & mapSuffixToFile )
301  {
302  BOOST_TEST_MESSAGE("Starting test: " << sTestName);
303 
304  CRef<CBioseq> pTemplateBioseq =
305  s_Asn1TextFileToClass<CBioseq>(mapSuffixToFile.find("template.asn")->second);
306 
307  TMapSuffixToFile::const_iterator submit_block_find_iter =
308  mapSuffixToFile.find("submit_block.asn");
309  CRef<CSubmit_block> pSubmitBlock;
310  if( submit_block_find_iter != mapSuffixToFile.end() ) {
311  pSubmitBlock = s_Asn1TextFileToClass<CSubmit_block>(submit_block_find_iter->second);
312  }
313 
314  TMapSuffixToFile::const_iterator flags_find_iter =
315  mapSuffixToFile.find("flags.txt");
316  CAgpConverter::TOutputFlags fOutputFlags = 0;
317  if( flags_find_iter != mapSuffixToFile.end() ) {
318  CNcbiIfstream flags_istrm( flags_find_iter->second.GetPath().c_str() );
319  while( flags_istrm ) {
320  string sFlagName;
321  NcbiGetlineEOL(flags_istrm, sFlagName);
322  NStr::TruncateSpacesInPlace(sFlagName);
323  if( sFlagName.empty() ) {
324  continue;
325  }
326 
327 
328  fOutputFlags |= CAgpConverter::OutputFlagStringToEnum(sFlagName);
329  }
330  }
331 
332  const CFile agpFile = mapSuffixToFile.find("agp")->second;
333 
334  TMapSuffixToFile::const_iterator expected_errors_find_iter =
335  mapSuffixToFile.find("expected_errors.txt");
336  TErrInfoVec errInfoVec;
337  if( expected_errors_find_iter != mapSuffixToFile.end() ) {
338  CNcbiIfstream exp_errs_istrm(
339  expected_errors_find_iter->second.GetPath().c_str() );
340  // each line is the error type then tab, then error message
341  string sLine;
342  while( NcbiGetlineEOL(exp_errs_istrm, sLine) ) {
344  if( sLine.empty() ) {
345  continue;
346  }
347 
348  string sErrEnum;
349  string sErrMsg;
350  NStr::SplitInTwo(sLine, "\t", sErrEnum, sErrMsg);
351 
352  CAgpConverter::EError eErrEnum =
354 
355  errInfoVec.push_back( TErrInfo(eErrEnum, sErrMsg) );
356  }
357  }
358 
359  CRef<CBioseq_set> pExpectedBioseqSetAnswer;
360  BOOST_CHECK_NO_THROW(
361  pExpectedBioseqSetAnswer =
362  s_Asn1TextFileToClass<CBioseq_set>(
363  mapSuffixToFile.find("expected_bioseq_set.asn")->second ) );
364  if( pExpectedBioseqSetAnswer ) {
365  s_UpdateCreateAndUpdateDate(*pExpectedBioseqSetAnswer);
366  } else {
367  BOOST_ERROR( "could not parse this file: "
368  << mapSuffixToFile.find("expected_bioseq_set.asn")->second.GetPath() );
369  }
370 
371  CRef<CSerialObject> pAnswer =
372  s_RunTests(
373  pTemplateBioseq,
374  pSubmitBlock,
375  fOutputFlags,
376  agpFile.GetPath(),
377  errInfoVec );
378 
379  // extract the Bioseq-set inside pAnswer, if possible
380  CRef<CBioseq_set> pBioseqSetAnswer;
381  if( pAnswer ) {
382  if( pAnswer->GetThisTypeInfo() == CBioseq_set::GetTypeInfo() ) {
383  pBioseqSetAnswer.Reset(
384  dynamic_cast<CBioseq_set*>(pAnswer.GetPointer()) );
385  } else if( pAnswer->GetThisTypeInfo() == CSeq_submit::GetTypeInfo() ) {
386  CRef<CSeq_submit> pSeqSubmit(
387  dynamic_cast<CSeq_submit*>(pAnswer.GetPointer()) );
388  if( pSeqSubmit->IsEntrys() ) {
389  BOOST_CHECK_NO_THROW(
390  pBioseqSetAnswer.Reset(
391  dynamic_cast<CBioseq_set*>(
392  &pSeqSubmit->SetData().SetEntrys().front()->SetSet() ) ) );
393  }
394  } else {
395  BOOST_ERROR( "Cannot figure out type of s_RunTests response" );
396  NCBITEST_CHECK_MESSAGE( false, "Best guess for type: "
397  << pAnswer->GetThisTypeInfo()->GetName() );
398  }
399  }
400 
401  if( pBioseqSetAnswer ) {
402  s_UpdateCreateAndUpdateDate(*pBioseqSetAnswer);
403  }
404 
405  if( ! pBioseqSetAnswer ||
406  ! pExpectedBioseqSetAnswer ||
407  ! pBioseqSetAnswer->Equals(*pExpectedBioseqSetAnswer) )
408  {
409  BOOST_ERROR("Result does not match expected. Expected: " << Endl()
410  << SSerialObjectPtrToAsnText(pExpectedBioseqSetAnswer) << Endl()
411  << "But got: " << Endl()
412  << SSerialObjectPtrToAsnText(pBioseqSetAnswer) );
413  }
414  }
415 
416  virtual void OnError(const string & sErrorText) {
417  BOOST_ERROR(sErrorText);
418  }
419  };
420  CAgpConverterTestRunner testRunner;
421 
422  set<string> requiredSuffixes;
423  requiredSuffixes.insert("template.asn");
424  requiredSuffixes.insert("expected_bioseq_set.asn");
425  requiredSuffixes.insert("agp");
426 
427  set<string> optionalSuffixes;
428  optionalSuffixes.insert("submit_block.asn");
429  optionalSuffixes.insert("flags.txt");
430  optionalSuffixes.insert("expected_errors.txt");
431 
433  &testRunner,
434  args["test-cases-dir"].AsDirectory(),
435  requiredSuffixes,
436  optionalSuffixes );
437 }
438 
439 // Do a very basic smoke test of every combination of
440 // OutputBioseqs flags and other important factors
441 // and just see if it generates something
442 // that can be parsed
443 BOOST_AUTO_TEST_CASE(OutputBioseqsFlagTest)
444 {
445  const CArgs & args = CNcbiApplication::Instance()->GetArgs();
446 
447  // prepare some objects
448  CRef<CBioseq> pTemplateBioseq( SerialClone(unit_test_util::BuildGoodSeq()->GetSeq()) );
449  CRef<CSubmit_block> pSubmitBlock( new CSubmit_block );
450  {{
451  string sSubmitBlockFileName =
453  args["test-cases-dir"].AsString(), "basic_test_with_submit_block_ignored.submit_block.asn");
454  CNcbiIfstream submit_block_strm( sSubmitBlockFileName.c_str() );
455  submit_block_strm >> MSerial_AsnText >> *pSubmitBlock;
456  }}
457 
458  // both must have size two
459  vector<string> arrSingleBioseqAGPFileBases;
460  arrSingleBioseqAGPFileBases.push_back("basic_test.agp");
461  arrSingleBioseqAGPFileBases.push_back("basic_test_with_submit_block_ignored.agp");
462 
463  vector<string> arrMultiBioseqAGPFileBases;
464  arrMultiBioseqAGPFileBases.push_back("multi_obj.agp");
465  arrMultiBioseqAGPFileBases.push_back("multi_obj_2.agp");
466 
467  // this vector holds all the CTypeInfo that we can try
468  typedef vector<const CTypeInfo*> TTypeInfoVec;
469  TTypeInfoVec vecTypeInfos;
470  vecTypeInfos.push_back( CSeq_submit::GetTypeInfo() );
471  vecTypeInfos.push_back( CSeq_entry::GetTypeInfo() );
472  vecTypeInfos.push_back( CBioseq_set::GetTypeInfo() );
473  vecTypeInfos.push_back( CBioseq::GetTypeInfo() );
474  // ends with NULL
475  vecTypeInfos.push_back(nullptr);
476 
477  // try every combination of each flag
478  // (conveniently, that's just every non-negative
479  // integer up to, but not including, fOutputBioseqsFlags_LAST_PLUS_ONE)
480  for( CAgpConverter::TOutputBioseqsFlags fOutputBioseqsFlags = 0;
482  ++fOutputBioseqsFlags )
483  {
484  ITERATE_BOTH_BOOL_VALUES(bUseSubmitBlock) {
485 
486  CAgpConverter agpConverter(
487  pTemplateBioseq,
488  ( bUseSubmitBlock ? pSubmitBlock.GetPointer() : nullptr ) );
489 
490  ITERATE_BOTH_BOOL_VALUES(bMultipleBioseqsPerAGPFile) {
491 
492  const vector<string> & refPossibleAGPFileBases = (
493  bMultipleBioseqsPerAGPFile ?
494  arrMultiBioseqAGPFileBases :
495  arrSingleBioseqAGPFileBases );
496 
497  vector<string> refPossibleAGPFiles;
498  ITERATE(vector<string>, file_base_it, refPossibleAGPFileBases ) {
499  refPossibleAGPFiles.push_back(
501  args["test-cases-dir"].AsString(), *file_base_it ) );
502  }
503 
504  ITERATE_BOTH_BOOL_VALUES(bMultipleAGPFiles) {
505 
506  vector<string> vecAgpFileNames;
507  vecAgpFileNames.push_back( refPossibleAGPFiles[0] );
508  if( bMultipleAGPFiles ) {
509  vecAgpFileNames.push_back( refPossibleAGPFiles[1] );
510  }
511 
512  cout << "Testing with these settings:" << endl;
513  cout << "\tflags: " << fOutputBioseqsFlags << endl;
514  cout << "\tSubmit-block: " << NStr::BoolToString(bUseSubmitBlock) << endl;
515  cout << "\tbMultipleBioseqsPerAGPFile: "
516  << NStr::BoolToString(bMultipleBioseqsPerAGPFile) << endl;
517  cout << "\tbMultipleAGPFiles: " <<
518  NStr::BoolToString(bMultipleAGPFiles) << endl;
519 
520  // run a test
521  stringstream obj_strm;
522  agpConverter.OutputBioseqs(
523  obj_strm,
524  vecAgpFileNames,
525  fOutputBioseqsFlags );
526 
527  if( s_InVerboseMode() ) {
528  cerr << "agpConverter.OutputBioseqs output: "
529  << obj_strm.str() << endl;
530  }
531 
532  // obj_strm should be one or more valid ASN.1 text objects
533  CObjectIStreamAsn obj_reader(obj_strm);
534  BOOST_CHECK( ! obj_reader.EndOfData() ); // there should be at least one object
535  while( ! obj_reader.EndOfData() ) {
536  string sFileHeader;
537  BOOST_CHECK_NO_THROW( sFileHeader = obj_reader.ReadFileHeader() );
538 
539  // find out which type it is
540  ITERATE( TTypeInfoVec, type_info_it, vecTypeInfos ) {
541  const CTypeInfo *pTypeInfo = *type_info_it;
542 
543  if( ! pTypeInfo ) {
544  // we reached the end without finding a suitable type
545  BOOST_ERROR("Unknown object type or corrupted file: " << ( sFileHeader.empty() ? kEmptyStr : sFileHeader ) );
546  } else if( sFileHeader == pTypeInfo->GetName() ) {
547  // we figured out what type this is.
548  // read _and_ write the object to make sure it's valid
549  CRef<CSerialObject> pObject( static_cast<CSerialObject*>(pTypeInfo->Create()) );
550  BOOST_CHECK_NO_THROW(obj_reader.ReadObject(pObject.GetPointer(), pObject->GetThisTypeInfo()));
551  stringstream dummy_ostrm;
552  BOOST_CHECK_NO_THROW( dummy_ostrm << MSerial_AsnText << *pObject );
553  break;
554  }
555  }
556  }
557  }
558  }
559  }
560  }
561 }
562 
Subclass this to override how errors are handled (example: to stop early on some kinds of errors)
virtual void HandleError(EError, const string &sMessage) const
Default is to print to cerr, but feel free to override in a subclass.
void OutputBioseqs(CNcbiOstream &ostrm, const std::vector< std::string > &vecAgpFileNames, TOutputBioseqsFlags fFlags=0, size_t uMaxBioseqsToWrite=std::numeric_limits< size_t >::max()) const
Outputs the result from the AGP file names as ASN.1.
@ fOutputBioseqsFlags_LAST_PLUS_ONE
@ fOutputBioseqsFlags_DoNOTUnwrapSingularBioseqSets
Specify this if Bioseq-sets with just one Bioseq in them should _NOT_ be unwrapped into a Bioseq.
EError
The different kinds of errors that could occur while processing.
static TOutputFlags OutputFlagStringToEnum(const string &sEnumAsString)
Convert string to flag.
int TOutputFlags
Bitwise-OR of EOutputFlags.
static EError ErrorStringToEnum(const string &sEnumAsString)
Convert string to EError enum.
CArgs –.
Definition: ncbiargs.hpp:379
Definition: Date.hpp:53
@ ePrecision_day
Definition: Date.hpp:58
CFile –.
Definition: ncbifile.hpp:1604
static CNcbiApplication * Instance(void)
Singleton method.
Definition: ncbiapp.cpp:264
CObjectIStreamAsn –.
Definition: objistrasn.hpp:54
Note about the "buf_size" parameter for streams in this API.
Definition: rwstream.hpp:122
CRef –.
Definition: ncbiobj.hpp:618
bool IsEntrys(void) const
Definition: Seq_submit.cpp:54
Base class for all serializable objects.
Definition: serialbase.hpp:150
string-based IReader
CSubmit_block –.
CTime –.
Definition: ncbitime.hpp:296
CTypeInfo class contains all information about C++ types (both basic and classes): members and layout...
Definition: typeinfo.hpp:76
Template class for iteration on objects of class C.
Definition: iterator.hpp:673
iterator_bool insert(const value_type &val)
Definition: set.hpp:149
CNcbiOstream & operator<<(CNcbiOstream &out, const CEquivRange &range)
Definition: equiv_range.cpp:96
virtual const CArgs & GetArgs(void) const
Get parsed command line arguments.
Definition: ncbiapp.cpp:305
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
Definition: ncbimisc.hpp:815
#define ITERATE_BOTH_BOOL_VALUES(BoolVar)
The body of the loop will be run with Var equal to false and then true.
Definition: ncbimisc.hpp:861
@ eDirectory
Name of file directory.
Definition: ncbiargs.hpp:598
static string ConcatPath(const string &first, const string &second)
Concatenate two parts of the path for the current OS.
Definition: ncbifile.cpp:776
const string & GetPath(void) const
Get entry path.
Definition: ncbifile.hpp:3910
virtual const CTypeInfo * GetThisTypeInfo(void) const =0
C * SerialClone(const C &src)
Create on heap a clone of the source object.
Definition: serialbase.hpp:512
#define MSerial_AsnText
I/O stream manipulators –.
Definition: serialbase.hpp:696
virtual bool Equals(const CSerialObject &object, ESerialRecursionMode how=eRecursive) const
Check if both objects contain the same values.
CBeginInfo Begin(C &obj)
Get starting point of object hierarchy.
Definition: iterator.hpp:1004
virtual bool EndOfData(void) override
Check if there is still some meaningful data that can be read; this function will skip white spaces a...
Definition: objistrasn.cpp:98
void ReadObject(const CObjectInfo &object)
Read child object.
Definition: objistr.cpp:1097
virtual string ReadFileHeader(void) override
Read file header.
Definition: objistrasn.cpp:709
TObjectType * GetPointer(void) THROWS_NONE
Get pointer,.
Definition: ncbiobj.hpp:998
void Reset(void)
Reset reference object.
Definition: ncbiobj.hpp:773
TObjectType * GetPointerOrNull(void) const THROWS_NONE
Get pointer value.
Definition: ncbiobj.hpp:1672
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
CNcbiIstream & NcbiGetlineEOL(CNcbiIstream &is, string &str, string::size_type *count=NULL)
Read from "is" to "str" the next line (taking into account platform specifics of End-of-Line)
const char * Endl(void)
Platform-specific EndOfLine.
Definition: ncbistre.cpp:184
IO_PREFIX::ifstream CNcbiIfstream
Portable alias for ifstream.
Definition: ncbistre.hpp:439
#define kEmptyStr
Definition: ncbistr.hpp:123
static const string BoolToString(bool value)
Convert bool to string.
Definition: ncbistr.cpp:2815
static void TruncateSpacesInPlace(string &str, ETrunc where=eTrunc_Both)
Truncate spaces in a string (in-place)
Definition: ncbistr.cpp:3201
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.
Definition: ncbistr.cpp:3554
static enable_if< is_arithmetic< TNumeric >::value||is_convertible< TNumeric, Int8 >::value, string >::type NumericToString(TNumeric value, TNumToStringFlags flags=0, int base=10)
Convert numeric value to string.
Definition: ncbistr.hpp:673
@ eCurrent
Use current time. See also CCurrentTime.
Definition: ncbitime.hpp:300
const string & GetName(void) const
Get name of this type.
Definition: typeinfo.cpp:249
TObjectPtr Create(CObjectMemoryPool *memoryPool=0) const
Create object of this type on heap (can be deleted by operator delete)
bool IsUpdate_date(void) const
Check if variant Update_date is selected.
Definition: Seqdesc_.hpp:1152
bool IsCreate_date(void) const
Check if variant Create_date is selected.
Definition: Seqdesc_.hpp:1146
TCreate_date & SetCreate_date(void)
Select the variant.
Definition: Seqdesc_.cpp:478
TUpdate_date & SetUpdate_date(void)
Select the variant.
Definition: Seqdesc_.cpp:500
void SetData(TData &value)
Assign a value to Data data member.
Defines the CNcbiApplication and CAppException classes for creating NCBI applications.
int isalpha(Uchar c)
Definition: ncbictype.hpp:61
int isspace(Uchar c)
Definition: ncbictype.hpp:69
int tolower(Uchar c)
Definition: ncbictype.hpp:72
Defines classes: CDirEntry, CFile, CDir, CSymLink, CMemoryFile, CFileUtil, CFileLock,...
T max(T x_, T y_)
The Object manager core.
@ eError
An error was encountered while trying to send request or to read and to process the reply.
Reader-writer based streams.
Utility stuff for more convenient using of Boost.Test library.
#define NCBITEST_CHECK_MESSAGE(P, M)
Definition: test_boost.hpp:631
USING_SCOPE(objects)
BOOST_AUTO_TEST_CASE(MasterTest)
NCBITEST_INIT_CMDLINE(descrs)
void TraverseAndRunTestCases(ITestRunner *pTestRunner, CDir dirWithTestCases, const set< string > &setOfRequiredSuffixes, const set< string > &setOfOptionalSuffixes=set< string >(), const set< string > &setOfIgnoredSuffixes=set< string >(), TTraverseAndRunTestCasesFlags fFlags=0)
This is for running data-driven test cases below the given top-level test directory.
CRef< objects::CSeq_entry > BuildGoodSeq(void)
Modified on Wed May 08 12:04:45 2024 by modify_doxy.py rev. 669887