本文整理汇总了C++中PEGASUS_TEST_ASSERT函数的典型用法代码示例。如果您正苦于以下问题:C++ PEGASUS_TEST_ASSERT函数的具体用法?C++ PEGASUS_TEST_ASSERT怎么用?C++ PEGASUS_TEST_ASSERT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PEGASUS_TEST_ASSERT函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: testCreateLocalAuthFile
void testCreateLocalAuthFile(void)
{
int testUid;
int testGid;
PEGASUS_TEST_ASSERT(
GetUserInfo(PEGASUS_CIMSERVERMAIN_USER, &testUid, &testGid) == 0);
/* Test with file path that already exists */
{
ssize_t result;
const char* path = "testlocalauthfile";
int fd = open(path, O_WRONLY | O_EXCL | O_CREAT | O_TRUNC, S_IRUSR);
EXECUTOR_RESTART(write(fd, "test", 4), result);
close(fd);
PEGASUS_TEST_ASSERT(CreateLocalAuthFile(path, testUid, testGid) == 0);
unlink(path);
}
/* Test with non-existent directory in file path */
{
const char* path =
"/tmp/nonexistentdirectory/anotherone/pegasus/localauthtestfile";
PEGASUS_TEST_ASSERT(CreateLocalAuthFile(path, testUid, testGid) != 0);
}
}
开发者ID:brunolauze,项目名称:pegasus,代码行数:25,代码来源:TestExecutorLocalAuth.c
示例2: testCheckLocalAuthToken
void testCheckLocalAuthToken(void)
{
/* Test with file path that does not exist */
{
const char* path = "nonexistenttestfile";
PEGASUS_TEST_ASSERT(CheckLocalAuthToken(path, "secret") != 0);
}
/* Test with secret token that is too short */
{
ssize_t result;
const char* path = "testlocalauthfile";
int fd = open(path, O_WRONLY | O_EXCL | O_CREAT | O_TRUNC, S_IRUSR);
EXECUTOR_RESTART(write(fd, "secret", 6), result);
close(fd);
PEGASUS_TEST_ASSERT(CheckLocalAuthToken(path, "secret") != 0);
unlink(path);
}
/* Test with incorrect secret token */
{
ssize_t result;
const char* path = "testlocalauthfile";
int fd = open(path, O_WRONLY | O_EXCL | O_CREAT | O_TRUNC, S_IRUSR);
EXECUTOR_RESTART(
write(fd, "1234567890123456789012345678901234567890", 40), result);
close(fd);
PEGASUS_TEST_ASSERT(CheckLocalAuthToken(
path, "123456789012345678901234567890123456789X") != 0);
unlink(path);
}
}
开发者ID:brunolauze,项目名称:pegasus,代码行数:32,代码来源:TestExecutorLocalAuth.c
示例3: methodName
void _sendIndicationShouldBeBlocked
(CIMClient & client)
{
Array <CIMParamValue> inParams;
Array <CIMParamValue> outParams;
Array <CIMKeyBinding> keyBindings;
Sint32 result;
CIMName methodName ("SendTestIndication");
CIMObjectPath className (String::EMPTY, CIMNamespaceName (),
CIMName("Test_IndicationProviderClass"), keyBindings);
try
{
CIMValue retValue = client.invokeMethod
(SOURCENAMESPACE,
className,
methodName,
inParams,
outParams);
retValue.get (result);
PEGASUS_TEST_ASSERT (false);
}
catch (CIMException & e)
{
PEGASUS_TEST_ASSERT (e.getCode () == CIM_ERR_NOT_SUPPORTED);
}
}
开发者ID:host1812,项目名称:scx_plugin_public,代码行数:28,代码来源:DisableEnable2.cpp
示例4: runCIMNameCastTests
void runCIMNameCastTests()
{
try
{
CIMName name(CIMNameCast("Okay"));
}
catch (...)
{
PEGASUS_TEST_ASSERT(false);
}
Boolean caught = false;
try
{
CIMName name(CIMNameCast("Not Okay"));
}
catch (InvalidNameException& e)
{
caught = true;
}
catch (...)
{
PEGASUS_TEST_ASSERT(false);
}
#if defined(PEGASUS_DEBUG)
PEGASUS_TEST_ASSERT(caught);
#else
PEGASUS_TEST_ASSERT(!caught);
#endif
}
开发者ID:host1812,项目名称:scx_plugin_public,代码行数:32,代码来源:TestCIMName.cpp
示例5: test05
//Test reference array type properties
void test05()
{
Array<CIMObjectPath> oa;
oa.append(CIMObjectPath("/root/cimv2:My_Class.a=1"));
oa.append(CIMObjectPath("/root/cimv2:My_Class.a=2"));
CIMProperty p1;
Boolean gotException = false;
try
{
p1 = CIMProperty(CIMName("property1"), oa, 0, CIMName("refclass"));
}
catch (TypeMismatchException&)
{
gotException = true;
}
PEGASUS_TEST_ASSERT(gotException);
p1 = CIMProperty(CIMName("property1"), oa[0], 0, CIMName("refclass"));
gotException = false;
try
{
p1.setValue(oa);
}
catch (TypeMismatchException&)
{
gotException = true;
}
PEGASUS_TEST_ASSERT(gotException);
}
开发者ID:host1812,项目名称:scx_plugin_public,代码行数:31,代码来源:Property.cpp
示例6: test02
// Test Thread and AtomicInt
void test02()
{
const Uint32 numThreads = 64;
AtomicInt * atom = new AtomicInt(0);
Thread* threads[numThreads];
(*atom)++;
Boolean zero = atom->decAndTestIfZero();
PEGASUS_TEST_ASSERT(zero);
for (Uint32 i=0; i<numThreads; i++)
{
threads[i] = new Thread(atomicIncrement, atom, false);
}
for (Uint32 i=0; i<numThreads; i++)
{
threads[i]->run();
}
for (Uint32 i=0; i<numThreads; i++)
{
threads[i]->join();
delete threads[i];
}
PEGASUS_TEST_ASSERT(atom->get() == numThreads);
delete atom;
}
开发者ID:brunolauze,项目名称:pegasus,代码行数:30,代码来源:IPC.cpp
示例7: main
int main (int argc, char** argv)
{
String stringVal;
verbose = (getenv("PEGASUS_TEST_VERBOSE")) ? true : false;
CIMClient client;
try
{
client.connectLocal ();
}
catch (Exception & e)
{
PEGASUS_STD (cerr) << e.getMessage () << PEGASUS_STD (endl);
return -1;
}
_enumerateInstanceNames(client);
_getInstance(client);
_setProperty(client, 7890);
_getProperty(client);
// getProperty() only returns CIMValues of type String.
value.get(stringVal);
PEGASUS_TEST_ASSERT(atoi((const char*)stringVal.getCString())==7890);
_setProperty(client,1234);
_getProperty(client);
// getProperty() only returns CIMValues of type String.
// Verify that setProperty worked as expected.
value.get(stringVal);
PEGASUS_TEST_ASSERT(atoi((const char*)stringVal.getCString())==1234);
return 0;
}
开发者ID:rdobson,项目名称:openpegasus,代码行数:32,代码来源:TestCMPIProperty.cpp
示例8: testCleanupIdleThread
void testCleanupIdleThread()
{
if (verbose)
{
cout << "testCleanupIdleThread" << endl;
}
try
{
struct timeval deallocateWait = { 0, 1 };
ThreadPool threadPool(0, "test cleanup", 0, 6, deallocateWait);
threadPool.allocate_and_awaken(
(void*)1, funcSleepSpecifiedMilliseconds);
Threads::sleep(1000);
PEGASUS_TEST_ASSERT(threadPool.idleCount() == 1);
threadPool.cleanupIdleThreads();
PEGASUS_TEST_ASSERT(threadPool.idleCount() == 0);
}
catch (const Exception& e)
{
cout << "Exception in testCleanupIdleThread: " <<
e.getMessage() << endl;
PEGASUS_TEST_ASSERT(false);
}
}
开发者ID:host1812,项目名称:scx_plugin_public,代码行数:27,代码来源:ThreadPool.cpp
示例9: CompareQualifiers
PEGASUS_NAMESPACE_END
void CompareQualifiers(
CIMRepository& r1,
CIMRepository& r2,
const CIMNamespaceName& namespaceName)
{
Array<CIMQualifierDecl> quals1 = r1.enumerateQualifiers(namespaceName);
Array<CIMQualifierDecl> quals2 = r2.enumerateQualifiers(namespaceName);
PEGASUS_TEST_ASSERT(quals1.size() == quals2.size());
BubbleSort(quals1);
BubbleSort(quals2);
for (Uint32 i = 0; i < quals2.size(); i++)
{
if (verbose)
{
cout << "testing qualifier " << namespaceName.getString() << "/";
cout << quals1[i].getName().getString() << "/ against /";
cout << quals2[i].getName().getString() << "/" << endl;
}
PEGASUS_TEST_ASSERT(quals1[i].identical(quals2[i]));
}
}
开发者ID:brunolauze,项目名称:pegasus,代码行数:26,代码来源:CompareRepositories.cpp
示例10: _checkStringValue
void _checkStringValue (CIMValue & theValue,
const String & value,
Boolean null = false)
{
PEGASUS_TEST_ASSERT (theValue.getType () == CIMTYPE_STRING);
PEGASUS_TEST_ASSERT (!theValue.isArray ());
if (null)
{
PEGASUS_TEST_ASSERT (theValue.isNull ());
}
else
{
PEGASUS_TEST_ASSERT (!theValue.isNull ());
String result;
theValue.get (result);
if (verbose)
{
if (result != value)
{
cerr << "Property value comparison failed. ";
cerr << "Expected " << value << "; ";
cerr << "Actual property value was " << result << "." << endl;
}
}
PEGASUS_TEST_ASSERT (result == value);
}
}
开发者ID:brunolauze,项目名称:pegasus,代码行数:29,代码来源:TestCMPIBroker.cpp
示例11: testInstancesTransfer
void testInstancesTransfer(
CIMRepository& oldRepository,
CIMRepository& newRepository,
const CIMNamespaceName& ns,
const CIMName& className)
{
Array<CIMInstance> i1 =
oldRepository.enumerateInstancesForClass(ns, className);
Array<CIMInstance> i2 =
newRepository.enumerateInstancesForClass(ns, className);
PEGASUS_TEST_ASSERT(i1.size() == i2.size());
for (Uint32 i = 0; i < i1.size(); i++)
{
Boolean found = false;
for (Uint32 j = 0; j < i2.size(); j++)
{
if (i1[i].identical(i2[j]))
{
found = true;
break;
}
}
PEGASUS_TEST_ASSERT(found);
}
}
开发者ID:brunolauze,项目名称:pegasus,代码行数:29,代码来源:UpgradeTest.cpp
示例12: PEGASUS_TEST_ASSERT
void
test_async_queue::async_handleEnqueue (AsyncOpNode * op,
MessageQueue * q, void *parm)
{
// I am static, get a pointer to my object
test_async_queue *myself = static_cast < test_async_queue * >(q);
async_start *rq = static_cast < async_start * >(op->removeRequest());
PEGASUS_TEST_ASSERT(rq != 0);
async_complete *rp = static_cast < async_complete * >(op->removeResponse());
PEGASUS_TEST_ASSERT(rp != 0);
if ((rq->getType () == ASYNC_ASYNC_OP_START) &&
(rp->getType () == ASYNC_ASYNC_OP_RESULT))
{
Message *cim_rq = rq->get_action ();
Message *cim_rp = rp->get_result_data ();
PEGASUS_TEST_ASSERT (cim_rq->getType () ==
CIM_GET_INSTANCE_REQUEST_MESSAGE);
PEGASUS_TEST_ASSERT (cim_rp->getType () ==
CIM_GET_INSTANCE_RESPONSE_MESSAGE);
test_async_queue::msg_count++;
delete cim_rp;
delete cim_rq;
delete rp;
delete rq;
delete op;
}
}
开发者ID:host1812,项目名称:scx_plugin_public,代码行数:33,代码来源:async_callback.cpp
示例13: PEGASUS_TEST_ASSERT
void _checkUint32Property
(CIMInstance & instance, const String & name, Uint32 value)
{
Uint32 pos = instance.findProperty (name);
PEGASUS_TEST_ASSERT (pos != PEG_NOT_FOUND);
CIMProperty theProperty = instance.getProperty (pos);
CIMValue theValue = theProperty.getValue ();
PEGASUS_TEST_ASSERT (theValue.getType () == CIMTYPE_UINT32);
PEGASUS_TEST_ASSERT (!theValue.isArray ());
PEGASUS_TEST_ASSERT (!theValue.isNull ());
Uint32 result;
theValue.get (result);
if (verbose)
{
if (result != value)
{
cerr << "Property value comparison failed. ";
cerr << "Expected " << value << "; ";
cerr << "Actual property value was " << result << "." << endl;
}
}
PEGASUS_TEST_ASSERT (result == value);
}
开发者ID:brunolauze,项目名称:pegasus,代码行数:27,代码来源:TestCMPIInstanceExecQuery.cpp
示例14: _testHostedIndicationServiceInstance
void _testHostedIndicationServiceInstance(CIMClient &client)
{
cout << "Testing Association Class "
<< (const char *)PEGASUS_CLASSNAME_PG_HOSTEDINDICATIONSERVICE.
getString().getCString()
<< "...";
// Get PG_HostedIndicationService Instances
Array<CIMInstance> hostedInstances = client.enumerateInstances(
PEGASUS_NAMESPACENAME_INTEROP,
PEGASUS_CLASSNAME_PG_HOSTEDINDICATIONSERVICE);
PEGASUS_TEST_ASSERT(hostedInstances.size() == 1);
// Get PG_HostedIndicationService Instance names
Array<CIMObjectPath> hostedPaths = client.enumerateInstanceNames(
PEGASUS_NAMESPACENAME_INTEROP,
PEGASUS_CLASSNAME_PG_HOSTEDINDICATIONSERVICE);
PEGASUS_TEST_ASSERT(hostedPaths.size() == 1);
// Get CIM_IndicationService instance names
Array<CIMObjectPath> servicePaths = client.enumerateInstanceNames(
PEGASUS_NAMESPACENAME_INTEROP,
PEGASUS_CLASSNAME_CIM_INDICATIONSERVICE);
PEGASUS_TEST_ASSERT(servicePaths.size() == 1);
// Test the CIM_IndicationService value.
CIMValue capValue = hostedInstances[0].getProperty(
hostedInstances[0].findProperty("Dependent")).getValue();
CIMObjectPath testPath;
capValue.get(testPath);
testPath.setNameSpace(CIMNamespaceName());
PEGASUS_TEST_ASSERT(testPath.identical(servicePaths[0]));
cout << "Test Complete" << endl;
}
开发者ID:brunolauze,项目名称:pegasus,代码行数:34,代码来源:ServerProfile.cpp
示例15: drive_Schema
void drive_Schema(QueryContext& _query)
{
CIMName base("CQL_TestElement");
CIMClass _class = _query.getClass(base);
PEGASUS_TEST_ASSERT(_class.getClassName() == base);
Array<CIMName> names = _query.enumerateClassNames(base);
PEGASUS_TEST_ASSERT(names.size() == 2);
CIMName derived("CQL_TestPropertyTypes");
PEGASUS_TEST_ASSERT(_query.isSubClass(base, derived));
PEGASUS_TEST_ASSERT(!_query.isSubClass(derived, base));
PEGASUS_TEST_ASSERT(
_query.getClassRelation(base, base) == QueryContext::SAMECLASS);
PEGASUS_TEST_ASSERT(
_query.getClassRelation(base, derived) == QueryContext::SUBCLASS);
PEGASUS_TEST_ASSERT(
_query.getClassRelation(derived, base) == QueryContext::SUPERCLASS);
CIMName unrelated("CIM_Process");
PEGASUS_TEST_ASSERT(
_query.getClassRelation(base, unrelated) == QueryContext::NOTRELATED);
PEGASUS_TEST_ASSERT(
_query.getClassRelation(unrelated, base) == QueryContext::NOTRELATED);
}
开发者ID:host1812,项目名称:scx_plugin_public,代码行数:27,代码来源:TestQueryContext.cpp
示例16: testSharedArrayPtr
void testSharedArrayPtr()
{
Monkey::numConstructions = 0;
Monkey::numDestructions = 0;
{
SharedArrayPtr<Monkey> p1(new Monkey[3]);
PEGASUS_TEST_ASSERT(Monkey::numConstructions == 3);
PEGASUS_TEST_ASSERT(Monkey::numDestructions == 0);
SharedArrayPtr<Monkey> p5(new Monkey[2]);
p1 = p5;
PEGASUS_TEST_ASSERT(Monkey::numConstructions == 5);
PEGASUS_TEST_ASSERT(Monkey::numDestructions == 3);
PEGASUS_TEST_ASSERT(p1[0].index == p5[0].index);
PEGASUS_TEST_ASSERT(p1[1].index == p5[1].index);
PEGASUS_TEST_ASSERT(p1[0].index != p1[1].index);
}
PEGASUS_TEST_ASSERT(Monkey::numConstructions == 5);
PEGASUS_TEST_ASSERT(Monkey::numDestructions == 5);
}
开发者ID:brunolauze,项目名称:pegasus,代码行数:25,代码来源:TestSharedPtr.cpp
示例17: testClearMethod
void testClearMethod()
{
// Test with a variety of object types in the From ResponseData
// Build the class
CIMClass CIMclass1 = buildClass();
// Build a CIM Instance. NOTE: key is defaulted in class
CIMInstance CIMInst1 = CIMclass1.buildInstance(true, true,
CIMPropertyList());
// Clone the instance and change key
CIMInstance CIMInst2 = CIMInst1.clone();
setPropertyValue(CIMInst2, "id", 2);
CIMInstance CIMInst3 = CIMInst1.clone();
setPropertyValue(CIMInst3, "id", 3);
CIMInstance CIMInst4 = CIMInst1.clone();
setPropertyValue(CIMInst4, "id", 4);
// build CIMInstance array
Array<CIMInstance> CIMInstArray;
CIMInstArray.append(CIMInst1);
CIMInstArray.append(CIMInst2);
CIMInstArray.append(CIMInst3);
CIMInstArray.append(CIMInst4);
// Create CIMReponseData object
CIMResponseData crd = CIMResponseData(CIMResponseData::RESP_INSTANCES);
// Append an array of CIMInstances
crd.appendInstances(CIMInstArray);
PEGASUS_TEST_ASSERT(crd.size() == 4);
// Build SCMO instances
SCMOClass SCMO_CSClass(CIMclass1);
VCOUT << "Creating SCMOInstance from CIMInstance" << endl;
SCMOInstance SCMO_CSInstance3(SCMO_CSClass,CIMInst3);
SCMOInstance SCMO_CSInstance4(SCMO_CSClass,CIMInst4);
// Create array of 2 SCMO Instances
Array<SCMOInstance> SCMOInstArray;
SCMOInstArray.append(SCMO_CSInstance3);
SCMOInstArray.append(SCMO_CSInstance4);
crd.appendSCMO(SCMOInstArray);
PEGASUS_TEST_ASSERT(crd.size() == 6);
crd.clear();
PEGASUS_TEST_ASSERT(crd.size() == 0);
}
开发者ID:deleisha,项目名称:neopegasus,代码行数:53,代码来源:ResponseData.cpp
示例18: test04
//Test reference type properties
void test04()
{
// Create reference type property from string input and reference class name
String p = "//localhost/root/SampleProvider:"
"TST_PersonDynamic.Name=\"Father\"";
CIMObjectPath path = p;
String referenceClassName = "TST_Person";
CIMProperty p1(CIMName ("message"), path, 0,
CIMName(referenceClassName));
PEGASUS_TEST_ASSERT(!p1.isArray());
PEGASUS_TEST_ASSERT(p1.getReferenceClassName()==
CIMName(referenceClassName));
PEGASUS_TEST_ASSERT(p1.getType() == CIMTYPE_REFERENCE);
CIMValue v1;
v1 = p1.getValue();
PEGASUS_TEST_ASSERT(v1.getType() == CIMTYPE_REFERENCE);
PEGASUS_TEST_ASSERT(!v1.isNull());
CIMObjectPath pathout;
v1.get(pathout);
PEGASUS_TEST_ASSERT( pathout == path );
if(verbose)
XmlWriter::printPropertyElement(p1, cout);
// Now create an empty property, one used in class declaration
// for a reference
CIMProperty p2(CIMName ("parent"), CIMObjectPath(),
0, CIMName(referenceClassName));
PEGASUS_TEST_ASSERT(!p2.isArray());
PEGASUS_TEST_ASSERT(p2.getReferenceClassName() ==
CIMName(referenceClassName));
PEGASUS_TEST_ASSERT(p2.getType() == CIMTYPE_REFERENCE);
CIMValue v2;
v2 = p2.getValue();
PEGASUS_TEST_ASSERT(v2.getType() == CIMTYPE_REFERENCE);
// ATTN: P3 KS 27 Feb 2003. Why does the following test not work.
// I assume that the value should
// be null in this case.
//PEGASUS_TEST_ASSERT(v2.isNull());
CIMObjectPath pathout2;
v1.get(pathout2);
// Now compare the paths
if(verbose)
XmlWriter::printPropertyElement(p2, cout);
}
开发者ID:host1812,项目名称:scx_plugin_public,代码行数:53,代码来源:Property.cpp
示例19: _checkResult
void _checkResult(const Array<CIMInstance> & instArr)
{
// provider returns exactly six instances
PEGASUS_TEST_ASSERT(6==instArr.size());
for (int i=0; i<6;i++)
{
const CIMObjectPath& objPath = instArr[i].getPath();
const Array<CIMKeyBinding>& keyBinds = objPath.getKeyBindings();
// instance should have three key bindings
PEGASUS_TEST_ASSERT(3==keyBinds.size());
}
}
开发者ID:brunolauze,项目名称:pegasus,代码行数:14,代码来源:TestCMPIKeyReturned.cpp
示例20: test05
// Test handling of escape characters
void test05()
{
{
// Test '\' and '"' characters in a key value
// This represents MyClass.key1="\\\"\"\\",key2="\"\"\"\"\\\\\\\\"
String s1 = "MyClass.key1=\"\\\\\\\"\\\"\\\\\","
"key2=\"\\\"\\\"\\\"\\\"\\\\\\\\\\\\\\\\\"";
CIMObjectPath r1 = s1;
PEGASUS_TEST_ASSERT(r1.toString() == s1);
}
// Catch invalid escape sequences in a key value
Boolean errorDetected;
// Invalid trailing backslash
errorDetected = false;
try
{
CIMObjectPath r1("MyClass.key1=\"\\\"");
}
catch (const MalformedObjectNameException&)
{
errorDetected = true;
}
PEGASUS_TEST_ASSERT(errorDetected);
// Invalid "\n" sequence
errorDetected = false;
try
{
CIMObjectPath r1("MyClass.key1=\"\\n\"");
}
catch (const MalformedObjectNameException&)
{
errorDetected = true;
}
PEGASUS_TEST_ASSERT(errorDetected);
// Invalid hex sequence
errorDetected = false;
try
{
CIMObjectPath r1("MyClass.key1=\"\\x000A\"");
}
catch (const MalformedObjectNameException&)
{
errorDetected = true;
}
PEGASUS_TEST_ASSERT(errorDetected);
}
开发者ID:brunolauze,项目名称:pegasus,代码行数:51,代码来源:Reference.cpp
注:本文中的PEGASUS_TEST_ASSERT函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论