check_node_inheritance.c 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419
  1. /* This Source Code Form is subject to the terms of the Mozilla Public
  2. * License, v. 2.0. If a copy of the MPL was not distributed with this
  3. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  4. #include <open62541/server_config_default.h>
  5. #include "server/ua_server_internal.h"
  6. #include <check.h>
  7. UA_Server *server = NULL;
  8. UA_UInt32 valueToBeInherited = 42;
  9. static void setup(void) {
  10. server = UA_Server_new();
  11. UA_ServerConfig_setDefault(UA_Server_getConfig(server));
  12. UA_Server_run_startup(server);
  13. }
  14. static void teardown(void) {
  15. UA_Server_run_shutdown(server);
  16. UA_Server_delete(server);
  17. }
  18. #ifdef UA_GENERATED_NAMESPACE_ZERO
  19. /* finds the NodeId of a StateNumber child of a given node id */
  20. static void
  21. findChildId(UA_NodeId parentNode, UA_NodeId referenceType,
  22. const UA_QualifiedName targetName, UA_NodeId *result) {
  23. UA_RelativePathElement rpe;
  24. UA_RelativePathElement_init(&rpe);
  25. rpe.referenceTypeId = referenceType;
  26. rpe.isInverse = false;
  27. rpe.includeSubtypes = false;
  28. rpe.targetName = targetName;
  29. UA_BrowsePath bp;
  30. UA_BrowsePath_init(&bp);
  31. bp.startingNode = parentNode;
  32. bp.relativePath.elementsSize = 1;
  33. bp.relativePath.elements = &rpe; //clion complains but is ok
  34. UA_BrowsePathResult bpr = UA_Server_translateBrowsePathToNodeIds(server, &bp);
  35. ck_assert_uint_eq(bpr.statusCode, UA_STATUSCODE_GOOD);
  36. ck_assert(bpr.targetsSize > 0);
  37. UA_NodeId_copy(&bpr.targets[0].targetId.nodeId, result);
  38. UA_BrowsePathResult_deleteMembers(&bpr);
  39. }
  40. #endif
  41. START_TEST(Nodes_createCustomBrowseNameObjectType)
  42. {
  43. /* Create a custom object type "CustomBrowseNameType" which has a
  44. * "DefaultInstanceBrowseName" property. */
  45. /* create new object type node which has a subcomponent of the type StateType */
  46. UA_ObjectTypeAttributes otAttr = UA_ObjectTypeAttributes_default;
  47. otAttr.displayName = UA_LOCALIZEDTEXT("", "CustomBrowseNameType");
  48. otAttr.description = UA_LOCALIZEDTEXT("", "");
  49. UA_StatusCode retval = UA_Server_addObjectTypeNode(server, UA_NODEID_NUMERIC(1, 7010),
  50. UA_NODEID_NUMERIC(0, UA_NS0ID_BASEOBJECTTYPE),
  51. UA_NODEID_NUMERIC(0, UA_NS0ID_HASSUBTYPE),
  52. UA_QUALIFIEDNAME(1, "CustomBrowseNameType"),
  53. otAttr, NULL, NULL);
  54. ck_assert_uint_eq(retval, UA_STATUSCODE_GOOD);
  55. // Now add a property "DefaultInstanceBrowseName"
  56. UA_VariableAttributes attr = UA_VariableAttributes_default;
  57. attr.minimumSamplingInterval = 0.000000;
  58. attr.userAccessLevel = 1;
  59. attr.accessLevel = 1;
  60. attr.valueRank = UA_VALUERANK_ANY;
  61. attr.dataType = UA_NODEID_NUMERIC(0, UA_NS0ID_QUALIFIEDNAME);
  62. UA_QualifiedName defaultInstanceBrowseName = UA_QUALIFIEDNAME(1, "MyCustomBrowseName");
  63. UA_Variant_setScalar(&attr.value, &defaultInstanceBrowseName, &UA_TYPES[UA_TYPES_QUALIFIEDNAME]);
  64. attr.displayName = UA_LOCALIZEDTEXT("", "DefaultInstanceBrowseName");
  65. attr.description = UA_LOCALIZEDTEXT("", "");
  66. attr.writeMask = 0;
  67. attr.userWriteMask = 0;
  68. retval = UA_Server_addVariableNode(server,
  69. UA_NODEID_NUMERIC(1, 7011),
  70. UA_NODEID_NUMERIC(1, 7010),
  71. UA_NODEID_NUMERIC(0, UA_NS0ID_HASPROPERTY),
  72. UA_QUALIFIEDNAME(0, "DefaultInstanceBrowseName"),
  73. UA_NODEID_NUMERIC(0, UA_NS0ID_PROPERTYTYPE),
  74. attr,
  75. NULL, NULL);
  76. ck_assert_uint_eq(retval, UA_STATUSCODE_GOOD);
  77. } END_TEST
  78. START_TEST(Nodes_checkDefaultInstanceBrowseName) {
  79. /* create an object/instance of the CustomDemoType.
  80. * This should fail if we do not specifiy a browse name.
  81. * CustomDemoType does not have a DefaultInstanceBrowseName
  82. * */
  83. UA_ObjectAttributes oAttr2 = UA_ObjectAttributes_default;
  84. oAttr2.displayName = UA_LOCALIZEDTEXT("", "DemoCustomBrowseNameFail");
  85. oAttr2.description = UA_LOCALIZEDTEXT("", "");
  86. UA_QualifiedName nullName;
  87. UA_QualifiedName_init(&nullName);
  88. UA_StatusCode retval =
  89. UA_Server_addObjectNode(server, UA_NODEID_NUMERIC(1, 7020),
  90. UA_NODEID_NUMERIC(0, UA_NS0ID_OBJECTSFOLDER),
  91. UA_NODEID_NUMERIC(0, UA_NS0ID_HASCOMPONENT),
  92. nullName, UA_NODEID_NUMERIC(1, 6010),
  93. oAttr2, NULL, NULL);
  94. ck_assert_uint_eq(retval, UA_STATUSCODE_BADBROWSENAMEINVALID);
  95. /* create an object/instance of the CustomBrowseNameType and set the default browse name */
  96. oAttr2 = UA_ObjectAttributes_default;
  97. oAttr2.displayName = UA_LOCALIZEDTEXT("", "DemoCustomBrowseName");
  98. oAttr2.description = UA_LOCALIZEDTEXT("", "");
  99. UA_QualifiedName_init(&nullName);
  100. retval =
  101. UA_Server_addObjectNode(server, UA_NODEID_NUMERIC(1, 7021),
  102. UA_NODEID_NUMERIC(0, UA_NS0ID_OBJECTSFOLDER),
  103. UA_NODEID_NUMERIC(0, UA_NS0ID_HASCOMPONENT),
  104. nullName, UA_NODEID_NUMERIC(1, 7010),
  105. oAttr2, NULL, NULL);
  106. ck_assert_uint_eq(retval, UA_STATUSCODE_GOOD);
  107. UA_QualifiedName receivedBrowseName;
  108. UA_QualifiedName_init(&receivedBrowseName);
  109. UA_QualifiedName defaultInstanceBrowseName = UA_QUALIFIEDNAME(1, "MyCustomBrowseName");
  110. retval = UA_Server_readBrowseName(server, UA_NODEID_NUMERIC(1, 7021), &receivedBrowseName);
  111. ck_assert_uint_eq(retval, UA_STATUSCODE_GOOD);
  112. ck_assert(UA_QualifiedName_equal(&receivedBrowseName, &defaultInstanceBrowseName) == true);
  113. UA_QualifiedName_clear(&receivedBrowseName);
  114. /* create an object/instance of the CustomBrowseNameType and set a custom browse name */
  115. oAttr2 = UA_ObjectAttributes_default;
  116. oAttr2.displayName = UA_LOCALIZEDTEXT("", "DemoCustomBrowseName");
  117. oAttr2.description = UA_LOCALIZEDTEXT("", "");
  118. UA_QualifiedName overriddenBrowseName = UA_QUALIFIEDNAME(1, "MyOverriddenBrowseName");
  119. retval =
  120. UA_Server_addObjectNode(server, UA_NODEID_NUMERIC(1, 7022),
  121. UA_NODEID_NUMERIC(0, UA_NS0ID_OBJECTSFOLDER),
  122. UA_NODEID_NUMERIC(0, UA_NS0ID_HASCOMPONENT),
  123. overriddenBrowseName, UA_NODEID_NUMERIC(1, 7010),
  124. oAttr2, NULL, NULL);
  125. ck_assert_uint_eq(retval, UA_STATUSCODE_GOOD);
  126. UA_QualifiedName_init(&receivedBrowseName);
  127. retval = UA_Server_readBrowseName(server, UA_NODEID_NUMERIC(1, 7022), &receivedBrowseName);
  128. ck_assert_uint_eq(retval, UA_STATUSCODE_GOOD);
  129. ck_assert(UA_QualifiedName_equal(&receivedBrowseName, &overriddenBrowseName) == true);
  130. UA_QualifiedName_clear(&receivedBrowseName);
  131. }
  132. END_TEST
  133. START_TEST(Nodes_createCustomStateType) {
  134. // Create a type "CustomStateType" with a variable "CustomStateNumber" as property
  135. UA_StatusCode retval = UA_STATUSCODE_GOOD;
  136. UA_ObjectTypeAttributes attrObject = UA_ObjectTypeAttributes_default;
  137. attrObject.displayName = UA_LOCALIZEDTEXT("", "CustomStateType");
  138. attrObject.description = UA_LOCALIZEDTEXT("", "");
  139. attrObject.writeMask = 0;
  140. attrObject.userWriteMask = 0;
  141. retval = UA_Server_addObjectTypeNode(server,
  142. UA_NODEID_NUMERIC(1, 6000),
  143. UA_NODEID_NUMERIC(0, UA_NS0ID_BASEOBJECTTYPE),
  144. UA_NODEID_NUMERIC(0, UA_NS0ID_HASSUBTYPE),
  145. UA_QUALIFIEDNAME(1, "CustomStateType"),
  146. attrObject,
  147. NULL, NULL);
  148. ck_assert_uint_eq(retval, UA_STATUSCODE_GOOD);
  149. // Now add a property "StateNumber"
  150. UA_VariableAttributes attr = UA_VariableAttributes_default;
  151. attr.minimumSamplingInterval = 0.000000;
  152. attr.userAccessLevel = 1;
  153. attr.accessLevel = 1;
  154. attr.valueRank = UA_VALUERANK_ANY;
  155. attr.dataType = UA_NODEID_NUMERIC(0, UA_NS0ID_UINT32);
  156. UA_UInt32 val = 0;
  157. UA_Variant_setScalar(&attr.value, &val, &UA_TYPES[UA_TYPES_UINT32]);
  158. attr.displayName = UA_LOCALIZEDTEXT("", "CustomStateNumber");
  159. attr.description = UA_LOCALIZEDTEXT("", "");
  160. attr.writeMask = 0;
  161. attr.userWriteMask = 0;
  162. retval = UA_Server_addVariableNode(server,
  163. UA_NODEID_NUMERIC(1, 6001),
  164. UA_NODEID_NUMERIC(1, 6000),
  165. UA_NODEID_NUMERIC(0, UA_NS0ID_HASPROPERTY),
  166. UA_QUALIFIEDNAME(1, "CustomStateNumber"),
  167. UA_NODEID_NUMERIC(0, UA_NS0ID_PROPERTYTYPE),
  168. attr,
  169. NULL, NULL);
  170. ck_assert_uint_eq(retval, UA_STATUSCODE_GOOD);
  171. /* Minimal nodeset does not contain the modelling rule mandatory */
  172. #ifdef UA_GENERATED_NAMESPACE_ZERO
  173. retval = UA_Server_addReference(server, UA_NODEID_NUMERIC(1, 6001),
  174. UA_NODEID_NUMERIC(0, UA_NS0ID_HASMODELLINGRULE),
  175. UA_EXPANDEDNODEID_NUMERIC(0, UA_NS0ID_MODELLINGRULE_MANDATORY),
  176. true);
  177. ck_assert_uint_eq(retval, UA_STATUSCODE_GOOD);
  178. #endif
  179. }
  180. END_TEST
  181. START_TEST(Nodes_createCustomObjectType) {
  182. /* Create a custom object type "CustomDemoType" which has a
  183. * "CustomStateType" component */
  184. UA_StatusCode retval = UA_STATUSCODE_GOOD;
  185. /* create new object type node which has a subcomponent of the type StateType */
  186. UA_ObjectTypeAttributes otAttr = UA_ObjectTypeAttributes_default;
  187. otAttr.displayName = UA_LOCALIZEDTEXT("", "CustomDemoType");
  188. otAttr.description = UA_LOCALIZEDTEXT("", "");
  189. retval = UA_Server_addObjectTypeNode(server, UA_NODEID_NUMERIC(1, 6010),
  190. UA_NODEID_NUMERIC(0, UA_NS0ID_BASEOBJECTTYPE),
  191. UA_NODEID_NUMERIC(0, UA_NS0ID_HASSUBTYPE),
  192. UA_QUALIFIEDNAME(1, "CustomDemoType"),
  193. otAttr, NULL, NULL);
  194. ck_assert_uint_eq(retval, UA_STATUSCODE_GOOD);
  195. UA_ObjectAttributes oAttr = UA_ObjectAttributes_default;
  196. oAttr.displayName = UA_LOCALIZEDTEXT("", "State");
  197. oAttr.description = UA_LOCALIZEDTEXT("", "");
  198. retval = UA_Server_addObjectNode(server, UA_NODEID_NUMERIC(1, 6011), UA_NODEID_NUMERIC(1, 6010),
  199. UA_NODEID_NUMERIC(0, UA_NS0ID_HASCOMPONENT),
  200. UA_QUALIFIEDNAME(1, "State"),
  201. UA_NODEID_NUMERIC(1, 6000),
  202. oAttr, NULL, NULL);
  203. ck_assert_uint_eq(retval, UA_STATUSCODE_GOOD);
  204. /* Minimal nodeset does not contain the modelling rule mandatory */
  205. #ifdef UA_GENERATED_NAMESPACE_ZERO
  206. /* modelling rule is mandatory so it will be inherited for the object
  207. * created from CustomDemoType */
  208. retval = UA_Server_addReference(server, UA_NODEID_NUMERIC(1, 6011),
  209. UA_NODEID_NUMERIC(0, UA_NS0ID_HASMODELLINGRULE),
  210. UA_EXPANDEDNODEID_NUMERIC(0, UA_NS0ID_MODELLINGRULE_MANDATORY),
  211. true);
  212. ck_assert_uint_eq(retval, UA_STATUSCODE_GOOD);
  213. /* assign a default value to the attribute "StateNumber" inside the state
  214. * attribute (part of the MyDemoType) */
  215. UA_Variant stateNum;
  216. UA_Variant_init(&stateNum);
  217. UA_Variant_setScalar(&stateNum, &valueToBeInherited, &UA_TYPES[UA_TYPES_UINT32]);
  218. UA_NodeId childID;
  219. findChildId(UA_NODEID_NUMERIC(1, 6011), UA_NODEID_NUMERIC(0, UA_NS0ID_HASPROPERTY),
  220. UA_QUALIFIEDNAME(1, "CustomStateNumber"), &childID);
  221. ck_assert(!UA_NodeId_isNull(&childID));
  222. retval = UA_Server_writeValue(server, childID, stateNum);
  223. ck_assert_uint_eq(retval, UA_STATUSCODE_GOOD);
  224. #endif
  225. }
  226. END_TEST
  227. START_TEST(Nodes_createInheritedObject) {
  228. /* create an object/instance of the demo type */
  229. UA_ObjectAttributes oAttr2 = UA_ObjectAttributes_default;
  230. oAttr2.displayName = UA_LOCALIZEDTEXT("", "Demo");
  231. oAttr2.description = UA_LOCALIZEDTEXT("", "");
  232. UA_StatusCode retval =
  233. UA_Server_addObjectNode(server, UA_NODEID_NUMERIC(1, 6020),
  234. UA_NODEID_NUMERIC(0, UA_NS0ID_OBJECTSFOLDER),
  235. UA_NODEID_NUMERIC(0, UA_NS0ID_HASCOMPONENT),
  236. UA_QUALIFIEDNAME(1, "Demo"), UA_NODEID_NUMERIC(1, 6010),
  237. oAttr2, NULL, NULL);
  238. ck_assert_uint_eq(retval, UA_STATUSCODE_GOOD);
  239. }
  240. END_TEST
  241. START_TEST(Nodes_checkInheritedValue) {
  242. /* Minimal nodeset does not contain the modelling rule mandatory, therefore there is no CustomStateNumber */
  243. #ifdef UA_GENERATED_NAMESPACE_ZERO
  244. UA_NodeId childState;
  245. findChildId(UA_NODEID_NUMERIC(1, 6020),
  246. UA_NODEID_NUMERIC(0, UA_NS0ID_HASCOMPONENT),
  247. UA_QUALIFIEDNAME(1, "State"), &childState);
  248. ck_assert(!UA_NodeId_isNull(&childState));
  249. UA_NodeId childNumber;
  250. findChildId(childState, UA_NODEID_NUMERIC(0, UA_NS0ID_HASPROPERTY),
  251. UA_QUALIFIEDNAME(1, "CustomStateNumber"), &childNumber);
  252. ck_assert(!UA_NodeId_isNull(&childNumber));
  253. UA_Variant inheritedValue;
  254. UA_Variant_init(&inheritedValue);
  255. UA_Server_readValue(server, childNumber, &inheritedValue);
  256. ck_assert(inheritedValue.type == &UA_TYPES[UA_TYPES_UINT32]);
  257. UA_UInt32 *value = (UA_UInt32 *) inheritedValue.data;
  258. ck_assert_int_eq(*value, valueToBeInherited);
  259. UA_Variant_deleteMembers(&inheritedValue);
  260. #endif
  261. }
  262. END_TEST
  263. START_TEST(Nodes_createCustomInterfaceType) {
  264. /* Minimal nodeset does not have the Interface definitions */
  265. #ifdef UA_GENERATED_NAMESPACE_ZERO
  266. /* Create a custom interface type */
  267. UA_ObjectTypeAttributes otAttr = UA_ObjectTypeAttributes_default;
  268. otAttr.displayName = UA_LOCALIZEDTEXT("", "ILocationType");
  269. otAttr.description = UA_LOCALIZEDTEXT("", "");
  270. UA_StatusCode retval = UA_Server_addObjectTypeNode(server, UA_NODEID_NUMERIC(1, 8000),
  271. UA_NODEID_NUMERIC(0, UA_NS0ID_BASEINTERFACETYPE),
  272. UA_NODEID_NUMERIC(0, UA_NS0ID_HASSUBTYPE),
  273. UA_QUALIFIEDNAME(1, "ILocationType"),
  274. otAttr, NULL, NULL);
  275. ck_assert_uint_eq(retval, UA_STATUSCODE_GOOD);
  276. UA_ObjectAttributes oAttr = UA_ObjectAttributes_default;
  277. oAttr.displayName = UA_LOCALIZEDTEXT("", "InterfaceChild");
  278. oAttr.description = UA_LOCALIZEDTEXT("", "");
  279. retval = UA_Server_addObjectNode(server, UA_NODEID_NUMERIC(1, 8001), UA_NODEID_NUMERIC(1, 8000),
  280. UA_NODEID_NUMERIC(0, UA_NS0ID_HASCOMPONENT),
  281. UA_QUALIFIEDNAME(1, "InterfaceChild"),
  282. UA_NODEID_NUMERIC(0, UA_NS0ID_BASEOBJECTTYPE),
  283. oAttr, NULL, NULL);
  284. ck_assert_uint_eq(retval, UA_STATUSCODE_GOOD);
  285. retval = UA_Server_addReference(server, UA_NODEID_NUMERIC(1, 8001),
  286. UA_NODEID_NUMERIC(0, UA_NS0ID_HASMODELLINGRULE),
  287. UA_EXPANDEDNODEID_NUMERIC(0, UA_NS0ID_MODELLINGRULE_MANDATORY),
  288. true);
  289. ck_assert_uint_eq(retval, UA_STATUSCODE_GOOD);
  290. /* create an object type which has the interface */
  291. otAttr = UA_ObjectTypeAttributes_default;
  292. otAttr.displayName = UA_LOCALIZEDTEXT("", "ObjectWithLocation");
  293. otAttr.description = UA_LOCALIZEDTEXT("", "");
  294. retval = UA_Server_addObjectTypeNode(server, UA_NODEID_NUMERIC(1, 8002),
  295. UA_NODEID_NUMERIC(0, UA_NS0ID_BASEOBJECTTYPE),
  296. UA_NODEID_NUMERIC(0, UA_NS0ID_HASSUBTYPE),
  297. UA_QUALIFIEDNAME(1, "ObjectWithLocation"),
  298. otAttr, NULL, NULL);
  299. ck_assert_uint_eq(retval, UA_STATUSCODE_GOOD);
  300. retval = UA_Server_addReference(server, UA_NODEID_NUMERIC(1, 8002), UA_NODEID_NUMERIC(0, UA_NS0ID_HASINTERFACE), UA_EXPANDEDNODEID_NUMERIC(1, 8000), true);
  301. ck_assert_uint_eq(retval, UA_STATUSCODE_GOOD);
  302. #endif
  303. }
  304. END_TEST
  305. START_TEST(Nodes_createObjectWithInterface) {
  306. /* Minimal nodeset does not have the Interface definitions */
  307. #ifdef UA_GENERATED_NAMESPACE_ZERO
  308. /* create an object/instance of the demo type */
  309. UA_ObjectAttributes oAttr2 = UA_ObjectAttributes_default;
  310. oAttr2.displayName = UA_LOCALIZEDTEXT("", "ObjectInstanceOfInterface");
  311. oAttr2.description = UA_LOCALIZEDTEXT("", "");
  312. UA_StatusCode retval =
  313. UA_Server_addObjectNode(server, UA_NODEID_NUMERIC(1, 8020),
  314. UA_NODEID_NUMERIC(0, UA_NS0ID_OBJECTSFOLDER),
  315. UA_NODEID_NUMERIC(0, UA_NS0ID_HASCOMPONENT),
  316. UA_QUALIFIEDNAME(1, "ObjectInstanceOfInterface"), UA_NODEID_NUMERIC(1, 8002),
  317. oAttr2, NULL, NULL);
  318. ck_assert_uint_eq(retval, UA_STATUSCODE_GOOD);
  319. /* Check that object has inherited the interface children */
  320. UA_NodeId childId;
  321. findChildId(UA_NODEID_NUMERIC(1, 8020),
  322. UA_NODEID_NUMERIC(0, UA_NS0ID_HASCOMPONENT),
  323. UA_QUALIFIEDNAME(1, "InterfaceChild"), &childId);
  324. ck_assert(!UA_NodeId_isNull(&childId));
  325. #endif
  326. }
  327. END_TEST
  328. static Suite *testSuite_Client(void) {
  329. Suite *s = suite_create("Node inheritance");
  330. TCase *tc_inherit_subtype = tcase_create("Inherit subtype value");
  331. tcase_add_unchecked_fixture(tc_inherit_subtype, setup, teardown);
  332. tcase_add_test(tc_inherit_subtype, Nodes_createCustomStateType);
  333. tcase_add_test(tc_inherit_subtype, Nodes_createCustomObjectType);
  334. tcase_add_test(tc_inherit_subtype, Nodes_createInheritedObject);
  335. tcase_add_test(tc_inherit_subtype, Nodes_checkInheritedValue);
  336. tcase_add_test(tc_inherit_subtype, Nodes_createCustomBrowseNameObjectType);
  337. tcase_add_test(tc_inherit_subtype, Nodes_checkDefaultInstanceBrowseName);
  338. suite_add_tcase(s, tc_inherit_subtype);
  339. TCase *tc_interface_addin = tcase_create("Interfaces and Addins");
  340. tcase_add_unchecked_fixture(tc_interface_addin, setup, teardown);
  341. tcase_add_test(tc_interface_addin, Nodes_createCustomInterfaceType);
  342. tcase_add_test(tc_interface_addin, Nodes_createObjectWithInterface);
  343. suite_add_tcase(s, tc_interface_addin);
  344. return s;
  345. }
  346. int main(void) {
  347. Suite *s = testSuite_Client();
  348. SRunner *sr = srunner_create(s);
  349. srunner_set_fork_status(sr, CK_NOFORK);
  350. srunner_run_all(sr, CK_NORMAL);
  351. int number_failed = srunner_ntests_failed(sr);
  352. srunner_free(sr);
  353. return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
  354. }