Skip to content

Instantly share code, notes, and snippets.

@vigsterkr
Created August 23, 2013 11:54
Show Gist options
  • Save vigsterkr/6318518 to your computer and use it in GitHub Desktop.
Save vigsterkr/6318518 to your computer and use it in GitHub Desktop.
new clone_equals test
TEST(SGObject,clone_equals_{{class}})
{
const char* class_name="{{class}}";
CSGObject* object = new_sgserializable(class_name, PT_NOT_GENERIC);
ASSERT_TRUE(object != NULL);
/* test for get_name() */
ASSERT_TRUE(strcmp(object->get_name(), class_name) == 0);
/* test for .equals() */
CSGObject* object2 = new_sgserializable(class_name, PT_NOT_GENERIC);
ASSERT_TRUE(object2 != NULL);
ASSERT_TRUE(object->equals(object2));
SG_UNREF(object2);
/* test for .clone() */
CSGObject* clone = object->clone();
ASSERT_TRUE(clone != NULL);
/* test for .clone() + .equals() */
EXPECT_TRUE(object->equals(clone));
SG_UNREF(object);
SG_UNREF(clone);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment