本文整理汇总了C++中ObjectPtr::equals方法的典型用法代码示例。如果您正苦于以下问题:C++ ObjectPtr::equals方法的具体用法?C++ ObjectPtr::equals怎么用?C++ ObjectPtr::equals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjectPtr
的用法示例。
在下文中一共展示了ObjectPtr::equals方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createObject
TEST(ObjectTests, ObjectEquality)
{
ObjectPtr nil = createObject();
ObjectPtr boolean = createObject(true);
ObjectPtr number = createObject(1.f);
ObjectPtr string = createObject("true");
void* memory = malloc(32);
ObjectPtr userdata = createObject(memory);
ASSERT_TRUE(nil->equals(nil));
ASSERT_FALSE(nil->equals(boolean));
ASSERT_FALSE(nil->equals(number));
ASSERT_FALSE(nil->equals(string));
ASSERT_FALSE(nil->equals(userdata));
ASSERT_FALSE(boolean->equals(nil));
ASSERT_TRUE(boolean->equals(boolean));
ASSERT_TRUE(boolean->equals(number));
ASSERT_TRUE(boolean->equals(string));
ASSERT_FALSE(boolean->equals(userdata));
ASSERT_FALSE(number->equals(nil));
ASSERT_TRUE(number->equals(boolean));
ASSERT_TRUE(number->equals(number));
ASSERT_FALSE(number->equals(string));
ASSERT_FALSE(number->equals(userdata));
ASSERT_FALSE(string->equals(nil));
ASSERT_TRUE(string->equals(boolean));
ASSERT_FALSE(string->equals(number));
ASSERT_TRUE(string->equals(string));
ASSERT_FALSE(string->equals(userdata));
ASSERT_FALSE(userdata->equals(nil));
ASSERT_FALSE(userdata->equals(boolean));
ASSERT_FALSE(userdata->equals(number));
ASSERT_FALSE(userdata->equals(string));
ASSERT_TRUE(userdata->equals(userdata));
free(memory);
}