NCBI C++ ToolKit
Classes | Macros | Typedefs | Functions | Variables
seq_id_unit_test.cpp File Reference
#include <ncbi_pch.hpp>
#include <objects/seqloc/Seq_id.hpp>
#include <objects/biblio/Id_pat.hpp>
#include <objects/general/Date.hpp>
#include <objects/general/Dbtag.hpp>
#include <objects/general/Object_id.hpp>
#include <objects/seq/Seq_inst.hpp>
#include <objects/seqloc/seqloc__.hpp>
#include <objects/seqfeat/Seq_feat.hpp>
#include <objects/seqfeat/SeqFeatData.hpp>
#include <corelib/ncbiapp.hpp>
#include <corelib/test_boost.hpp>
#include <boost/test/parameterized_test.hpp>
#include <util/util_exception.hpp>
#include <util/util_misc.hpp>
#include <util/random_gen.hpp>
#include <thread>
#include <common/test_assert.h>
+ Include dependency graph for seq_id_unit_test.cpp:

Go to the source code of this file.

Go to the SVN repository for this file.

Classes

class  CMTTestThread
 
struct  PSeq_locLess
 
struct  PSeq_locStrandLess
 

Macros

#define NCBI_TEST_APPLICATION
 
#define NCBI_CHECK_THROW_SEQID(s)   BOOST_CHECK_THROW(s, CSeqIdException)
 

Typedefs

typedef map< string, vector< string > > TFastaOSLTMap
 

Functions

 USING_SCOPE (objects)
 
 NCBITEST_AUTO_INIT ()
 
 BOOST_AUTO_TEST_CASE (s_MTTest)
 
 BOOST_AUTO_TEST_CASE (s_MTGiTest)
 
 BOOST_AUTO_TEST_CASE (s_TestDefaultInit)
 
 BOOST_AUTO_TEST_CASE (s_TestInitFromJunk)
 
 BOOST_AUTO_TEST_CASE (s_TestInitFromGIString)
 
 BOOST_AUTO_TEST_CASE (s_TestInitFromNAcc)
 
 BOOST_AUTO_TEST_CASE (s_TestInitFromStdAcc)
 
 BOOST_AUTO_TEST_CASE (s_TestInitFromPRFAcc)
 
 BOOST_AUTO_TEST_CASE (s_TestInitFromPDBAcc)
 
 BOOST_AUTO_TEST_CASE (s_TestInitFromSPAcc)
 
 BOOST_AUTO_TEST_CASE (s_TestInitFromRefSeqAcc)
 
 BOOST_AUTO_TEST_CASE (s_TestInitFromGpipeAcc)
 
 BOOST_AUTO_TEST_CASE (s_TestInitFromNatAcc)
 
 BOOST_AUTO_TEST_CASE (s_TestInitFromFastaLocal)
 
 BOOST_AUTO_TEST_CASE (s_TestInitFromFastaObsolete)
 
 BOOST_AUTO_TEST_CASE (s_TestInitFromFastaGenbank)
 
 BOOST_AUTO_TEST_CASE (s_TestInitFromFastaEmbl)
 
 BOOST_AUTO_TEST_CASE (s_TestInitFromFastaPir)
 
 BOOST_AUTO_TEST_CASE (s_TestInitFromFastaSwissprot)
 
 BOOST_AUTO_TEST_CASE (s_TestInitFromPatent)
 
 BOOST_AUTO_TEST_CASE (s_TestInitFromFastaRefseq)
 
 BOOST_AUTO_TEST_CASE (s_TestInitFromFastaGeneral)
 
 BOOST_AUTO_TEST_CASE (s_TestInitFromFastaGI)
 
 BOOST_AUTO_TEST_CASE (s_TestInitFromFastaDdbj)
 
 BOOST_AUTO_TEST_CASE (s_TestInitFromFastaPrf)
 
 BOOST_AUTO_TEST_CASE (s_TestInitFromFastaPdb)
 
 BOOST_AUTO_TEST_CASE (s_TestInitFromFastaTpa)
 
 BOOST_AUTO_TEST_CASE (s_TestInitFromFastaGpipe)
 
 BOOST_AUTO_TEST_CASE (s_TestInitFromFastaNat)
 
static CSeq_ids_NewDbtagId (const string &db, const string &tag, bool set_as_general=false)
 
static CSeq_ids_NewDbtagId (const string &db, int tag, bool set_as_general=false)
 
 BOOST_AUTO_TEST_CASE (s_TestInitFromDbtag)
 
 BOOST_AUTO_TEST_CASE (s_TestInitFromInt)
 
static void s_TestFastaRoundTrip (const char *s)
 
 BOOST_AUTO_PARAM_TEST_CASE (s_TestFastaRoundTrip, kTestFastaStrings+0, kTestFastaStrings+kNumFastaStrings)
 
 BOOST_AUTO_TEST_CASE (s_TestNoStrays)
 
 BOOST_AUTO_TEST_CASE (s_TestListOps)
 
 BOOST_AUTO_TEST_CASE (s_TestSeq_locAssign)
 
 BOOST_AUTO_TEST_CASE (s_TestSeq_id_GetLabel)
 
 BOOST_AUTO_TEST_CASE (s_TestSeq_id_Compare)
 
CRef< CSeq_locGetRandomSegment (CRandom &rnd)
 
 BOOST_AUTO_TEST_CASE (s_TestSeq_id_Compare_Seq_loc)
 
ostream & operator<< (ostream &out, const CSeq_id_Handle::TMatches &ids)
 
ostream & operator<< (ostream &out, const vector< CSeq_id_Handle > &ids)
 
void s_CheckMatches (const CSeq_id_Handle &id, const vector< CSeq_id_Handle > &ids, const CSeq_id_Handle::TMatches &matches, const CSeq_id_Handle::TMatches &exp_matches, bool strict, const char *type)
 
void s_Match_id (size_t num_ids, const char *const fasta_ids[], const char *const match_to_ids[], const char *const weak_match_to_ids[], bool strict=true)
 
 BOOST_AUTO_TEST_CASE (Match_id1)
 
 BOOST_AUTO_TEST_CASE (Match_id2)
 
 BOOST_AUTO_TEST_CASE (Match_id3)
 
 BOOST_AUTO_TEST_CASE (s_TempTest)
 
 BOOST_AUTO_TEST_CASE (MatchStrId)
 
 BOOST_AUTO_TEST_CASE (TestCase)
 
 BOOST_AUTO_TEST_CASE (s_TestOSLT)
 
 BOOST_AUTO_TEST_CASE (s_TestTypeMismatch)
 
static CRef< CSeq_ids_ParsePDB (const char *str)
 
template<class C >
static string s_ToASN (const C &obj)
 
 BOOST_AUTO_TEST_CASE (TestPDB)
 

Variables

 USING_NCBI_SCOPE
 
static const char * kTestFastaStrings []
 
static const size_t kNumFastaStrings = sizeof(kTestFastaStrings)/sizeof(*kTestFastaStrings)
 
 BEGIN_LOCAL_NAMESPACE
 
static const char *const sc_Ids []
 
 END_LOCAL_NAMESPACE
 
static const TFastaOSLTMap kTestFastaOSLTMap
 

Macro Definition Documentation

◆ NCBI_CHECK_THROW_SEQID

#define NCBI_CHECK_THROW_SEQID (   s)    BOOST_CHECK_THROW(s, CSeqIdException)

Definition at line 62 of file seq_id_unit_test.cpp.

◆ NCBI_TEST_APPLICATION

#define NCBI_TEST_APPLICATION

Definition at line 33 of file seq_id_unit_test.cpp.

Typedef Documentation

◆ TFastaOSLTMap

typedef map<string,vector<string> > TFastaOSLTMap

Definition at line 2290 of file seq_id_unit_test.cpp.

Function Documentation

◆ BOOST_AUTO_PARAM_TEST_CASE()

BOOST_AUTO_PARAM_TEST_CASE ( s_TestFastaRoundTrip  ,
kTestFastaStrings 0,
kTestFastaStrings kNumFastaStrings 
)

◆ BOOST_AUTO_TEST_CASE() [1/46]

BOOST_AUTO_TEST_CASE ( Match_id1  )

Definition at line 1795 of file seq_id_unit_test.cpp.

References ArraySize(), and s_Match_id().

◆ BOOST_AUTO_TEST_CASE() [2/46]

BOOST_AUTO_TEST_CASE ( Match_id2  )

Definition at line 1826 of file seq_id_unit_test.cpp.

References ArraySize(), and s_Match_id().

◆ BOOST_AUTO_TEST_CASE() [3/46]

BOOST_AUTO_TEST_CASE ( Match_id3  )

Definition at line 1875 of file seq_id_unit_test.cpp.

References ArraySize(), and s_Match_id().

◆ BOOST_AUTO_TEST_CASE() [4/46]

BOOST_AUTO_TEST_CASE ( MatchStrId  )

◆ BOOST_AUTO_TEST_CASE() [5/46]

BOOST_AUTO_TEST_CASE ( s_MTGiTest  )

◆ BOOST_AUTO_TEST_CASE() [6/46]

BOOST_AUTO_TEST_CASE ( s_MTTest  )

Definition at line 133 of file seq_id_unit_test.cpp.

References i, NON_CONST_ITERATE, and t.

◆ BOOST_AUTO_TEST_CASE() [7/46]

BOOST_AUTO_TEST_CASE ( s_TempTest  )

Definition at line 1953 of file seq_id_unit_test.cpp.

References hex(), i, and CSeq_id::IdentifyAccession().

◆ BOOST_AUTO_TEST_CASE() [8/46]

BOOST_AUTO_TEST_CASE ( s_TestDefaultInit  )

Definition at line 173 of file seq_id_unit_test.cpp.

References CSeq_id_Base::e_not_set.

◆ BOOST_AUTO_TEST_CASE() [9/46]

BOOST_AUTO_TEST_CASE ( s_TestInitFromDbtag  )

◆ BOOST_AUTO_TEST_CASE() [10/46]

BOOST_AUTO_TEST_CASE ( s_TestInitFromFastaDdbj  )

◆ BOOST_AUTO_TEST_CASE() [11/46]

BOOST_AUTO_TEST_CASE ( s_TestInitFromFastaEmbl  )

◆ BOOST_AUTO_TEST_CASE() [12/46]

BOOST_AUTO_TEST_CASE ( s_TestInitFromFastaGenbank  )

◆ BOOST_AUTO_TEST_CASE() [13/46]

BOOST_AUTO_TEST_CASE ( s_TestInitFromFastaGeneral  )

◆ BOOST_AUTO_TEST_CASE() [14/46]

BOOST_AUTO_TEST_CASE ( s_TestInitFromFastaGI  )

Definition at line 662 of file seq_id_unit_test.cpp.

References CSeq_id_Base::GetGi(), and CSeq_id_Base::IsGi().

◆ BOOST_AUTO_TEST_CASE() [15/46]

BOOST_AUTO_TEST_CASE ( s_TestInitFromFastaGpipe  )

Definition at line 733 of file seq_id_unit_test.cpp.

References CSeq_id_Base::IsGpipe().

◆ BOOST_AUTO_TEST_CASE() [16/46]

BOOST_AUTO_TEST_CASE ( s_TestInitFromFastaLocal  )

◆ BOOST_AUTO_TEST_CASE() [17/46]

BOOST_AUTO_TEST_CASE ( s_TestInitFromFastaNat  )

Definition at line 740 of file seq_id_unit_test.cpp.

References CSeq_id_Base::IsNamed_annot_track().

◆ BOOST_AUTO_TEST_CASE() [18/46]

BOOST_AUTO_TEST_CASE ( s_TestInitFromFastaObsolete  )

◆ BOOST_AUTO_TEST_CASE() [19/46]

BOOST_AUTO_TEST_CASE ( s_TestInitFromFastaPdb  )

◆ BOOST_AUTO_TEST_CASE() [20/46]

BOOST_AUTO_TEST_CASE ( s_TestInitFromFastaPir  )

◆ BOOST_AUTO_TEST_CASE() [21/46]

BOOST_AUTO_TEST_CASE ( s_TestInitFromFastaPrf  )

Definition at line 680 of file seq_id_unit_test.cpp.

References CSeq_id_Base::IsPrf().

◆ BOOST_AUTO_TEST_CASE() [22/46]

BOOST_AUTO_TEST_CASE ( s_TestInitFromFastaRefseq  )

◆ BOOST_AUTO_TEST_CASE() [23/46]

BOOST_AUTO_TEST_CASE ( s_TestInitFromFastaSwissprot  )

◆ BOOST_AUTO_TEST_CASE() [24/46]

BOOST_AUTO_TEST_CASE ( s_TestInitFromFastaTpa  )

◆ BOOST_AUTO_TEST_CASE() [25/46]

BOOST_AUTO_TEST_CASE ( s_TestInitFromGIString  )

◆ BOOST_AUTO_TEST_CASE() [26/46]

BOOST_AUTO_TEST_CASE ( s_TestInitFromGpipeAcc  )

Definition at line 442 of file seq_id_unit_test.cpp.

References CSeq_id_Base::IsGpipe(), and NCBI_CHECK_THROW_SEQID.

◆ BOOST_AUTO_TEST_CASE() [27/46]

BOOST_AUTO_TEST_CASE ( s_TestInitFromInt  )

◆ BOOST_AUTO_TEST_CASE() [28/46]

BOOST_AUTO_TEST_CASE ( s_TestInitFromJunk  )

Definition at line 180 of file seq_id_unit_test.cpp.

References kEmptyStr, and NCBI_CHECK_THROW_SEQID.

◆ BOOST_AUTO_TEST_CASE() [29/46]

BOOST_AUTO_TEST_CASE ( s_TestInitFromNAcc  )

◆ BOOST_AUTO_TEST_CASE() [30/46]

BOOST_AUTO_TEST_CASE ( s_TestInitFromNatAcc  )

◆ BOOST_AUTO_TEST_CASE() [31/46]

BOOST_AUTO_TEST_CASE ( s_TestInitFromPatent  )

◆ BOOST_AUTO_TEST_CASE() [32/46]

BOOST_AUTO_TEST_CASE ( s_TestInitFromPDBAcc  )

◆ BOOST_AUTO_TEST_CASE() [33/46]

BOOST_AUTO_TEST_CASE ( s_TestInitFromPRFAcc  )

◆ BOOST_AUTO_TEST_CASE() [34/46]

BOOST_AUTO_TEST_CASE ( s_TestInitFromRefSeqAcc  )

Definition at line 419 of file seq_id_unit_test.cpp.

References CSeq_id_Base::IsOther(), and NCBI_CHECK_THROW_SEQID.

◆ BOOST_AUTO_TEST_CASE() [35/46]

BOOST_AUTO_TEST_CASE ( s_TestInitFromSPAcc  )

Definition at line 393 of file seq_id_unit_test.cpp.

References CSeq_id_Base::IsSwissprot(), and NCBI_CHECK_THROW_SEQID.

◆ BOOST_AUTO_TEST_CASE() [36/46]

BOOST_AUTO_TEST_CASE ( s_TestInitFromStdAcc  )

◆ BOOST_AUTO_TEST_CASE() [37/46]

BOOST_AUTO_TEST_CASE ( s_TestListOps  )

◆ BOOST_AUTO_TEST_CASE() [38/46]

BOOST_AUTO_TEST_CASE ( s_TestNoStrays  )

Definition at line 913 of file seq_id_unit_test.cpp.

References GetFastLocalTime().

◆ BOOST_AUTO_TEST_CASE() [39/46]

BOOST_AUTO_TEST_CASE ( s_TestOSLT  )

◆ BOOST_AUTO_TEST_CASE() [40/46]

BOOST_AUTO_TEST_CASE ( s_TestSeq_id_Compare  )

◆ BOOST_AUTO_TEST_CASE() [41/46]

BOOST_AUTO_TEST_CASE ( s_TestSeq_id_Compare_Seq_loc  )

◆ BOOST_AUTO_TEST_CASE() [42/46]

BOOST_AUTO_TEST_CASE ( s_TestSeq_id_GetLabel  )

◆ BOOST_AUTO_TEST_CASE() [43/46]

BOOST_AUTO_TEST_CASE ( s_TestSeq_locAssign  )

◆ BOOST_AUTO_TEST_CASE() [44/46]

BOOST_AUTO_TEST_CASE ( s_TestTypeMismatch  )

◆ BOOST_AUTO_TEST_CASE() [45/46]

BOOST_AUTO_TEST_CASE ( TestCase  )

◆ BOOST_AUTO_TEST_CASE() [46/46]

BOOST_AUTO_TEST_CASE ( TestPDB  )

◆ GetRandomSegment()

CRef<CSeq_loc> GetRandomSegment ( CRandom rnd)

◆ NCBITEST_AUTO_INIT()

NCBITEST_AUTO_INIT ( )

Definition at line 64 of file seq_id_unit_test.cpp.

References g_IgnoreDataFile().

◆ operator<<() [1/2]

ostream& operator<< ( ostream &  out,
const CSeq_id_Handle::TMatches ids 
)

Definition at line 1612 of file seq_id_unit_test.cpp.

References set< Key, Compare >::begin(), ITERATE, and out().

◆ operator<<() [2/2]

ostream& operator<< ( ostream &  out,
const vector< CSeq_id_Handle > &  ids 
)

Definition at line 1624 of file seq_id_unit_test.cpp.

References ITERATE, and out().

◆ s_CheckMatches()

void s_CheckMatches ( const CSeq_id_Handle id,
const vector< CSeq_id_Handle > &  ids,
const CSeq_id_Handle::TMatches matches,
const CSeq_id_Handle::TMatches exp_matches,
bool  strict,
const char *  type 
)

Definition at line 1636 of file seq_id_unit_test.cpp.

References ITERATE, NcbiCerr, and NcbiEndl.

Referenced by s_Match_id().

◆ s_Match_id()

void s_Match_id ( size_t  num_ids,
const char *const  fasta_ids[],
const char *const  match_to_ids[],
const char *const  weak_match_to_ids[],
bool  strict = true 
)

◆ s_NewDbtagId() [1/2]

static CSeq_id* s_NewDbtagId ( const string db,
const string tag,
bool  set_as_general = false 
)
static

Definition at line 748 of file seq_id_unit_test.cpp.

References CDbtag_Base::SetDb(), CDbtag_Base::SetTag(), and tag.

Referenced by BOOST_AUTO_TEST_CASE().

◆ s_NewDbtagId() [2/2]

static CSeq_id* s_NewDbtagId ( const string db,
int  tag,
bool  set_as_general = false 
)
static

Definition at line 757 of file seq_id_unit_test.cpp.

References CDbtag_Base::SetDb(), CDbtag_Base::SetTag(), and tag.

◆ s_ParsePDB()

static CRef<CSeq_id> s_ParsePDB ( const char *  str)
static

Definition at line 2378 of file seq_id_unit_test.cpp.

References in(), MSerial_AsnText, and str().

Referenced by BOOST_AUTO_TEST_CASE().

◆ s_TestFastaRoundTrip()

static void s_TestFastaRoundTrip ( const char *  s)
static

◆ s_ToASN()

template<class C >
static string s_ToASN ( const C obj)
static

Definition at line 2387 of file seq_id_unit_test.cpp.

References MSerial_AsnText, and out().

Referenced by BOOST_AUTO_TEST_CASE().

◆ USING_SCOPE()

USING_SCOPE ( objects  )

Variable Documentation

◆ BEGIN_LOCAL_NAMESPACE

BEGIN_LOCAL_NAMESPACE

Definition at line 1468 of file seq_id_unit_test.cpp.

◆ END_LOCAL_NAMESPACE

END_LOCAL_NAMESPACE

Definition at line 1544 of file seq_id_unit_test.cpp.

◆ kNumFastaStrings

const size_t kNumFastaStrings = sizeof(kTestFastaStrings)/sizeof(*kTestFastaStrings)
static

Definition at line 878 of file seq_id_unit_test.cpp.

Referenced by BOOST_AUTO_TEST_CASE().

◆ kTestFastaOSLTMap

const TFastaOSLTMap kTestFastaOSLTMap
static

Definition at line 2291 of file seq_id_unit_test.cpp.

Referenced by BOOST_AUTO_TEST_CASE().

◆ kTestFastaStrings

const char* kTestFastaStrings[]
static

Definition at line 838 of file seq_id_unit_test.cpp.

Referenced by BOOST_AUTO_TEST_CASE().

◆ sc_Ids

const char* const sc_Ids[]
static
Initial value:
= {
"gnl|ti|12312",
"gi|3231212",
"NC_000001"
}

Definition at line 1470 of file seq_id_unit_test.cpp.

Referenced by BOOST_AUTO_TEST_CASE(), and GetRandomSegment().

◆ USING_NCBI_SCOPE

USING_NCBI_SCOPE

Definition at line 58 of file seq_id_unit_test.cpp.

Modified on Sun Jun 16 04:30:24 2024 by modify_doxy.py rev. 669887