本文整理汇总了C++中TestObject类的典型用法代码示例。如果您正苦于以下问题:C++ TestObject类的具体用法?C++ TestObject怎么用?C++ TestObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TestObject类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: TestObject
void AgentThread::processCMDSTART_REQUEST(int socketHandle)
{
try {
ConsoleServer::debugMsg(1,"Processing CMDSTART_REQUEST\n");
// read the serialized TestObject which we will execute
TestObject *test = new TestObject();
test->readTestObject(socketHandle);
// now send a signal indicating we are processing the request
Utils::sendSignal(socketHandle,RESPONSE_PROCESSING);
// execute the test
ExecProcess *startedProcess = addProcess(new ExecProcess(test,
debugLevel,
showOutput));
startedProcess->run();
ConsoleServer::debugMsg(1,
"Added pid %d to process pool (total %d processes)\n",
startedProcess->getPid(),
getProcessCount());
// now send a signal indicating we have finished
Utils::sendSignal(socketHandle,RESPONSE_FINISHED_OK);
}
catch (char *message) {
ConsoleServer::debugMsg(1,"Error processing CMDSTART_REQUEST execute request:%s\n",message);
Utils::sendSignal(socketHandle,RESPONSE_FINISHED_ERROR);
}
};
开发者ID:dineshkummarc,项目名称:qat-2.7.1-src,代码行数:30,代码来源:AgentThread.cpp
示例2: TEST
TEST(test_large_visibe_char_1, DISKQUEUE_MULTI_READ_ONE_WRITE) {
DiskQueue<TestObject> disk_queue("queue/zhangsan", 1, 1024*1024*10, serializer, deserializer);
ASSERT_EQ(1, disk_queue.empty());
ASSERT_STREQ("queue/zhangsan", disk_queue.getQueueName());
ASSERT_EQ(1, disk_queue.getMode());
ASSERT_EQ(1024*1024*10, disk_queue.getMaxFileSize());
int i;
std::queue<TestObject*> TestObjectQueue;
for(i = 0; i < 1024*10*10; i++) {//10M * 10
TestObject* tmp = TestObject::createRandomOne(1024, 0);
TestObject* tmp1 = tmp->copy();
TestObjectQueue.push(tmp1);
ASSERT_EQ(1, disk_queue.push(tmp));
}
while(!TestObjectQueue.empty()) {
TestObject* tmp = TestObjectQueue.front();
TestObjectQueue.pop();
TestObject* tmp2 = NULL;
ASSERT_EQ(0, disk_queue.empty());
ASSERT_EQ(1, disk_queue.pop(&tmp2));
ASSERT_STREQ(tmp->getData(), tmp2->getData());
delete tmp;
delete tmp2;
}
ASSERT_EQ(1, disk_queue.empty());
}
开发者ID:IsCaster,项目名称:tair-rdb,代码行数:30,代码来源:disk_queue_unittest.cpp
示例3: c
void tst_qqmlexpression::scriptString()
{
qmlRegisterType<TestObject>("Test", 1, 0, "TestObject");
QQmlEngine engine;
QQmlComponent c(&engine, testFileUrl("scriptString.qml"));
TestObject *testObj = qobject_cast<TestObject*>(c.create());
QVERIFY(testObj != 0);
QQmlScriptString script = testObj->scriptString();
QVERIFY(!script.isEmpty());
QQmlExpression expression(script);
QVariant value = expression.evaluate();
QCOMPARE(value.toInt(), 15);
QQmlScriptString scriptError = testObj->scriptStringError();
QVERIFY(!scriptError.isEmpty());
//verify that the expression has the correct error location information
QQmlExpression expressionError(scriptError);
QVariant valueError = expressionError.evaluate();
QVERIFY(!valueError.isValid());
QVERIFY(expressionError.hasError());
QQmlError error = expressionError.error();
QCOMPARE(error.url(), c.url());
QCOMPARE(error.line(), 8);
}
开发者ID:SamuelNevala,项目名称:qtdeclarative,代码行数:28,代码来源:tst_qqmlexpression.cpp
示例4: kTypeObjectArray
void JavaClassUtilsTest::makeNameForSignatureWithArrayOfObjects(JNIEnv *env, jobject javaThis) {
std::string result;
TestObject testObject;
JavaClassUtils::makeNameForSignature(result, kTypeObjectArray(MAKE_CANONICAL_NAME(PACKAGE, TestObject)));
std::stringstream expected;
expected << "[L" << testObject.getCanonicalName() << ";";
JUNIT_ASSERT_EQUALS_STRING(expected.str().c_str(), result);
}
开发者ID:Neils320,项目名称:JniHelpers,代码行数:8,代码来源:JavaClassUtilsTest.cpp
示例5: makeNameForSignatureWithJniSignature
void JavaClassUtilsTest::makeNameForSignatureWithJniSignature(JNIEnv *env, jobject javaThis) {
std::string result;
TestObject testObject;
std::stringstream signature;
signature << "L" << testObject.getCanonicalName() << ";";
JavaClassUtils::makeNameForSignature(result, signature.str().c_str());
JUNIT_ASSERT_EQUALS_STRING(signature.str().c_str(), result);
}
开发者ID:Neils320,项目名称:JniHelpers,代码行数:8,代码来源:JavaClassUtilsTest.cpp
示例6: ExperimentSingle
void ExperimentSingle(TestSetting ts) {
if (ts.getConfigBool("autoTestName")==true) {
ts.testName.insert(0,"v_single_");
cout << "(auto) testName: " << ts.testName << endl;
}
TestObject *expTest = new TestObject(ts);
expTest->runStaticTest();
delete expTest;
}
开发者ID:jenslyn42,项目名称:phd-backup,代码行数:10,代码来源:main.cpp
示例7: TestObject
void ObjectTest::TestAddDestroyListener()
{
TestObject* obj = new TestObject();
ObjectListener objectListener;
obj->AddDestroyListener(berry::MessageDelegate<ObjectListener>(
&objectListener, &ObjectListener::DestroyListener));
delete obj;
assertEqual(true, objectListener.m_ObjectDeleted);
}
开发者ID:test-fd301,项目名称:MITK,代码行数:11,代码来源:berryObjectTest.cpp
示例8: TEUCHOS_UNIT_TEST
TEUCHOS_UNIT_TEST(global_data, accessor_default_impl)
{
Teuchos::RCP<panzer::GlobalData> gd = panzer::createGlobalData();
TestObject t;
t.setGlobalData(gd);
TestObject2 t2(gd);
TEST_EQUALITY(gd.get(), t2.getGlobalData().get());
}
开发者ID:00liujj,项目名称:trilinos,代码行数:12,代码来源:global_data.cpp
示例9: serializer
bool serializer(TestObject* data, tbnet::DataBuffer** dataBuffer) {
TestObject* node = (TestObject*)data;
char* t_value = node->getData();
int t_value_len = node->getDataLen();
tbnet::DataBuffer* buffer = new tbnet::DataBuffer();
buffer->writeInt32(t_value_len);
buffer->writeBytes(t_value,t_value_len);
(*dataBuffer) = buffer;
return true;
}
开发者ID:IsCaster,项目名称:tair-rdb,代码行数:12,代码来源:disk_queue_unittest.cpp
示例10: main
int main(int argc, char* argv[])
{
/* get the NetAddr of the server */
NetAddr netAddr(argv[1]);
/* get netaddr to the proxy */
NetAddr proxy(argv[2]);
/* get size of objects */
int objectSize;
istringstream ss(argv[3]);
ss >> objectSize;
/* Initialize Server with our NetAddr */
Ginnungagap::Initialize(SERVER, 50, netAddr, netAddr);
/* Start necessary threads */
Ginnungagap::Instance()->startDataSenderThread();
Ginnungagap::Instance()->startDataAndConnectionReceiverThread();
Ginnungagap::Instance()->startMessageHandlerThread();
/* set terminal in ``any key''-mode */
struct termios oldT, newT;
ioctl(0, TCGETS, &oldT);
newT = oldT;
newT.c_lflag &= ~ECHO;
newT.c_lflag &= ~ICANON;
ioctl(0, TCSETS, &newT);
cout << "Press any key once proxy is connected" << endl;
cin.get();
cout << "Migrating objects..." << endl;
TestObject* test;
for (int i = 0; i != 10000; ++i)
{
test = new TestObject(objectSize);
Ginnungagap::Instance()->nameService()->bind(*test);
Ginnungagap::Instance()->migrationService()->migrateObject(test->objectId(), proxy);
usleep(30000);
}
cout << "Done migrating objects, press any key to exit" << endl;
cin.get();
/* restore original terminal mode */
ioctl(0, TCSETS, &oldT);
return 1;
}
开发者ID:GunioRobot,项目名称:ginnungagap,代码行数:50,代码来源:TestMigServer.cpp
示例11: main
void main()
{
// using a bit of random here.
srand(time(nullptr)); //initialize random seed based on time
// Where will this object live? Is this a good choice? Why or why not?
TestObject anObject = TestObject(30);
// Name differences between pointers and references
TestObject *anotherObject = new TestObject(2); //error: new returns a pointer-> '*'
// When should we use pointers, references and values? why?
TestObject &referenceToAnObject = anObject; //error: no &
TestObject &referenceToAnotherObject = *anotherObject; //error original adress called with '*'
TestObject* pointerToAnObject = &anObject; //error: for pointer,adress of obj. is needed with &
TestObject* pointerToAnotherObject = &referenceToAnotherObject; // error fix: for pointer, adress of Obj. is needed with '&'
// Testing if the correct strings are being printed.
referenceToAnotherObject.printAllStrings();
std::cout << "The Following should be the same as above: " << std::endl;
pointerToAnotherObject->printAllStrings();
std::cout << std::endl << "total number of strings:" << std::endl;
int& TotalElementNumber = sumTheElements(referenceToAnObject.elementCount(), referenceToAnotherObject.elementCount());
std::cout << TotalElementNumber << std::endl;
std::cout << "Do calculations in another scope and display the same value again inside that scope: " << std::endl;
{
//this isn't really doing anything, just for testing purposes
int ignoreMe = 20;
ignoreMe *= TotalElementNumber;
std::cout << TotalElementNumber << std::endl;
}
std::cout << "And again outside the scope: " << std::endl;
std::cout << TotalElementNumber << std::endl;
delete anotherObject;
//cant delete objects with stack
//delete pointerToAnObject;
//delete pointerToAnotherObject;
}
开发者ID:iLiptho,项目名称:Grundlagen_Cpp,代码行数:49,代码来源:program.cpp
示例12: getProcess
void AgentThread::processDAEMONCLEAN_REQUEST(int socketHandle)
{
try {
ConsoleServer::debugMsg(1,"Processing DAEMONCLEAN_REQUEST\n");
// now send a signal indicating we are processing the request
Utils::sendSignal(socketHandle,RESPONSE_PROCESSING);
//clean the files now
for (int i = getProcessCount()-1; i >=0; i--) {
// check for any instance of test running with the same id
TestObject *curr = getProcess(i)->getTestObject();
if (getProcess(i)->isDaemon()) {
ConsoleServer::debugMsg(1,"Cleaning daemon %d\n",i);
// clean up the trace files
ConsoleServer::debugMsg(1,
"Cleaning environment file :%s\n",
curr->getEnvFileName().c_str());
if (Utils::delete_file(curr->getEnvFileName())!=0)
ConsoleServer::debugMsg(1,"No environment file was found :%s\n",
curr->getEnvFileName().c_str());
ConsoleServer::debugMsg(1,"Cleaning stdout file :%s\n",
curr->getStdOutFileName().c_str());
if (Utils::delete_file(curr->getStdOutFileName())!=0)
ConsoleServer::debugMsg(1,"No stdout file was found :%s\n",
curr->getStdOutFileName().c_str());
ConsoleServer::debugMsg(1,"Cleaning stderr file :%s\n",
curr->getStdErrFileName().c_str());
if (Utils::delete_file(curr->getStdErrFileName())!=0)
ConsoleServer::debugMsg(1,"No stderr file was found :%s\n",
curr->getStdErrFileName().c_str());
// remove from our list of test objects
ConsoleServer::debugMsg(1,"Removing process from process pool\n");
delProcess(i);
}
}
// now send a signal indicating we have finished
Utils::sendSignal(socketHandle,RESPONSE_FINISHED_OK);
}
catch (char * message) {
ConsoleServer::debugMsg(1,"Error processing DAEMONCLEAN_REQUEST request:%s\n",message);
Utils::sendSignal(socketHandle,RESPONSE_FINISHED_ERROR);
}
};
开发者ID:dineshkummarc,项目名称:qat-2.7.1-src,代码行数:47,代码来源:AgentThread.cpp
示例13: ExperimentVaryRange
void ExperimentVaryRange(TestSetting ts) {
if (ts.getConfigBool("autoTestName")==true) {
ts.testName.insert(0,"v_range_");
cout << "(auto) testName: " << ts.testName << endl;
}
int lowRange = ts.getConfigInt("lowRange");
int highRange = ts.getConfigInt("highRange");
for (int range = lowRange; range <= highRange ; range*=2) {
ts.range = range;
cout << "*** Now using ts.range = " << ts.range << endl;
TestObject *expTest = new TestObject(ts);
expTest->runStaticTest();
delete expTest;
}
}
开发者ID:jenslyn42,项目名称:phd-backup,代码行数:18,代码来源:main.cpp
示例14: ExperimentVaryCacheSize
void ExperimentVaryCacheSize(TestSetting ts) {
if (ts.getConfigBool("autoTestName")==true) {
ts.testName.insert(0,"v_cachesize_");
cout << "(auto) testName: " << ts.testName << endl;
}
unsigned long lowCacheSize = ts.getConfigLong("lowCacheSize");
unsigned long highCacheSize = ts.getConfigLong("highCacheSize");
for (unsigned long csize = lowCacheSize; csize <= highCacheSize ; csize*=2) {
ts.cacheSize = csize;
cout << "*** Now using ts.cacheSize = " << ts.cacheSize << endl;
TestObject *expTest = new TestObject(ts);
expTest->runStaticTest();
delete expTest;
}
}
开发者ID:jenslyn42,项目名称:phd-backup,代码行数:18,代码来源:main.cpp
示例15: ExperimentVarySplit
void ExperimentVarySplit(TestSetting ts) {
if (ts.getConfigBool("autoTestName")==true) {
ts.testName.insert(0,"v_split_");
cout << "(auto) testName: " << ts.testName << endl;
}
int lowSplit = ts.getConfigInt("lowSplit");
int highSplit = ts.getConfigInt("highSplit");
for (int splits = lowSplit; splits <= highSplit ; splits+=2) {
ts.splits = splits;
cout << "*** Now using ts.splits = " << ts.splits << endl;
TestObject *expTest = new TestObject(ts);
expTest->runStaticTest();
delete expTest;
}
}
开发者ID:jenslyn42,项目名称:phd-backup,代码行数:18,代码来源:main.cpp
示例16: main
int main(int argc, char *argv[])
{
try {
qlua::LuaContext ctx;
TestObject myobj;
myobj.setObjectName( "MyObject" );
//only add a single method to the Lua table
ctx.AddQObject( &myobj, "myobj", false,
qlua::LuaContext::QOBJ_NO_DELETE, qlua::LuaDefaultSignatureMapper(),
QStringList() << "emitSignal" );
ctx.Eval( "qlua.connect( myobj, 'aSignal(QString)', "
"function(msg) print( 'Lua callback called with data: ' .. msg ); end );"
"print( 'object name: ' .. myobj.objectName );"
"qlua.connect( myobj, 'aSignal(QString)', myobj, 'aSlot(QString)' );"
"myobj.emitSignal('hello')" );
TestObject* myobj2 = new TestObject;
QPointer< TestObject > pMyObject2 = myobj2;
myobj2->setObjectName( "MyObject2" );
ctx.AddQObject( myobj2, "myobj2", false, qlua::LuaContext::QOBJ_IMMEDIATE_DELETE );
ctx.Eval( "print( 'object 2 name: '..myobj2.objectName )" );
ctx.Eval( "myobj2=nil;collectgarbage('collect')");
if( pMyObject2.isNull() ) std::cout << "Object 2 garbage collected by Lua" << std::endl;
else std::cerr << "Object 2 not garbage collected!" << std::endl;
TestObject myobj3;
ctx.AddQObject( &myobj3, "myobj3", false, qlua::LuaContext::QOBJ_NO_DELETE );
ctx.Eval( "print( myobj3.copyString( 'hi' ) );"
"vm = myobj3.copyVariantMap( {key1=1,key2='hello'} );"
"print( vm['key1'] .. ' ' .. vm['key2'] );"
"print( myobj3.createObject().objectName );" );
ctx.Eval( "fl = myobj3.copyShortList( {1,2,3} );\n"
"print( fl[1] .. ' ' .. fl[ 3 ] );\n" );
} catch( const std::exception& e ) {
std::cerr << e.what() << std::endl;
}
return 0;
}
开发者ID:black13,项目名称:luabind-vs2010,代码行数:43,代码来源:main.cpp
示例17: startTest
void ActiveObjectTest::startTest()
{
TestObject test;
test.start();
QVERIFY( test.isStarted() );
// Wait for a while (it takes some time for a thread to start).
std::chrono::system_clock::time_point start = std::chrono::system_clock::now();
while (std::chrono::system_clock::now() - start < std::chrono::milliseconds(100) );
test.stop();
QVERIFY( !test.isStarted() );
QVERIFY( test.actionCalled() );
}
开发者ID:PerttuP,项目名称:PPUtils,代码行数:14,代码来源:tst_activeobjecttest.cpp
示例18: onUpdateObject
//------------------------------------------------------------------------------
// onUpdateObject() - bring our test object in and fill our data.
//------------------------------------------------------------------------------
bool ObjectHandler::onUpdateObject(const TestObject* const x)
{
if (x != nullptr) {
TestObject* obj = const_cast<TestObject*>(x);
bool boolVal = obj->getBoolean();
send("objboolean", UPDATE_VALUE, boolVal, boolSD);
int intVal = obj->getInteger();
send("objinteger", UPDATE_VALUE, intVal, intSD);
float floatVal = obj->getFloat();
send("objfloat", UPDATE_VALUE, floatVal, floatSD);
double doubleVal = obj->getDouble();
send("objdouble", UPDATE_VALUE, doubleVal, doubleSD);
double realVal = obj->getReal();
send("objreal", UPDATE_VALUE, realVal, realSD);
const char* myChar = obj->getChar();
send("objascii", UPDATE_VALUE, myChar, charSD);
}
return true;
}
开发者ID:,项目名称:,代码行数:23,代码来源:
示例19: test002
void test002() {
IStaticServiceHandler* handler;
TestObject* test;
IObject* obj;
ITestInterface *itest;
handler = new StaticServiceHandler;
ASSERT(handler != 0, "could not instantiate static service handler");
test = new TestObject;
ASSERT(test != 0, "could not instantiate test object");
VERIFY(test->getRefCount() == 1, "the test object has an incorrect refcount");
handler->addObject(TestObject_CID, test);
VERIFY(test->getRefCount() == 2, "static service handler did not addRef the test component");
obj = handler->getObject(TestObject_CID);
ASSERT(obj != 0, "could not get test component from static service handler");
itest = mutate<ITestInterface>(obj);
ASSERT(itest != 0, "test component does not have the expected interface");
VERIFY(test->getRefCount() == 3, "the test object has an incorrect refcount");
itest->setRefCount(10);
itest->addRef();
VERIFY(itest->getRefCount() == 11, "test component has unexpected behavior");
itest->setRefCount(3);
VERIFY(itest->release() == 2, "test component has incorrect refcount");
handler->removeObject(TestObject_CID);
VERIFY(test->getRefCount() == 1, "static service handler did not release the test component");
obj = handler->getObject(TestObject_CID);
VERIFY(!obj, "static service handler did not remove the test component");
if(obj)
obj->release();
VERIFY(handler->release() == 0, "static service handler has non-zero refcount after release");
VERIFY(test->release() == 0, "test object has non-zero refcount after release");
xplcdelete test;
}
开发者ID:BackupTheBerlios,项目名称:xplc-svn,代码行数:45,代码来源:test002.cpp
示例20: testDeregisterObjects
void TestWebChannel::testDeregisterObjects()
{
QWebChannel channel;
TestObject testObject;
testObject.setObjectName("myTestObject");
channel.registerObject(testObject.objectName(), &testObject);
channel.connectTo(m_dummyTransport);
channel.d_func()->publisher->initializeClient(m_dummyTransport);
QJsonObject connectMessage =
QJsonDocument::fromJson(("{\"type\": 7,"
"\"object\": \"myTestObject\","
"\"signal\": " + QString::number(testObject.metaObject()->indexOfSignal("sig1()"))
+ "}").toLatin1()).object();
channel.d_func()->publisher->handleMessage(connectMessage, m_dummyTransport);
emit testObject.sig1();
channel.deregisterObject(&testObject);
emit testObject.sig1();
}
开发者ID:RobinWuDev,项目名称:Qt,代码行数:23,代码来源:tst_webchannel.cpp
注:本文中的TestObject类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论