<
classASNClass >
96 bool ReadASNFromFile(
const char*filename, ASNClass *ASNobject,
boolisBinary,
string*err)
101unique_ptr<CNcbiIstream> inStream;
106*err =
"Cannot open file for reading";
110unique_ptr<CObjectIStream> inObject;
122*inObject >> *ASNobject;
123 INFOMSG(
"read file "<< filename);
124}
catch(exception& e) {
133 template<
classASNClass >
141oss <<
"test_"<< (
filesCreated.size() + 1) << (isBinary ?
".bin":
".txt");
144 if(
CFile(fullPath).Exists()) {
145 WARNINGMSG(
"Overwriting temporary file "<< fullPath);
152unique_ptr<CNcbiOstream> outStream;
157*err =
"Cannot open file for writing";
162unique_ptr<CObjectOStream> outObject;
174*outObject << ASNobject;
176 INFOMSG(
"wrote file "<< filename);
177}
catch(exception& e) {
185 template<
classASNClass >
192 #define BEGIN_TEST_FUNCTION(func) \ 196 INFOMSG("Running "#func " test");
198 #define END_TEST_FUNCTION \ 202 #define ADD_ERR(msg) \ 208 #define ADD_ERR_RETURN(msg) \ 215 #define SHOULD_THROW_EXCEPTION(object, accessor) \ 219 ADD_ERR(#accessor "() should have thrown an exception"); \
220} catch (exception& e) { \
221INFOMSG(#accessor "() correctly threw exception " << e.what()); \
236 ADD_ERR(
"failed to write CSeq_id: "<< err);
243 ADD_ERR(
"failed to write CCdd: "<< err);
250 ADD_ERR(
"failed to write CNcbi_mime_asn1: "<< err);
265 ADD_ERR(
"failed to write Assign()'ed Seq-id: "<< err);
274 ADD_ERR(
"failed to write Assign()'ed Cdd: "<< err);
283 ADD_ERR(
"failed to write Assign()'ed Ncbi_mime_asn1: "<< err);
297 INFOMSG(
"reading badAtom.txt - should fail");
300 ADD_ERR_RETURN(
"badAtom.txt should not have loaded successfully");
304 ADD_ERR(
"id access failed");
307 ADD_ERR(
"new Atom should not have element");
311 ADD_ERR(
"bad element state after SetElement()");
314 INFOMSG(
"trying to write incomplete Atom - should fail");
316 ADD_ERR(
"should not be able to write Atom with no id");
317a3.
SetId().Set(92);
319 ADD_ERR(
"failed to write complete Atom: "<< err);
341m2.
SetX().push_back(21);
342m2.
SetX().push_back(931);
345m2.
SetY().push_back(0);
346 INFOMSG(
"trying to write incomplete Model-space-points - should fail");
348 ADD_ERR(
"shouldn't be able to write incomplete Model-space-points");
351 ADD_ERR(
"failed to write complete Model-space-points: "<< err);
355 INFOMSG(
"trying to read incomplete Model-space-points - should fail");
357 ADD_ERR(
"shouldn't be able to read incomplete Model-space-points: "<< err);
363 if(
r1.IsSetCoordinate_indices() || !
r1.CanGetCoordinate_indices() ||
364 r1.GetCoordinate_indices().size() != 0)
365 ADD_ERR(
"bad state for missing OPTIONAL list");
378 ADD_ERR(
"bad release state");
381 ADD_ERR(
"bad version state");
386 ADD_ERR(
"bad release state in new object");
391 ADD_ERR(
"bad release state after SetRelease()");
393 ADD_ERR(
"failed to write good Global-id: "<< err);
405 ADD_ERR(
"bad scale-factor access");
407 ADD_ERR(
"bad alpha access");
411 ADD_ERR(
"bad alpha state after construction");
414 ADD_ERR(
"bad alpha state after SetAlpha()");
419 ADD_ERR(
"failed to write good Cn3d-color: "<< err);
430 ADD_ERR(
"failed to write original User-object: "<< err);
434ncbi::CObjectOStreamAsnBinary outObject(asnIOstream);
435outObject << originalUO;
436ncbi::CObjectIStreamAsnBinary inObject(asnIOstream);
440 ADD_ERR(
"failed to write new User-object: "<< err);
453 if(line.empty() || !
isdigit((
unsigned char) line[0]) ) {
468}
catch(exception& e) {
469 ADD_ERR(
"failed to retrieve blob for GI "<< gi <<
": " 475 switch(rng.GetRand(0, 2)) {
478 case2: sdf =
eSerial_Xml; sdf_name =
"XML";
break;
484}
catch(exception& e) {
485 ADD_ERR(
"failed to generate "<< sdf_name <<
" for GI "<< gi
486<<
": "<< e.what());
493}
catch(exception& e) {
494 ADD_ERR(
"failed to parse "<< sdf_name <<
" for GI "<< gi <<
": " 499 ADD_ERR(
"failed equality after "<< sdf_name
500<<
" round trip for GI "<< gi);
511seqloc->SetInt().SetFrom(signedInt);
512seqloc->SetInt().SetTo(signedInt);
513seqloc->SetInt().SetId().SetGi(
ZERO_GI);
524 if(!
ReadASNFromFile(filename.c_str(), seqloc2.GetPointer(),
false, &err))
526 if(!seqloc2->Equals(*seqloc))
527 ADD_ERR(
"seqloc with '-1' Equals test failed");
530seqloc3->Assign(*seqloc);
532 ADD_ERR(
"output of Assign'ed seqloc with '-1' failed: "<< err);
533 if(((
int) seqloc3->GetInt().GetFrom()) != -1)
534 ADD_ERR(
"seqloc post-Assign value test failed");
537 if(!
ReadASNFromFile(
"seqLocTest.txt", seqloc4.GetPointer(),
false, &err))
539 if(seqloc4->GetInt().GetFrom() != 4294967295U)
540 ADD_ERR(
"seqloc unsigned int value test failed");
551 for(
i=0;
i<100; ++
i) {
555 orig.SetUrn().SetLabel(
"test");
557 unsigned ints =
r.GetRand(1, 10000);
560 b[j] =
r.GetRand(0, 1) ?
true:
false;
574 bool failed= (!
copy.GetValue().IsBitlist() ||
copy.GetValue().GetBitlist().size() != s);
577 if(
orig.GetValue().GetBitlist()[j] !=
copy.GetValue().GetBitlist()[j])
582 ADD_ERR(
"BIT STRING test #"<<
i<<
" failed: size = "<< s <<
", format = " 591 template<
classASNClass >
593 const string& host,
const string& path,
const string& args,
594ASNClass *asnObject,
string*err,
boolbinaryData =
true,
unsigned shortport = 80)
609unique_ptr<CObjectIStream> inObject;
614*inObject >> *asnObject;
617}
catch(exception& e) {
618*err =
string(
"Network connection failed or data is not in expected format; error: ") + e.what();
639 #define MMDB_ID "1ABA" 643 "uid=" MMDB_ID "&form=6&db=t&save=Save&dopt=j" 644 "&Complexity=Cn3D%20Subset",
671 #define RUN_TEST(func) \ 673 int errors = func(); \ 676 ERRORMSG(#func " test failed"); \
683}
else if(
CDirEntry(
"data/pdbSeqId.txt").Exists()) {
690 INFOMSG(
"Running tests...");
705}
catch(exception& e) {
706 ERRORMSG(
"uncaught exception: "<< e.what());
712 if(!
file.Remove()) {
720 INFOMSG(
"No errors encountered, all tests succeeded!");
722 ERRORMSG(nErrors <<
" error"<< ((nErrors == 1) ?
"":
"s") <<
" encountered");
724 INFOMSG(
"(Debug mode build, "<< __DATE__ <<
")");
726 INFOMSG(
"(Release mode build, "<< __DATE__ <<
")");
736 int main(
intargc,
const char* argv[])
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
#define ADD_ERR_RETURN(msg)
bool WriteASNToFile(const ASNClass &ASNobject, bool isBinary, string *err, EFixNonPrint fixNonPrint=eFNP_Default)
#define SHOULD_THROW_EXCEPTION(object, accessor)
#define BEGIN_TEST_FUNCTION(func)
bool WriteASNToFilesTxtBin(const ASNClass &ASNobject, string *err)
bool ReadASNFromFile(const char *filename, ASNClass *ASNobject, bool isBinary, string *err)
NCBI_PARAM_DECL(string, MMDBSrv, Host)
int AssignAndOutput(void)
list< string > filesCreated
#define WARNINGMSG(stream)
#define END_TEST_FUNCTION
int main(int argc, const char *argv[])
NCBI_PARAM_DEF_EX(string, MMDBSrv, Host, "www.ncbi.nlm.nih.gov", eParam_NoThread, MMDBSRV_HOST)
bool GetAsnDataViaHTTP(const string &host, const string &path, const string &args, ASNClass *asnObject, string *err, bool binaryData=true, unsigned short port=80)
int Run(void)
Run the application.
This stream exchanges data with an HTTP server located at the URL: http[s]://host[:port]/path[?...
In-memory stream (a la strstream or stringstream)
void SetAllowDeadEntries(bool ok)
virtual CRef< CSeq_entry > AskGetsefromgi(const CID1server_maxcomplex &req, TReply *reply=0)
CID1server_maxcomplex â.
CNcbiOstrstreamToString class helps convert CNcbiOstrstream to a string Sample usage:
CObjectIStreamAsnBinary â.
CObjectOStreamAsnBinary â.
std::ofstream out("events_result.xml")
main entry point for tests
string Path(const string &dir, const string &file)
const CNcbiEnvironment & GetEnvironment(void) const
Get the application's cached environment.
int AppMain(int argc, const char *const *argv, const char *const *envp=0, EAppDiagStream diag=eDS_Default, const char *conf=NcbiEmptyCStr, const string &name=NcbiEmptyString)
Main function (entry point) for the NCBI application.
@ eNoOwnership
No ownership is assumed.
EDiagSev SetDiagPostLevel(EDiagSev post_sev=eDiag_Error)
Set the threshold severity for posting the messages.
void SetDiagStream(CNcbiOstream *os, bool quick_flush=true, FDiagCleanup cleanup=0, void *cleanup_data=0, const string &stream_name="")
Set diagnostic stream.
@ eDiag_Info
Informational message.
const string & Get(const string &name, bool *found=NULL) const
Get environment value by name.
static string MakePath(const string &dir=kEmptyStr, const string &base=kEmptyStr, const string &ext=kEmptyStr)
Assemble a path from basic components.
static char GetPathSeparator(void)
Get path separator symbol specific for the current platform.
static void SetVerifyDataGlobal(ESerialVerifyData verify)
EFixNonPrint
How to process non-printing character in the ASN VisibleString.
bool SerialEquals(const C &object1, const C &object2, ESerialRecursionMode how=eRecursive)
Compare serial objects.
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Set object to copy of another one.
ESerialDataFormat
Data file format.
@ eSerialVerifyData_Always
always verify (even if set not to later on)
@ eSerial_AsnText
ASN.1 text.
@ eSerial_AsnBinary
ASN.1 binary.
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Optimized implementation of CSerialObject::Assign, which is not so efficient.
static CObjectOStream * Open(ESerialDataFormat format, CNcbiOstream &outStream, bool deleteOutStream)
Create serial object writer and attach it to an output stream.
static CObjectIStream * Open(ESerialDataFormat format, CNcbiIstream &inStream, bool deleteInStream)
Create serial object reader and attach it to an input stream.
static void SetVerifyDataGlobal(ESerialVerifyData verify)
Set up default output data verification for streams created by the current process.
#define NCBI_PARAM_TYPE(section, name)
Generate typename for a parameter from its {section, name} attributes.
@ eParam_NoThread
Do not use per-thread values.
bool Set(const string §ion, const string &name, const string &value, TFlags flags=0, const string &comment=kEmptyStr)
Set the configuration parameter value.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
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)
IO_PREFIX::ofstream CNcbiOfstream
Portable alias for ofstream.
IO_PREFIX::ifstream CNcbiIfstream
Portable alias for ifstream.
@ fAllowTrailingSymbols
Ignore trailing non-numerics characters.
CTime CurrentTime(CTime::ETimeZone tz=CTime::eLocal, CTime::ETimeZonePrecision tzp=CTime::eTZPrecisionDefault)
void CORE_SetREG(REG rg)
Set the registry (no registry if "rg" is passed zero) â to be used by the core internals.
REG REG_cxx2c(IRWRegistry *reg, bool pass_ownership=false)
Convert a C++ Toolkit registry object to a REG registry.
#define REG_CONN_DEBUG_PRINTOUT
REG CORE_GetREG(void)
Get the registry that is to be used by the core internals.
#define REG_CONN_REQ_METHOD
#define DEF_CONN_REG_SECTION
bool IsSetId(void) const
Check if a value has been assigned to Id data member.
bool CanGetId(void) const
Check if it is safe to call GetId method.
bool CanGetElement(void) const
Check if it is safe to call GetElement method.
bool IsSetElement(void) const
Check if a value has been assigned to Element data member.
TElement GetElement(void) const
Get the Element member data.
void SetId(const TId &value)
Assign a value to Id data member.
const TId & GetId(void) const
Get the Id member data.
void SetElement(TElement value)
Assign a value to Element data member.
void SetScale_factor(TScale_factor value)
Assign a value to Scale_factor data member.
const TX & GetX(void) const
Get the X member data.
TX & SetX(void)
Assign a value to X data member.
bool IsSetX(void) const
Check if a value has been assigned to X data member.
TY & SetY(void)
Assign a value to Y data member.
TZ & SetZ(void)
Assign a value to Z data member.
const TZ & GetZ(void) const
Get the Z member data.
bool CanGetX(void) const
Check if it is safe to call GetX method.
bool IsSetZ(void) const
Check if a value has been assigned to Z data member.
bool CanGetZ(void) const
Check if it is safe to call GetZ method.
const TDescr & GetDescr(void) const
Get the Descr member data.
void SetAccession(const TAccession &value)
Assign a value to Accession data member.
bool IsSetVersion(void) const
version 0 is the seed, version numbers increase with update/curate cycles Check if a value has been a...
bool CanGetRelease(void) const
Check if it is safe to call GetRelease method.
TVersion GetVersion(void) const
Get the Version member data.
bool IsSetRelease(void) const
to hold CD-Database release number if desired, currently not used Check if a value has been assigned ...
void SetRelease(const TRelease &value)
Assign a value to Release data member.
bool CanGetVersion(void) const
Check if it is safe to call GetVersion method.
void SetBlue(TBlue value)
Assign a value to Blue data member.
TAlpha GetAlpha(void) const
Get the Alpha member data.
bool CanGetScale_factor(void) const
Check if it is safe to call GetScale_factor method.
bool IsSetScale_factor(void) const
Check if a value has been assigned to Scale_factor data member.
void SetRed(TRed value)
Assign a value to Red data member.
bool CanGetAlpha(void) const
Check if it is safe to call GetAlpha method.
void SetAlpha(TAlpha value)
Assign a value to Alpha data member.
void SetGreen(TGreen value)
Assign a value to Green data member.
TScale_factor GetScale_factor(void) const
Get the Scale_factor member data.
bool IsSetAlpha(void) const
Check if a value has been assigned to Alpha data member.
void SetGi(TGi value)
Assign a value to Gi data member.
void SetMaxplex(TMaxplex value)
Assign a value to Maxplex data member.
@ eEntry_complexities_entry
the "natural" entry for this (nuc-prot)
const TStrucseq & GetStrucseq(void) const
Get the variant data.
bool IsStrucseq(void) const
Check if variant Strucseq is selected.
const TStructure & GetStructure(void) const
Get the Structure member data.
The blob sat and sat key Both must be positive integers</td > n< td > Non empty string The interpretation of the blob id depends on a processor Cassandra n processor expects the following format
where boath are integers</td > n< td ></td > n</tr > n< tr > n< td > tse</td > n< td > optional</td > n< td > String</td > n< td class=\"description\"> TSE option controls what blob is orig
const TYPE & Get(const CNamedParameterList *param)
const struct ncbi::grid::netcache::search::fields::SIZE size
Defines unified interface to application:
Defines classes: CDirEntry, CFile, CDir, CSymLink, CMemoryFile, CFileUtil, CFileLock,...
Defines: CTimeFormat - storage class for time format.
std::istream & in(std::istream &in_, double &x_)
double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)
void copy(Njn::Matrix< S > *matrix_, const Njn::Matrix< T > &matrix0_)
static const sljit_gpr r1
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