NCBI C++ ToolKit
Macros | Functions | Variables
asniotest.cpp File Reference
#include <ncbi_pch.hpp>
#include <corelib/ncbienv.hpp>
#include <corelib/ncbifile.hpp>
#include <corelib/ncbitime.hpp>
#include <corelib/ncbi_param.hpp>
#include <serial/serial.hpp>
#include <serial/objistrasn.hpp>
#include <serial/objistrasnb.hpp>
#include <serial/objostrasn.hpp>
#include <serial/objostrasnb.hpp>
#include <util/random_gen.hpp>
#include <connect/ncbi_conn_stream.hpp>
#include <connect/ncbi_core_cxx.hpp>
#include <connect/ncbi_util.h>
#include <memory>
#include <objects/seqloc/Seq_loc.hpp>
#include <objects/seqloc/Seq_interval.hpp>
#include <objects/seqloc/Seq_id.hpp>
#include <objects/seqloc/PDB_seq_id.hpp>
#include <objects/seqloc/PDB_mol_id.hpp>
#include <objects/cdd/Cdd.hpp>
#include <objects/cdd/Global_id.hpp>
#include <objects/ncbimime/Ncbi_mime_asn1.hpp>
#include <objects/ncbimime/Biostruc_seq.hpp>
#include <objects/mmdb1/Biostruc.hpp>
#include <objects/mmdb1/Biostruc_descr.hpp>
#include <objects/mmdb1/Mmdb_id.hpp>
#include <objects/mmdb1/Atom.hpp>
#include <objects/mmdb1/Atom_id.hpp>
#include <objects/mmdb2/Model_space_points.hpp>
#include <objects/mmdb3/Region_coordinates.hpp>
#include <objects/cn3d/Cn3d_color.hpp>
#include <objects/general/User_object.hpp>
#include <objects/seqset/Seq_entry.hpp>
#include <objects/id1/ID1server_maxcomplex.hpp>
#include <objects/id1/id1_client.hpp>
#include <objects/pcsubstance/PC_InfoData.hpp>
#include <objects/pcsubstance/PC_Urn.hpp>
#include "asniotest.hpp"
#include <common/test_assert.h>
+ Include dependency graph for asniotest.cpp:

Go to the source code of this file.

Go to the SVN repository for this file.

Macros

#define INFOMSG(stream)   ERR_POST(Info << stream)
 
#define WARNINGMSG(stream)   ERR_POST(Warning << stream)
 
#define ERRORMSG(stream)   ERR_POST(Error << stream << '!')
 
#define BEGIN_TEST_FUNCTION(func)
 
#define END_TEST_FUNCTION
 
#define ADD_ERR(msg)
 
#define ADD_ERR_RETURN(msg)
 
#define SHOULD_THROW_EXCEPTION(object, accessor)
 
#define MMDB_ID   "1ABA"
 
#define RUN_TEST(func)
 

Functions

 USING_SCOPE (objects)
 
string pathToFiles (".")
 
template<class ASNClass >
bool ReadASNFromFile (const char *filename, ASNClass *ASNobject, bool isBinary, string *err)
 
template<class ASNClass >
bool WriteASNToFile (const ASNClass &ASNobject, bool isBinary, string *err, EFixNonPrint fixNonPrint=eFNP_Default)
 
template<class ASNClass >
bool WriteASNToFilesTxtBin (const ASNClass &ASNobject, string *err)
 
int BasicFileIO (void)
 
int AssignAndOutput (void)
 
int MandatoryField (void)
 
int ListField (void)
 
int OptionalField (void)
 
int DefaultField (void)
 
int ZeroReal (void)
 
int FullBlobs (void)
 
int UnsignedInt (void)
 
int BitString (void)
 
template<class ASNClass >
bool GetAsnDataViaHTTP (const string &host, const string &path, const string &args, ASNClass *asnObject, string *err, bool binaryData=true, unsigned short port=80)
 
 NCBI_PARAM_DECL (string, MMDBSrv, Host)
 
 NCBI_PARAM_DEF_EX (string, MMDBSrv, Host, "www.ncbi.nlm.nih.gov", eParam_NoThread, MMDBSRV_HOST)
 
 NCBI_PARAM_DECL (unsigned short, MMDBSrv, Port)
 
 NCBI_PARAM_DEF_EX (unsigned short, MMDBSrv, Port, 80, eParam_NoThread, MMDBSRV_PORT)
 
 NCBI_PARAM_DECL (string, MMDBSrv, Path)
 
 NCBI_PARAM_DEF_EX (string, MMDBSrv, Path, "/Structure/mmdb/mmdbsrv.cgi", eParam_NoThread, MMDBSRV_PATH)
 
 NCBI_PARAM_DECL (string, MMDBSrv, Args)
 
 NCBI_PARAM_DEF_EX (string, MMDBSrv, Args, "uid=" "1ABA" "&form=6&db=t&save=Save&dopt=j" "&Complexity=Cn3D%20Subset", eParam_NoThread, MMDBSRV_ARGS)
 
int MMDBSrv (void)
 
int main (int argc, const char *argv[])
 

Variables

list< stringfilesCreated
 
 USING_NCBI_SCOPE
 

Macro Definition Documentation

◆ ADD_ERR

#define ADD_ERR (   msg)
Value:
do { \
ERRORMSG(msg); \
nErrors++; \
} while (0)

Definition at line 202 of file asniotest.cpp.

◆ ADD_ERR_RETURN

#define ADD_ERR_RETURN (   msg)
Value:
do { \
ERRORMSG(msg); \
nErrors++; \
return nErrors; \
} while (0)

Definition at line 208 of file asniotest.cpp.

◆ BEGIN_TEST_FUNCTION

#define BEGIN_TEST_FUNCTION (   func)
Value:
int func (void) { \
int nErrors = 0; \
string err; \
INFOMSG("Running " #func " test");

Definition at line 192 of file asniotest.cpp.

◆ END_TEST_FUNCTION

#define END_TEST_FUNCTION
Value:
return nErrors; \
}

Definition at line 198 of file asniotest.cpp.

◆ ERRORMSG

#define ERRORMSG (   stream)    ERR_POST(Error << stream << '!')

Definition at line 86 of file asniotest.cpp.

◆ INFOMSG

#define INFOMSG (   stream)    ERR_POST(Info << stream)

Definition at line 84 of file asniotest.cpp.

◆ MMDB_ID

#define MMDB_ID   "1ABA"

Definition at line 639 of file asniotest.cpp.

◆ RUN_TEST

#define RUN_TEST (   func)
Value:
do { \
int errors = func(); \
nErrors += errors; \
if (errors) \
ERRORMSG(#func " test failed"); \
} while (0)

Definition at line 671 of file asniotest.cpp.

◆ SHOULD_THROW_EXCEPTION

#define SHOULD_THROW_EXCEPTION (   object,
  accessor 
)
Value:
do { \
try { \
object.accessor(); \
ADD_ERR(#accessor "() should have thrown an exception"); \
} catch (exception& e) { \
INFOMSG(#accessor "() correctly threw exception " << e.what()); \
} \
} while (0)

Definition at line 215 of file asniotest.cpp.

◆ WARNINGMSG

#define WARNINGMSG (   stream)    ERR_POST(Warning << stream)

Definition at line 85 of file asniotest.cpp.

Function Documentation

◆ AssignAndOutput()

int AssignAndOutput ( void  )

Definition at line 256 of file asniotest.cpp.

Referenced by ASNIOTestApp::Run().

◆ BasicFileIO()

int BasicFileIO ( void  )

Definition at line 227 of file asniotest.cpp.

Referenced by ASNIOTestApp::Run().

◆ BitString()

int BitString ( void  )

◆ DefaultField()

int DefaultField ( void  )

Definition at line 399 of file asniotest.cpp.

Referenced by ASNIOTestApp::Run().

◆ FullBlobs()

int FullBlobs ( void  )

Definition at line 445 of file asniotest.cpp.

Referenced by ASNIOTestApp::Run().

◆ GetAsnDataViaHTTP()

template<class ASNClass >
bool GetAsnDataViaHTTP ( const string host,
const string path,
const string args,
ASNClass *  asnObject,
string err,
bool  binaryData = true,
unsigned short  port = 80 
)

◆ ListField()

int ListField ( void  )

Definition at line 325 of file asniotest.cpp.

Referenced by ASNIOTestApp::Run().

◆ main()

int main ( int  argc,
const char *  argv[] 
)

◆ MandatoryField()

int MandatoryField ( void  )

Definition at line 289 of file asniotest.cpp.

Referenced by ASNIOTestApp::Run().

◆ MMDBSrv()

int MMDBSrv ( void  )

Definition at line 650 of file asniotest.cpp.

Referenced by ASNIOTestApp::Run().

◆ NCBI_PARAM_DECL() [1/4]

NCBI_PARAM_DECL ( string  ,
MMDBSrv  ,
Args   
)

◆ NCBI_PARAM_DECL() [2/4]

NCBI_PARAM_DECL ( string  ,
MMDBSrv  ,
Host   
)

◆ NCBI_PARAM_DECL() [3/4]

NCBI_PARAM_DECL ( string  ,
MMDBSrv  ,
Path   
)

◆ NCBI_PARAM_DECL() [4/4]

NCBI_PARAM_DECL ( unsigned short  ,
MMDBSrv  ,
Port   
)

◆ NCBI_PARAM_DEF_EX() [1/4]

NCBI_PARAM_DEF_EX ( string  ,
MMDBSrv  ,
Args   
)

◆ NCBI_PARAM_DEF_EX() [2/4]

NCBI_PARAM_DEF_EX ( string  ,
MMDBSrv  ,
Host  ,
"www.ncbi.nlm.nih.gov"  ,
eParam_NoThread  ,
MMDBSRV_HOST   
)

◆ NCBI_PARAM_DEF_EX() [3/4]

NCBI_PARAM_DEF_EX ( string  ,
MMDBSrv  ,
Path  ,
"/Structure/mmdb/mmdbsrv.cgi"  ,
eParam_NoThread  ,
MMDBSRV_PATH   
)

◆ NCBI_PARAM_DEF_EX() [4/4]

NCBI_PARAM_DEF_EX ( unsigned short  ,
MMDBSrv  ,
Port  ,
80  ,
eParam_NoThread  ,
MMDBSRV_PORT   
)

◆ OptionalField()

int OptionalField ( void  )

Definition at line 371 of file asniotest.cpp.

Referenced by ASNIOTestApp::Run().

◆ pathToFiles()

string pathToFiles ( "."  )

◆ ReadASNFromFile()

template<class ASNClass >
bool ReadASNFromFile ( const char *  filename,
ASNClass *  ASNobject,
bool  isBinary,
string err 
)

Definition at line 96 of file asniotest.cpp.

References CDirEntry::GetPathSeparator(), in(), INFOMSG, and pathToFiles().

◆ UnsignedInt()

int UnsignedInt ( void  )

Definition at line 507 of file asniotest.cpp.

Referenced by ASNIOTestApp::Run().

◆ USING_SCOPE()

USING_SCOPE ( objects  )

◆ WriteASNToFile()

template<class ASNClass >
bool WriteASNToFile ( const ASNClass &  ASNobject,
bool  isBinary,
string err,
EFixNonPrint  fixNonPrint = eFNP_Default 
)

Definition at line 134 of file asniotest.cpp.

References filesCreated, INFOMSG, CDirEntry::MakePath(), out(), pathToFiles(), and WARNINGMSG.

Referenced by WriteASNToFilesTxtBin().

◆ WriteASNToFilesTxtBin()

template<class ASNClass >
bool WriteASNToFilesTxtBin ( const ASNClass &  ASNobject,
string err 
)

Definition at line 186 of file asniotest.cpp.

References WriteASNToFile().

◆ ZeroReal()

int ZeroReal ( void  )

Definition at line 424 of file asniotest.cpp.

Referenced by ASNIOTestApp::Run().

Variable Documentation

◆ filesCreated

list< string > filesCreated

Definition at line 92 of file asniotest.cpp.

Referenced by ASNIOTestApp::Run(), and WriteASNToFile().

◆ USING_NCBI_SCOPE

USING_NCBI_SCOPE

Definition at line 734 of file asniotest.cpp.

Modified on Sun Jul 21 04:20:35 2024 by modify_doxy.py rev. 669887