本文整理汇总了C++中CheckEqual函数的典型用法代码示例。如果您正苦于以下问题:C++ CheckEqual函数的具体用法?C++ CheckEqual怎么用?C++ CheckEqual使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CheckEqual函数的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: CheckEqual
bool CheckEqual( const Pair1 &pair1, const Pair2 &pair2
, typename boost::container::dtl::enable_if_c
<boost::container::dtl::is_pair<Pair1>::value &&
boost::container::dtl::is_pair<Pair2>::value
>::type* = 0)
{
return CheckEqual(pair1.first, pair2.first) && CheckEqual(pair1.second, pair2.second);
}
开发者ID:boostorg,项目名称:container,代码行数:8,代码来源:check_equal_containers.hpp
示例2: CheckIter
static void CheckIter(leveldb_iterator_t* iter,
const char* key, const char* val) {
size_t len;
const char* str;
str = leveldb_iter_key(iter, &len);
CheckEqual(key, str, len);
str = leveldb_iter_value(iter, &len);
CheckEqual(val, str, len);
}
开发者ID:Aleda,项目名称:tera,代码行数:9,代码来源:c_test.c
示例3: ConvertPythonToValue
PyObject *CListValue::Pyindex(PyObject *value)
{
PyObject *result = NULL;
CValue* checkobj = ConvertPythonToValue(value, "val = cList[i]: CValueList, ");
if (checkobj==NULL)
return NULL; /* ConvertPythonToValue sets the error */
int numelem = GetCount();
for (int i=0;i<numelem;i++)
{
CValue* elem = GetValue(i);
if (checkobj==elem || CheckEqual(checkobj,elem))
{
result = PyLong_FromLong(i);
break;
}
}
checkobj->Release();
if (result==NULL) {
PyErr_SetString(PyExc_ValueError, "CList.index(x): x not in CListValue");
}
return result;
}
开发者ID:danielmarg,项目名称:blender-main,代码行数:26,代码来源:ListValue.cpp
示例4: CheckDel
// Callback from leveldb_writebatch_iterate()
static void CheckDel(void* ptr, const char* k, size_t klen)
{
int* state = (int*) ptr;
CheckCondition(*state == 2);
CheckEqual("bar", k, klen);
(*state)++;
}
开发者ID:as2120,项目名称:ZLevelDbWin,代码行数:8,代码来源:c_test.c
示例5: ehgraph_transfer_node_info
bool ehgraph_transfer_node_info(ehgraph_t* dest, enode_t n1, ehgraph_t* src, enode_t n2) {
bool bRet = false;
do {
CheckNotNULL(dest);
CheckLessThan(n1, dest->size + dest->ptrdim);
CheckNotNULL(src);
CheckLessThan(n2, src->size + src->ptrdim);
CheckEqual(src->nLinks, dest->nLinks);
size_t nL = src->nLinks;
enode_info_t* nDst = dest->info + n1;
enode_info_t* nSrc = src->info + n2;
nDst->outDoubleLink = nSrc->outDoubleLink;
nDst->inDoubleLink = nSrc->inDoubleLink;
for (size_t l = 0; l < nL; ++l) {
nDst->links[l] = nSrc->links[l];
nDst->superEdge[l] = nSrc->superEdge[l];
for (size_t ld = 0; ld < nL; ++ld) {
nDst->isPredicate[l][ld] = nSrc->isPredicate[l][ld];
nDst->predicateTarget[l][ld] = nSrc->predicateTarget[l][ld];
}
}
bRet = true;
} while(0);
return bRet;
}
开发者ID:mihasighi,项目名称:celia-tools,代码行数:34,代码来源:ell_representation.c
示例6: ehgraph_transfer_edge
bool ehgraph_transfer_edge(ehgraph_t* dest, enode_t n1, ehgraph_t* src, enode_t n2, size_t link) {
bool bRet = false;
do {
CheckNotNULL(dest);
CheckNotNULL(src);
CheckLessThan(n1, dest->size);
CheckLessThan(n2, src->size);
CheckEqual(src->nLinks, dest->nLinks);
CheckLessThan(link, src->nLinks);
size_t nL = src->nLinks;
enode_info_t* nDst = &GET_NODE(dest, n1);
enode_info_t* nSrc = &GET_NODE(src, n2);
if (link == 0)
nDst->outDoubleLink = nSrc->outDoubleLink;
if (1 == link)
nDst->inDoubleLink = nSrc->inDoubleLink;
nDst->links[link] = nSrc->links[link];
nDst->superEdge[link] = nSrc->superEdge[link];
for (size_t ld = 0; ld < nL; ++ld) {
nDst->isPredicate[link][ld] = nSrc->isPredicate[link][ld];
nDst->predicateTarget[link][ld] = nSrc->predicateTarget[link][ld];
}
bRet = true;
} while(0);
return bRet;
}
开发者ID:mihasighi,项目名称:celia-tools,代码行数:35,代码来源:ell_representation.c
示例7: CheckPut
// Callback from leveldb_writebatch_iterate()
static void CheckPut(void* ptr,
const char* k, size_t klen,
const char* v, size_t vlen) {
int* state = (int*) ptr;
CheckCondition(*state < 2);
switch (*state) {
case 0:
CheckEqual("bar", k, klen);
CheckEqual("b", v, vlen);
break;
case 1:
CheckEqual("box", k, klen);
CheckEqual("c", v, vlen);
break;
}
(*state)++;
}
开发者ID:Aleda,项目名称:tera,代码行数:18,代码来源:c_test.c
示例8: CheckGet
static void CheckGet(
leveldb_t* db,
const leveldb_readoptions_t* options,
const char* key,
const char* expected) {
char* err = NULL;
size_t val_len;
char* val;
val = leveldb_get(db, options, key, strlen(key), &val_len, &err);
CheckNoError(err);
CheckEqual(expected, val, val_len);
Free(&val);
}
开发者ID:Aleda,项目名称:tera,代码行数:13,代码来源:c_test.c
示例9: CheckGetCF
static void CheckGetCF(
rocksdb_t* db,
const rocksdb_readoptions_t* options,
rocksdb_column_family_handle_t* handle,
const char* key,
const char* expected) {
char* err = NULL;
size_t val_len;
char* val;
val = rocksdb_get_cf(db, options, handle, key, strlen(key), &val_len, &err);
CheckNoError(err);
CheckEqual(expected, val, val_len);
Free(&val);
}
开发者ID:AaronCsy,项目名称:rocksdb,代码行数:14,代码来源:c_test.c
示例10: CheckEqualIt
bool CheckEqualIt( const T1 &i1, const T2 &i2, const C1 &c1, const C2 &c2 )
{
bool c1end = i1 == c1.end();
bool c2end = i2 == c2.end();
if( c1end != c2end ){
return false;
}
else if(c1end){
return true;
}
else{
return CheckEqual(*i1, *i2);
}
}
开发者ID:boostorg,项目名称:container,代码行数:14,代码来源:check_equal_containers.hpp
示例11: CheckEqualContainers
bool CheckEqualContainers(MyShmCont *shmcont, MyStdCont *stdcont)
{
if(shmcont->size() != stdcont->size())
return false;
typename MyShmCont::iterator itshm(shmcont->begin()), itshmend(shmcont->end());
typename MyStdCont::iterator itstd(stdcont->begin());
typename MyStdCont::size_type dist = (typename MyStdCont::size_type)std::distance(itshm, itshmend);
if(dist != shmcont->size()){
return false;
}
std::size_t i = 0;
for(; itshm != itshmend; ++itshm, ++itstd, ++i){
if(!CheckEqual(*itstd, *itshm))
return false;
}
return true;
}
开发者ID:OggYiu,项目名称:rag-engine,代码行数:18,代码来源:check_equal_containers.hpp
示例12: CheckEqualContainers
bool CheckEqualContainers(const MyBoostCont &boostcont, const MyStdCont &stdcont)
{
if(boostcont.size() != stdcont.size())
return false;
typename MyBoostCont::const_iterator itboost(boostcont.begin()), itboostend(boostcont.end());
typename MyStdCont::const_iterator itstd(stdcont.begin());
typename MyStdCont::size_type dist = (typename MyStdCont::size_type)std::distance(itboost, itboostend);
if(dist != boostcont.size()){
return false;
}
std::size_t i = 0;
for(; itboost != itboostend; ++itboost, ++itstd, ++i){
if(!CheckEqual(*itstd, *itboost))
return false;
}
return true;
}
开发者ID:MisterTea,项目名称:HyperNEAT,代码行数:18,代码来源:check_equal_containers.hpp
示例13: CheckEqualContainers
bool CheckEqualContainers(const ContA &cont_a, const ContB &cont_b)
{
if(cont_a.size() != cont_b.size())
return false;
typename ContA::const_iterator itcont_a(cont_a.begin()), itcont_a_end(cont_a.end());
typename ContB::const_iterator itcont_b(cont_b.begin()), itcont_b_end(cont_b.end());;
typename ContB::size_type dist = (typename ContB::size_type)boost::container::iterator_distance(itcont_a, itcont_a_end);
if(dist != cont_a.size()){
return false;
}
typename ContA::size_type dist2 = (typename ContA::size_type)boost::container::iterator_distance(itcont_b, itcont_b_end);
if(dist2 != cont_b.size()){
return false;
}
std::size_t i = 0;
for(; itcont_a != itcont_a_end; ++itcont_a, ++itcont_b, ++i){
if(!CheckEqual(*itcont_a, *itcont_b))
return false;
}
return true;
}
开发者ID:boostorg,项目名称:container,代码行数:22,代码来源:check_equal_containers.hpp
示例14: Value
//__________________________________________________________________________________
_PMathObj _Constant::Raise (_PMathObj theObj)
{
if (!theObj) {
return nil;
}
_Parameter base = Value(),
expon = theObj->Value();
if (base>0.0) {
return new _Constant (exp (log(base)*(expon)));;
} else {
if (base<0.0)
if (CheckEqual (expon, (long)expon)) {
return new _Constant (((((long)expon)%2)?-1:1)*exp (log(-base)*(expon)));
} else {
_String errMsg ("An invalid base/exponent pair passed to ^");
WarnError (errMsg.sData);
}
return new _Constant (0.0);
}
}
开发者ID:HyperionRiaz,项目名称:hyphy,代码行数:24,代码来源:constant.cpp
示例15: BlockLength
//.........这里部分代码省略.........
}
else
#endif
ComputeBlock (index, buffer + (hmmCatCount?hmmCatSize:1)*blockLength, useThisPartitonIndex, branchIndex, branchValues);
if (runMode != _hyphyLFConditionMPIIterate && usedCachedResults)
{
bool saveFR = forceRecomputation;
forceRecomputation = true;
ComputeBlock (index, buffer + (hmmCatCount?hmmCatSize:1)*blockLength, useThisPartitonIndex, branchIndex, branchValues);
forceRecomputation = saveFR;
}
if (runMode == _hyphyLFConditionProbsWeightedSum || runMode == _hyphyLFConditionMPIIterate)
{
long lowerBound = hmmCatCount?blockLength*currentHMMCat:0,
upperBound = hmmCatCount?blockLength*(1+currentHMMCat):blockLength,
lowerBound2 = hmmCatCount?(hmmCatSize*blockLength):blockLength;
for (long r1 = lowerBound, r2 = lowerBound2; r1 < upperBound; r1++,r2++)
{
if (siteCorrectors)
{
long scv = *siteCorrectors;
if (scv < scalers.lData[r1]) // this class has a _smaller_ scaling factor
{
buffer[r1] = currentRateWeight * buffer[r2] + buffer[r1] * acquireScalerMultiplier (scalers.lData[r1] - scv);
scalers.lData[r1] = scv;
}
else
{
if (scv > scalers.lData[r1]) // this is a _larger_ scaling factor
buffer[r1] += currentRateWeight * buffer[r2] * acquireScalerMultiplier (scv - scalers.lData[r1]);
else // same scaling factors
buffer[r1] += currentRateWeight * buffer[r2];
}
siteCorrectors++;
}
else
buffer[r1] += currentRateWeight * buffer[r2];
}
}
else // runMode = _hyphyLFConditionProbsMaxProbClass
{
for (long r1 = blockLength*2, r2 = blockLength, r3 = 0; r3 < blockLength; r1++,r2++,r3++)
{
bool doChange = false;
if (siteCorrectors)
{
long scv = *siteCorrectors,
diff = scv - scalers.lData[r3];
if (diff<0) // this has a _smaller_ scaling factor
{
_Parameter scaled = buffer[r1]*acquireScalerMultiplier (diff);
if (buffer[r2] > scaled)
doChange = true;
else
buffer[r1] = scaled;
scalers.lData[r3] = scv;
}
else
{
if (diff>0) // this is a _larger_ scaling factor
buffer[r2] *= acquireScalerMultiplier (-diff);
doChange = buffer[r2] > buffer[r1] && ! CheckEqual (buffer[r2],buffer[r1]);
}
siteCorrectors++;
}
else
doChange = buffer[r2] > buffer[r1] && ! CheckEqual (buffer[r2],buffer[r1]);
if (doChange)
{
buffer[r1] = buffer[r2];
buffer[r3] = useThisPartitonIndex;
}
}
}
}
}
#ifdef __HYPHYMPI__
if (--mpiTasksSent == 0)
break;
#endif
}
}
#ifdef __HYPHYMPI__
DeleteObject (computedWeights);
#endif
DeleteObject (catWeigths);
}
开发者ID:mdsmith,项目名称:OCLHYPHY,代码行数:101,代码来源:likefunc2.cpp
示例16: main
//.........这里部分代码省略.........
StartPhase("iter");
{
rocksdb_iterator_t* iter = rocksdb_create_iterator(db, roptions);
CheckCondition(!rocksdb_iter_valid(iter));
rocksdb_iter_seek_to_first(iter);
CheckCondition(rocksdb_iter_valid(iter));
CheckIter(iter, "box", "c");
rocksdb_iter_next(iter);
CheckIter(iter, "foo", "hello");
rocksdb_iter_prev(iter);
CheckIter(iter, "box", "c");
rocksdb_iter_prev(iter);
CheckCondition(!rocksdb_iter_valid(iter));
rocksdb_iter_seek_to_last(iter);
CheckIter(iter, "foo", "hello");
rocksdb_iter_seek(iter, "b", 1);
CheckIter(iter, "box", "c");
rocksdb_iter_get_error(iter, &err);
CheckNoError(err);
rocksdb_iter_destroy(iter);
}
StartPhase("multiget");
{
const char* keys[3] = { "box", "foo", "notfound" };
const size_t keys_sizes[3] = { 3, 3, 8 };
char* vals[3];
size_t vals_sizes[3];
char* errs[3];
rocksdb_multi_get(db, roptions, 3, keys, keys_sizes, vals, vals_sizes, errs);
int i;
for (i = 0; i < 3; i++) {
CheckEqual(NULL, errs[i], 0);
switch (i) {
case 0:
CheckEqual("c", vals[i], vals_sizes[i]);
break;
case 1:
CheckEqual("hello", vals[i], vals_sizes[i]);
break;
case 2:
CheckEqual(NULL, vals[i], vals_sizes[i]);
break;
}
Free(&vals[i]);
}
}
StartPhase("approximate_sizes");
{
int i;
int n = 20000;
char keybuf[100];
char valbuf[100];
uint64_t sizes[2];
const char* start[2] = { "a", "k00000000000000010000" };
size_t start_len[2] = { 1, 21 };
const char* limit[2] = { "k00000000000000010000", "z" };
size_t limit_len[2] = { 21, 1 };
rocksdb_writeoptions_set_sync(woptions, 0);
for (i = 0; i < n; i++) {
snprintf(keybuf, sizeof(keybuf), "k%020d", i);
snprintf(valbuf, sizeof(valbuf), "v%020d", i);
rocksdb_put(db, woptions, keybuf, strlen(keybuf), valbuf, strlen(valbuf),
&err);
开发者ID:dgraph-io,项目名称:dgraph,代码行数:67,代码来源:c_test.c
示例17: _Constant
//__________________________________________________________________________________
_PMathObj _Constant::LNot ()
{
return new _Constant (CheckEqual(theValue, 0.0));
}
开发者ID:HyperionRiaz,项目名称:hyphy,代码行数:5,代码来源:constant.cpp
示例18: TrainModelNN
void TrainModelNN (_String* model, _String* matrix)
{
_String errMsg;
long modelIdx = modelNames.Find(model);
_Parameter verbI;
checkParameter (VerbosityLevelString, verbI, 0.0);
char buffer [128];
if (modelIdx < 0) {
errMsg = *model & " did not refer to an existring model";
} else {
_Variable* boundsMatrix = FetchVar (LocateVarByName (*matrix));
if (boundsMatrix && (boundsMatrix->ObjectClass() == MATRIX)) {
_Matrix * bmatrix = (_Matrix*) boundsMatrix->GetValue ();
if (bmatrix->IsAStringMatrix() && (bmatrix->GetVDim () == 3)) {
_Variable* modelMatrix = LocateVar (modelMatrixIndices.lData[modelIdx]);
_SimpleList modelVariableList;
{
_AVLList mvla (&modelVariableList);
modelMatrix->ScanForVariables (mvla, true);
mvla.ReorderList();
}
if (bmatrix->GetHDim () == modelVariableList.lLength) {
// now map model variables to bounds matrix
_SimpleList variableMap;
_String *myName;
for (long k = 0; k < modelVariableList.lLength; k++) {
myName = ((_FString*)bmatrix->GetFormula(k,0)->Compute())->theString;
long vID = LocateVarByName (*myName);
if (vID < 0) {
break;
}
vID = variableNames.GetXtra (vID);
vID = modelVariableList.Find(vID);
if (vID < 0) {
break;
}
variableMap << vID;
}
if (variableMap.lLength == modelVariableList.lLength) {
_Matrix vBounds (variableMap.lLength,2, false, true);
long k2 = 0;
for (; k2 < variableMap.lLength; k2++) {
_Parameter lb = ((_FString*)bmatrix->GetFormula(k2,1)->Compute())->theString->toNum(),
ub = ((_FString*)bmatrix->GetFormula(k2,2)->Compute())->theString->toNum();
if ( ub>lb || k2) {
vBounds.Store (k2,0,lb);
vBounds.Store (k2,1,ub);
if (ub<=lb && vBounds (k2-1,0) <= vBounds (k2-1,1) && (!CheckEqual(vBounds (k2-1,0),0.0) || !CheckEqual(vBounds (k2-1,1),1.0))) {
break;
}
}
}
if (k2 == modelVariableList.lLength) {
// set up the sampling now
_String fName = ProcessLiteralArgument (&ModelNNFile,nil);
FILE* nnFile = doFileOpen (fName.getStr(), "w");
if (nnFile) {
_Matrix* modelMatrix = (_Matrix*) LocateVar(modelMatrixIndices.lData[modelIdx])->GetValue();
_Parameter mainSteps,
checkSteps,
errorTerm,
loopMax,
hiddenNodes,
absError,
nn1,
nn2;
long fullDimension = modelMatrix->GetHDim() * modelMatrix->GetVDim();
checkParameter (ModelNNTrainingSteps, mainSteps, 10000.0);
checkParameter (ModelNNVerificationSample, checkSteps, 500.0);
checkParameter (ModelNNPrecision, errorTerm, 0.01);
checkParameter (ModelNNTrainingSteps, loopMax, 10);
checkParameter (ModelNNHiddenNodes, hiddenNodes, 5);
checkParameter (ModelNNLearningRate, nn1, .3);
checkParameter (ModelNNPersistenceRate, nn2, .1);
Net** matrixNet = new Net* [fullDimension] ;
for (long i = 0; i < fullDimension; i++) {
//.........这里部分代码省略.........
开发者ID:Dietermielke,项目名称:hyphy,代码行数:101,代码来源:HYNetInterface.cpp
示例19: main
//.........这里部分代码省略.........
CheckNoError(err);
CheckGet(db, roptions, "foo", "foovalue");
rocksdb_merge(db, woptions, "foo", 3, "barvalue", 8, &err);
CheckNoError(err);
CheckGet(db, roptions, "foo", "fake");
// Merge of a non-existing value
rocksdb_merge(db, woptions, "bar", 3, "barvalue", 8, &err);
CheckNoError(err);
CheckGet(db, roptions, "bar", "fake");
}
StartPhase("columnfamilies");
{
rocksdb_close(db);
rocksdb_destroy_db(options, dbname, &err);
CheckNoError(err)
rocksdb_options_t* db_options = rocksdb_options_create();
rocksdb_options_set_create_if_missing(db_options, 1);
db = rocksdb_open(db_options, dbname, &err);
CheckNoError(err)
rocksdb_column_family_handle_t* cfh;
cfh = rocksdb_create_column_family(db, db_options, "cf1", &err);
rocksdb_column_family_handle_destroy(cfh);
CheckNoError(err);
rocksdb_close(db);
size_t cflen;
char** column_fams = rocksdb_list_column_families(db_options, dbname, &cflen, &err);
CheckNoError(err);
// TODO column_families vals seg fault
CheckEqual("default", column_fams[0], 7);
CheckEqual("cf1", column_fams[1], 3);
CheckCondition(cflen == 2);
rocksdb_list_column_families_destroy(column_fams, cflen);
rocksdb_options_t* cf_options = rocksdb_options_create();
const char* cf_names[2] = {"default", "cf1"};
const rocksdb_options_t* cf_opts[2] = {cf_options, cf_options};
rocksdb_column_family_handle_t* handles[2];
db = rocksdb_open_column_families(db_options, dbname, 2, cf_names, cf_opts, handles, &err);
CheckNoError(err);
rocksdb_put_cf(db, woptions, handles[1], "foo", 3, "hello", 5, &err);
CheckNoError(err);
CheckGetCF(db, roptions, handles[1], "foo", "hello");
rocksdb_delete_cf(db, woptions, handles[1], "foo", 3, &err);
CheckNoError(err);
CheckGetCF(db, roptions, handles[1], "foo", NULL);
rocksdb_writebatch_t* wb = rocksdb_writebatch_create();
rocksdb_writebatch_put_cf(wb, handles[1], "baz", 3, "a", 1);
rocksdb_writebatch_clear(wb);
rocksdb_writebatch_put_cf(wb, handles[1], "bar", 3, "b", 1);
rocksdb_writebatch_put_cf(wb, handles[1], "box", 3, "c", 1);
rocksdb_writebatch_delete_cf(wb, handles[1], "bar", 3);
rocksdb_write(db, woptions, wb, &err);
CheckNoError(err);
CheckGetCF(db, roptions, handles[1], "baz", NULL);
CheckGetCF(db, roptions, handles[1], "bar", NULL);
开发者ID:AaronCsy,项目名称:rocksdb,代码行数:67,代码来源:c_test.c
注:本文中的CheckEqual函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论