本文整理汇总了C++中UUID::generate方法的典型用法代码示例。如果您正苦于以下问题:C++ UUID::generate方法的具体用法?C++ UUID::generate怎么用?C++ UUID::generate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UUID
的用法示例。
在下文中一共展示了UUID::generate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testGenerate
void UUIDTest::testGenerate( void )
{
UUID id;
CPPUNIT_ASSERT( id.isNil() );
id.generate();
CPPUNIT_ASSERT( !id.isNil() );
CPPUNIT_ASSERT( UUID().isNil() );
CPPUNIT_ASSERT( !UUID().generate().isNil() );
}
示例2: testCreateDestroy
void UUIDTest::testCreateDestroy( void )
{
UUID *id = 0;
// Default constructor/destructor
CPPUNIT_ASSERT_NO_THROW( id = new UUID );
CPPUNIT_ASSERT_NO_THROW( delete id );
CPPUNIT_ASSERT_NO_THROW( id = new UUID );
CPPUNIT_ASSERT_NO_THROW( id->generate() );
UUID *id2 = 0;
// Copy constructor
CPPUNIT_ASSERT_NO_THROW( id2 = new UUID( *id ) );
CPPUNIT_ASSERT_NO_THROW( delete id2 );
// Assignment operator
CPPUNIT_ASSERT_NO_THROW( id2 = new UUID );
CPPUNIT_ASSERT_NO_THROW( *id2 = *id );
CPPUNIT_ASSERT_NO_THROW( delete id2 );
CPPUNIT_ASSERT_NO_THROW( delete id );
}