• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ MojTestErrCheck函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中MojTestErrCheck函数的典型用法代码示例。如果您正苦于以下问题:C++ MojTestErrCheck函数的具体用法?C++ MojTestErrCheck怎么用?C++ MojTestErrCheck使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了MojTestErrCheck函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: testMultiEcho

	MojErr testMultiEcho()
	{
		const MojChar* echoStr = _T("{\"hello\":\"world\"}");
		MojObject expectedResponse;
		MojErr err = formatEchoResponse(echoStr, expectedResponse);
		MojTestErrCheck(err);

		MojRefCountedPtr<MojServiceRequest> req;
		err = m_service.createRequest(req);
		MojTestErrCheck(err);

		m_pendingResponseCount+= multiResponseCount;
		MojRefCountedPtr<EchoMultiResponseHdlr> hdlr(new EchoMultiResponseHdlr(expectedResponse, m_pendingResponseCount, multiResponseCount));
		MojAllocCheck(hdlr.get());

		MojObject payload;
		err = payload.fromJson(echoStr);
		MojTestErrCheck(err);
		err = req->send(hdlr->m_slot, ServiceName, _T("multiecho"), payload, MojServiceRequest::Unlimited);
		MojTestErrCheck(err);

		err = receiveResponses();
		MojTestErrCheck(err);

		return MojErrNone;
	}
开发者ID:KyleMaas,项目名称:db8,代码行数:26,代码来源:MojLunaServiceTest.cpp


示例2: MojTestAssert

MojErr MojObjectTest::emptyTest(MojObject& obj)
{
    MojObject obj2;
    MojString str1;
    MojString str2;

    bool found = false;

    MojTestAssert(obj.size() == 0);
    MojTestAssert(obj.empty());
    MojTestAssert(obj.boolValue() == false);
    MojTestAssert(obj.intValue() == 0);
    MojTestAssert(obj.decimalValue() == MojDecimal());

    MojTestAssert(obj.begin() == obj.end());
    MojTestAssert(!obj.contains(_T("hello")));
    MojTestAssert(!obj.get(_T("hi"), obj2));
    MojErr err = obj.del(_T("hello"), found);
    MojTestErrCheck(err);

    obj2.assign(obj);
    MojTestAssert(obj2.type() == obj.type());
    MojTestAssert(obj2 == obj);
    MojTestAssert(!(obj2 != obj));

    err = obj.stringValue(str1);
    MojTestErrCheck(err);
    err = obj2.stringValue(str2);
    MojTestErrCheck(err);
    MojTestAssert(str1 == str2);

    return MojErrNone;
}
开发者ID:webOS-ports,项目名称:db8,代码行数:33,代码来源:MojObjectTest.cpp


示例3: typeTest

/**
***************************************************************************************************
* @run                The MojSchema provides a mechanism to validate the JSON data objects.
                      Schema Test include the following:

                      1.typeTest
                      2.disallowTest
                      3.propertiesTest
                      4.ItemsTest
                      5.requiresTest
                      6.minmaxTest
                      7.arrayTest
                      8.stringTest
                      9.enumTest
                      10.divisibleTest
* @param            : None
* @retval           : MojErr
***************************************************************************************************
**/
MojErr MojSchemaTest::run()
{
	MojErr err = typeTest();
	MojTestErrCheck(err);
	err = disallowTest();
	MojTestErrCheck(err);
	err = propertiesTest();
	MojTestErrCheck(err);
	err = itemsTest();
	MojTestErrCheck(err);
	err = requiresTest();
	MojTestErrCheck(err);
	err = minmaxTest();
	MojTestErrCheck(err);
	err = arrayTest();
	MojTestErrCheck(err);
	err = stringTest();
	MojTestErrCheck(err);
	err = enumTest();
	MojTestErrCheck(err);
	err = divisibleTest();
	MojTestErrCheck(err);

	return MojErrNone;
}
开发者ID:ctbrowser,项目名称:db8,代码行数:44,代码来源:MojSchemaTest.cpp


示例4: MojTestErrCheck

MojErr MojDbTextTokenizerTest::check(const MojChar* text, const MojChar* tokens)
{
	// tokenize string
	MojString textStr;
	MojErr err = textStr.assign(text);
	MojTestErrCheck(err);
	MojSet<MojDbKey> set;
	MojRefCountedPtr<MojDbTextTokenizer> tokenizer(new MojDbTextTokenizer);
	MojAllocCheck(tokenizer.get());
	err = tokenizer->init(_T("en_US"));
	MojTestErrCheck(err);
	err = tokenizer->tokenize(textStr, NULL, set);
	MojTestErrCheck(err);
	// check that tokens match
	MojObject obj;
	err = obj.fromJson(tokens);
	MojTestErrCheck(err);
	MojSize objSize = obj.size();
	MojSize setSize = set.size();
	MojTestAssert(objSize == setSize);
	for (MojObject::ConstArrayIterator i = obj.arrayBegin(); i != obj.arrayEnd(); ++i) {
		MojDbKey key;
		err = key.assign(*i);
		MojTestErrCheck(err);
		MojTestAssert(set.contains(key));
	}
	return MojErrNone;
}
开发者ID:ctbrowser,项目名称:db8,代码行数:28,代码来源:MojDbTextTokenizerTest.cpp


示例5: testCancel

	MojErr testCancel()
	{
		const MojChar* echoStr = _T("{\"hello\":\"world\"}");
		MojObject expectedResponse;
		MojErr err = formatEchoResponse(echoStr, expectedResponse);
		MojTestErrCheck(err);

		MojRefCountedPtr<MojServiceRequest> req;
		err = m_service.createRequest(req);
		MojTestErrCheck(err);

		int callbackCount = 2;
		MojRefCountedPtr<EchoMultiResponseHdlr> handler(new EchoMultiResponseHdlr(expectedResponse, ++m_pendingResponseCount, callbackCount));
		MojTestAssert(handler.get());

		MojObject payload;
		err = payload.fromJson(echoStr);
		MojTestErrCheck(err);
		err = req->send(handler->m_slot, ServiceName, _T("cancellableecho"), payload, MojServiceRequest::Unlimited);
		MojTestErrCheck(err);

		err = receiveResponses();
		MojTestErrCheck(err);

		MojTestAssert(handler->callbacksRemaining() == 1); // still have callback registered because 1 more response is expected

		// cancel request
		handler->m_slot.cancel();
		sleep(1);

		return MojErrNone;
	}
开发者ID:KyleMaas,项目名称:db8,代码行数:32,代码来源:MojLunaServiceTest.cpp


示例6: getQuotaUsage

MojErr MojDbQuotaTest::testEnforce(MojDb& db)
{
	// set quota size to current usage
	MojInt64 quotaUsage1 = 0;
	MojErr err = getQuotaUsage(db, _T("com.foo.bar"), quotaUsage1);
	MojTestErrCheck(err);
	MojObject obj;
	err = obj.putString(_T("owner"), _T("com.foo.bar"));
	MojErrCheck(err);
	err = obj.putInt(_T("size"), quotaUsage1);
	MojErrCheck(err);
	err = db.putQuotas(&obj, &obj + 1);
	MojErrCheck(err);
	err = put(db, MojTestKind1Objects[3]);
	MojTestErrExpected(err, MojErrDbQuotaExceeded);
	// make sure we can delete the kind
	MojString kindStr;
	err = kindStr.assign(_T("Test:1"));
	MojTestErrCheck(err);
	bool found = false;
	err = db.delKind(kindStr, found);
	MojTestErrCheck(err);
	MojTestAssert(found);

	return MojErrNone;
}
开发者ID:anttiharju-owo,项目名称:db8,代码行数:26,代码来源:MojDbQuotaTest.cpp


示例7: MojTestErrCheck

MojErr MojDbSearchCacheTest::testQueryKey()
{
    MojDbQuery query1;
    MojErr err=query1.from(_T("test:1"));
    MojTestErrCheck(err);
    err=query1.where(_T("attr1"), MojDbQuery::OpGreaterThan, 1);
    MojTestErrCheck(err);

    MojDbSearchCache::QueryKey key1;
    key1.fromQuery(query1, 1234);

    // Verify fromQuery() works fine.
    MojTestAssert(key1.getKind() == _T("test:1"));
    MojTestAssert(key1.getRev() == 1234);

    MojDbSearchCache::QueryKey key2;
    key2.fromQuery(query1, 1235);

    // key1 shall be less then key2.
    //
    MojTestAssert(key1 < key2);
    MojTestAssert(!(key2 < key1));
    MojTestAssert(!(key1 == key2));

    // key1 shall be equal to key1.
    //
    MojTestAssert(!(key1 < key1));
    MojTestAssert(key1 == key1);

    return MojErrNone;
}
开发者ID:ctbrowser,项目名称:db8,代码行数:31,代码来源:MojDbSearchCacheTest.cpp


示例8: MojTestErrCheck

MojErr MojDbPerfCreateTest::putLargeArrayObj(MojDb& db, const MojChar* kindId, MojUInt64& lgArrayObjTime)
{
	timespec startTime;
	startTime.tv_nsec = 0;
	startTime.tv_sec = 0;
	timespec endTime;
	endTime.tv_nsec = 0;
	endTime.tv_sec = 0;

	for (MojUInt64 i = 0; i < numInsert; i++) {
		MojObject obj;
		MojErr err = obj.putString(MojDb::KindKey, kindId);
		MojTestErrCheck(err);
		err = createLargeArrayObj(obj, i);
		MojTestErrCheck(err);

		clock_gettime(CLOCK_REALTIME, &startTime);
		err = db.put(obj);
		MojTestErrCheck(err);
		clock_gettime(CLOCK_REALTIME, &endTime);
		lgArrayObjTime += timeDiff(startTime, endTime);
		totalTestTime += timeDiff(startTime, endTime);
	}

	return MojErrNone;
}
开发者ID:leesangryong,项目名称:db8,代码行数:26,代码来源:MojDbPerfCreateTest.cpp


示例9: MojTestErrCheck

MojErr MojDbIndexTest::assertCanAnswer(const MojChar* propsJson, const MojChar* queryJson,
		bool result, bool indexIncludeDeleted)
{
	MojObject propsObj;
	MojErr err = propsObj.fromJson(propsJson);
	MojTestErrCheck(err);
	MojObject queryObj;
	err = queryObj.fromJson(queryJson);
	MojTestErrCheck(err);

	MojDbIndex index(NULL, NULL);
	MojObject prop;
	MojSize i = 0;
	for (;;) {
		if(propsObj.at(i++, prop)) {
			err = index.addProp(prop);
			MojTestErrCheck(err);
		} else {
			break;
		}
	}
	index.incDel(indexIncludeDeleted);
	MojRefCountedPtr<MojDbStorageIndex> storageIndex(new TestIndex(false));
	MojAllocCheck(storageIndex.get());
	MojDbReq req;
	err = index.open(storageIndex.get(), (MojInt64) 0, req);
	MojTestErrCheck(err);

	MojDbQuery query;
	err = query.fromObject(queryObj);
	MojTestErrCheck(err);
	MojTestAssert(index.canAnswer(query) == result);

	return MojErrNone;
}
开发者ID:BigBlueHat,项目名称:db8,代码行数:35,代码来源:MojDbIndexTest.cpp


示例10: getQuotaUsage

MojErr MojDbQuotaTest::testEnforce(MojDb& db)
{
	// set quota size to current usage
	MojInt64 quotaUsage1 = 0;
	MojErr err = getQuotaUsage(db, _T("com.foo.bar"), quotaUsage1);
	MojTestErrCheck(err);
	MojObject obj;
	err = obj.putString(_T("owner"), _T("com.foo.bar"));
	MojErrCheck(err);
	err = obj.putInt(_T("size"), quotaUsage1);
	MojErrCheck(err);
	err = db.putQuotas(&obj, &obj + 1);
	MojErrCheck(err);
	err = put(db, MojTestKind1Objects[3]);
	MojTestErrExpected(err, MojErrDbQuotaExceeded);
	// Try to delete the kind
	MojString kindStr;
	err = kindStr.assign(_T("Test:1"));
	MojTestErrCheck(err);
	bool found = false;
	err = db.delKind(kindStr, found);

    //The delete should be failure, because it contain sub kind "Test2:1"
    MojTestErrExpected(err,MojErrDbKindHasSubKinds); 
    MojTestAssert(!found); 

	return MojErrNone;
}
开发者ID:rogerjstringer,项目名称:db8,代码行数:28,代码来源:MojDbQuotaTest.cpp


示例11: invalidTest

MojErr MojDbIndexTest::run()
{
	MojErr err = invalidTest();
	MojTestErrCheck(err);
	err = simpleTest();
	MojTestErrCheck(err);
	err = nestedTest();
	MojTestErrCheck(err);
	err = compoundTest();
	MojTestErrCheck(err);
	err = canAnswerTest();
	MojTestErrCheck(err);
	err = deletedTest();
	MojTestErrCheck(err);
	err = wildcardTest();
	MojTestErrCheck(err);
	err = defaultValuesTest();
	MojTestErrCheck(err);
	err = multiTest();
	MojTestErrCheck(err);
	err = tokenizeTest();
	MojTestErrCheck(err);

	return MojErrNone;
}
开发者ID:BigBlueHat,项目名称:db8,代码行数:25,代码来源:MojDbIndexTest.cpp


示例12: MojThreadTestFn

static MojErr MojThreadTestFn(void* arg)
{
	static MojThreadLocalValue<int, MojThreadLocalValueZeroCtor<int> > s_localVal;
	MojThreadTestArgs* targs = (MojThreadTestArgs*) arg;
	MojTestAssert(targs);

	for (int i = 0; i < MojTestNumIterations; ++i) {
		targs->m_atomicCounter.increment();
		MojThreadGuard guard(targs->m_mutex, false);
		if (!guard.tryLock())
			guard.lock();
		++(targs->m_counter);
		if (targs->m_counter == (MojTestNumThreads * MojTestNumIterations)) {
			MojErr err = targs->m_countCond.signal();
			MojTestErrCheck(err);
		}
	}

	MojErr err = MojThreadYield();
	MojTestErrCheck(err);

	MojThreadGuard guard(targs->m_mutex);
	while (targs->m_wait) {
		err = targs->m_waitCond.wait(targs->m_mutex);
		MojTestErrCheck(err);
	}
	guard.unlock();

	int* localVal = NULL;
	err = s_localVal.get(localVal);
	MojTestErrCheck(err);
	MojTestAssert(localVal && *localVal == 0);

	for (int i = 0; i < MojTestNumIterations; ++i) {
		++(*localVal);
		targs->m_atomicCounter.decrement();
		{
			MojThreadReadGuard readGuard(targs->m_rwlock);
			MojTestAssert(targs->m_counter > 0);
		}
		MojThreadReadGuard readGuard(targs->m_rwlock, false);
		if (!readGuard.tryLock())
			readGuard.lock();
		MojTestAssert(targs->m_counter > 0);
		readGuard.unlock();

		{
			MojThreadWriteGuard writeGuard(targs->m_rwlock);
			++(targs->m_counter);
		}

		MojThreadWriteGuard writeGuard(targs->m_rwlock, false);
		if (!writeGuard.tryLock())
			writeGuard.lock();
		targs->m_counter -= 2;
	}
	MojTestAssert(*localVal == MojTestNumIterations);

	return MojErrNone;
}
开发者ID:KyleMaas,项目名称:db8,代码行数:60,代码来源:MojThreadTest.cpp


示例13: formatEchoResponse

	MojErr formatEchoResponse(const MojChar* str, MojObject& respOut)
	{
		MojErr err = respOut.putBool(MojServiceMessage::ReturnValueKey, true);
		MojTestErrCheck(err);
		err = respOut.putString(_T("echo"), str);
		MojTestErrCheck(err);
		return MojErrNone;
	}
开发者ID:KyleMaas,项目名称:db8,代码行数:8,代码来源:MojLunaServiceTest.cpp


示例14: basicTest

MojErr MojThreadTest::run()
{
	MojErr err = basicTest();
	MojTestErrCheck(err);
	err = errTest();
	MojTestErrCheck(err);

	return MojErrNone;
}
开发者ID:KyleMaas,项目名称:db8,代码行数:9,代码来源:MojThreadTest.cpp


示例15: MojTestErrCheck

MojErr MojDbQuotaTest::getKindUsage(MojDb& db, const MojChar* kindId, MojInt64& usageOut)
{
	MojRefCountedPtr<MojDbStorageTxn> txn;
	MojErr err = db.storageEngine()->beginTxn(txn);
	MojTestErrCheck(err);
	err = db.quotaEngine()->kindUsage(kindId, usageOut, txn.get());
	MojTestErrCheck(err);

	return MojErrNone;
}
开发者ID:rogerjstringer,项目名称:db8,代码行数:10,代码来源:MojDbQuotaTest.cpp


示例16: MojTestErrCheck

MojErr MojDbPerfUpdateTest::testMerge(MojDb& db)
{
	MojString buf;
	MojErr err = buf.format("\nUPDATE VIA MERGE,,,,,\n");
	MojTestErrCheck(err);
	err = fileWrite(file, buf);
	MojTestErrCheck(err);

	err = updateObjsViaMerge(db, MojPerfSmKindId, &MojDbPerfTest::createSmallObj);
	MojTestErrCheck(err);
	err = updateObjsViaMerge(db, MojPerfMedKindId, &MojDbPerfTest::createMedObj);
	MojTestErrCheck(err);
	err = updateObjsViaMerge(db, MojPerfLgKindId, &MojDbPerfTest::createLargeObj);
	MojTestErrCheck(err);
	err = updateObjsViaMerge(db, MojPerfMedNestedKindId, &MojDbPerfTest::createMedNestedObj);
	MojTestErrCheck(err);
	err = updateObjsViaMerge(db, MojPerfLgNestedKindId, &MojDbPerfTest::createLargeNestedObj);
	MojTestErrCheck(err);
	err = updateObjsViaMerge(db, MojPerfMedArrayKindId, &MojDbPerfTest::createMedArrayObj);
	MojTestErrCheck(err);
	err = updateObjsViaMerge(db, MojPerfLgArrayKindId, &MojDbPerfTest::createLargeArrayObj);
	MojTestErrCheck(err);

	return MojErrNone;
}
开发者ID:KyleMaas,项目名称:db8,代码行数:25,代码来源:MojDbPerfUpdateTest.cpp


示例17: intTest

MojErr MojVectorTest::run()
{
	MojErr err = intTest();
	MojTestErrCheck(err);
	err = stringTest();
	MojTestErrCheck(err);
	err = objTest();
	MojTestErrCheck(err);

	return MojErrNone;
}
开发者ID:BigBlueHat,项目名称:db8,代码行数:11,代码来源:MojVectorTest.cpp


示例18: initQuery

MojErr MojDbSearchTest::check(MojDb& db, const MojChar* queryStr, const MojChar* expectedIdsJson,
		const MojChar* orderBy, const MojObject& barVal, bool desc)
{
	MojDbQuery query;
	MojErr err = initQuery(query, queryStr, orderBy, barVal, desc);
	MojTestErrCheck(err);
	err = check(db, query, expectedIdsJson);
	MojTestErrCheck(err);

	return MojErrNone;
}
开发者ID:ctbrowser,项目名称:db8,代码行数:11,代码来源:MojDbSearchTest.cpp


示例19: MojThreadCreate

MojErr MojThreadTest::errTest()
{
	MojThreadT thread = MojInvalidThread;
	MojErr err = MojThreadCreate(thread, MojThreadTestErrFn, NULL);
	MojTestErrCheck(err);
	MojErr threadErr = MojErrNone;
	err = MojThreadJoin(thread, threadErr);
	MojTestErrCheck(err);
	MojTestErrExpected(threadErr, MojErrNotFound);

	return MojErrNone;
}
开发者ID:KyleMaas,项目名称:db8,代码行数:12,代码来源:MojThreadTest.cpp


示例20: MojTestErrCheck

MojErr MojDbWatchTest::merge(MojDb& db, const MojObject& id, const MojObject& barVal)
{
    MojObject obj;
    MojErr err = obj.put(MojDb::IdKey, id);
    MojTestErrCheck(err);
    err = obj.put(_T("bar"), barVal);
    MojTestErrCheck(err);

    err = db.merge(obj);
    MojTestErrCheck(err);

    return MojErrNone;
}
开发者ID:halfhalo,项目名称:db8,代码行数:13,代码来源:MojDbWatchTest.cpp



注:本文中的MojTestErrCheck函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ MonitorFromPoint函数代码示例发布时间:2022-05-30
下一篇:
C++ MojLogInfo函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap