MCPcopy Create free account
hub / github.com/apache/qpid-proton / test_class

Function test_class

c/tests/object_test.cpp:124–153  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

122static const pn_class_t noop_class = PN_CLASS(noop);
123
124static void test_class(const pn_class_t *clazz, size_t size) {
125 INFO("class=" << pn_class_name(clazz) << " size=" << size);
126 void *a = pn_class_new(clazz, size);
127 void *b = pn_class_new(clazz, size);
128
129 CHECK(!pn_class_equals(clazz, a, b));
130 CHECK(pn_class_equals(clazz, a, a));
131 CHECK(pn_class_equals(clazz, b, b));
132 CHECK(!pn_class_equals(clazz, a, NULL));
133 CHECK(!pn_class_equals(clazz, NULL, a));
134
135 int rca = pn_class_refcount(clazz, a);
136 int rcb = pn_class_refcount(clazz, b);
137
138 CHECK((rca == -1 || rca == 1));
139 CHECK((rcb == -1 || rcb == 1));
140
141 pn_class_incref(clazz, a);
142
143 rca = pn_class_refcount(clazz, a);
144 CHECK((rca == -1 || rca == 2));
145
146 pn_class_decref(clazz, a);
147
148 rca = pn_class_refcount(clazz, a);
149 CHECK((rca == -1 || rca == 1));
150
151 pn_class_free(clazz, a);
152 pn_class_free(clazz, b);
153}
154
155TEST_CASE("object_class") {
156 test_class(PN_DEFAULT, 0);

Callers 1

object_test.cppFile · 0.85

Calls 7

pn_class_nameFunction · 0.85
pn_class_newFunction · 0.85
pn_class_equalsFunction · 0.85
pn_class_refcountFunction · 0.85
pn_class_increfFunction · 0.85
pn_class_decrefFunction · 0.85
pn_class_freeFunction · 0.85

Tested by

no test coverage detected