check_pubsub_informationmodel_methods.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388
  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. *
  5. * Copyright (c) 2017 - 2018 Fraunhofer IOSB (Author: Andreas Ebner)
  6. */
  7. #include <string.h>
  8. #include <math.h>
  9. #include "src_generated/ua_types_generated.h"
  10. #include "ua_types.h"
  11. #include "src_generated/ua_types_generated_encoding_binary.h"
  12. #include "ua_types.h"
  13. #include "ua_server_pubsub.h"
  14. #include "src_generated/ua_types_generated.h"
  15. #include "ua_network_pubsub_udp.h"
  16. #include "ua_server_internal.h"
  17. #include "check.h"
  18. #include "ua_plugin_pubsub.h"
  19. #include "ua_config_default.h"
  20. #include "thread_wrapper.h"
  21. UA_Server *server = NULL;
  22. UA_ServerConfig *config = NULL;
  23. UA_Boolean running;
  24. THREAD_HANDLE server_thread;
  25. THREAD_CALLBACK(serverloop) {
  26. while (running)
  27. UA_Server_run_iterate(server, true);
  28. return 0;
  29. }
  30. static void setup(void) {
  31. running = true;
  32. config = UA_ServerConfig_new_default();
  33. config->pubsubTransportLayers = (UA_PubSubTransportLayer *) UA_malloc(sizeof(UA_PubSubTransportLayer));
  34. if(!config->pubsubTransportLayers) {
  35. UA_ServerConfig_delete(config);
  36. }
  37. config->pubsubTransportLayers[0] = UA_PubSubTransportLayerUDPMP();
  38. config->pubsubTransportLayersSize++;
  39. server = UA_Server_new(config);
  40. UA_Server_run_startup(server);
  41. THREAD_CREATE(server_thread, serverloop);
  42. }
  43. static void teardown(void) {
  44. running = false;
  45. THREAD_JOIN(server_thread);
  46. UA_Server_run_shutdown(server);
  47. UA_Server_delete(server);
  48. UA_ServerConfig_delete(config);
  49. }
  50. static UA_NodeId
  51. findSingleChildNode(UA_QualifiedName targetName,
  52. UA_NodeId referenceTypeId, UA_NodeId startingNode){
  53. UA_NodeId resultNodeId;
  54. UA_RelativePathElement rpe;
  55. UA_RelativePathElement_init(&rpe);
  56. rpe.referenceTypeId = referenceTypeId;
  57. rpe.isInverse = false;
  58. rpe.includeSubtypes = false;
  59. rpe.targetName = targetName;
  60. UA_BrowsePath bp;
  61. UA_BrowsePath_init(&bp);
  62. bp.startingNode = startingNode;
  63. bp.relativePath.elementsSize = 1;
  64. bp.relativePath.elements = &rpe;
  65. UA_BrowsePathResult bpr =
  66. UA_Server_translateBrowsePathToNodeIds(server, &bp);
  67. if(bpr.statusCode != UA_STATUSCODE_GOOD ||
  68. bpr.targetsSize < 1)
  69. return UA_NODEID_NULL;
  70. if(UA_NodeId_copy(&bpr.targets[0].targetId.nodeId, &resultNodeId) != UA_STATUSCODE_GOOD){
  71. UA_BrowsePathResult_deleteMembers(&bpr);
  72. return UA_NODEID_NULL;
  73. }
  74. UA_BrowsePathResult_deleteMembers(&bpr);
  75. return resultNodeId;
  76. }
  77. static UA_NodeId addPubSubConnection(void){
  78. UA_Variant publisherId;
  79. UA_Variant_init(&publisherId);
  80. UA_UInt32 publisherIdValue = 13245;
  81. UA_Variant_setScalar(&publisherId, &publisherIdValue , &UA_TYPES[UA_TYPES_UINT32]);
  82. UA_PubSubConnectionDataType pubSubConnection;
  83. UA_PubSubConnectionDataType_init(&pubSubConnection);
  84. pubSubConnection.name = UA_STRING("Model Connection 1");
  85. pubSubConnection.enabled = UA_TRUE;
  86. pubSubConnection.publisherId = publisherId;
  87. pubSubConnection.transportProfileUri = UA_STRING("http://opcfoundation.org/UA-Profile/Transport/pubsub-udp-uadp");
  88. UA_ExtensionObject eo;
  89. eo.encoding = UA_EXTENSIONOBJECT_ENCODED_BYTESTRING;
  90. UA_NetworkAddressUrlDataType networkAddressDataType = {UA_STRING("eth0"), UA_STRING("opc.udp://224.0.0.22:4840/")};
  91. UA_ByteString_allocBuffer(&eo.content.encoded.body, UA_NetworkAddressUrlDataType_calcSizeBinary(&networkAddressDataType));
  92. UA_Byte *bufPos = eo.content.encoded.body.data;
  93. UA_NetworkAddressUrlDataType_encodeBinary(&networkAddressDataType, &bufPos, &(eo.content.encoded.body.data[eo.content.encoded.body.length]));
  94. eo.content.encoded.typeId = UA_NODEID_NUMERIC(0, UA_TYPES_NETWORKADDRESSURLDATATYPE);
  95. pubSubConnection.address = eo;
  96. pubSubConnection.connectionPropertiesSize = 2;
  97. UA_KeyValuePair connectionOptions[2];
  98. memset(connectionOptions, 0, sizeof(UA_KeyValuePair)* 2);
  99. connectionOptions[0].key = UA_QUALIFIEDNAME(0, "ttl");
  100. UA_UInt32 ttl = 10;
  101. UA_Variant_setScalar(&connectionOptions[0].value, &ttl, &UA_TYPES[UA_TYPES_UINT32]);
  102. connectionOptions[1].key = UA_QUALIFIEDNAME(0, "loopback");
  103. UA_Boolean loopback = UA_FALSE;
  104. UA_Variant_setScalar(&connectionOptions[1].value, &loopback, &UA_TYPES[UA_TYPES_UINT32]);
  105. pubSubConnection.connectionProperties = connectionOptions;
  106. UA_Variant inputArguments;
  107. UA_Variant_init(&inputArguments);
  108. UA_Variant_setScalar(&inputArguments, &pubSubConnection, &UA_TYPES[UA_TYPES_PUBSUBCONNECTIONDATATYPE]);
  109. UA_CallMethodRequest callMethodRequest;
  110. UA_CallMethodRequest_init(&callMethodRequest);
  111. callMethodRequest.inputArgumentsSize = 1;
  112. callMethodRequest.inputArguments = &inputArguments;
  113. callMethodRequest.objectId = UA_NODEID_NUMERIC(0, UA_NS0ID_PUBLISHSUBSCRIBE);
  114. callMethodRequest.methodId = UA_NODEID_NUMERIC(0, UA_NS0ID_PUBLISHSUBSCRIBE_ADDCONNECTION);
  115. UA_NodeId connectionId = UA_NODEID_NULL;
  116. UA_CallMethodResult result;
  117. UA_CallMethodResult_init(&result);
  118. result = UA_Server_call(server, &callMethodRequest);
  119. ck_assert_int_eq(1, result.outputArgumentsSize);
  120. ck_assert_int_eq(result.statusCode, UA_STATUSCODE_GOOD);
  121. if(result.outputArguments->type == &UA_TYPES[UA_TYPES_NODEID])
  122. connectionId = *((UA_NodeId *) result.outputArguments->data);
  123. UA_ExtensionObject_deleteMembers(&eo);
  124. callMethodRequest.inputArguments = NULL;
  125. callMethodRequest.inputArgumentsSize = 0;
  126. UA_CallMethodRequest_deleteMembers(&callMethodRequest);
  127. UA_CallMethodResult_deleteMembers(&result);
  128. return connectionId;
  129. }
  130. START_TEST(AddNewPubSubConnectionUsingTheInformationModelMethod){
  131. UA_StatusCode retVal;
  132. UA_Client *client = UA_Client_new();
  133. UA_ClientConfig_setDefault(UA_Client_getConfig(client));
  134. retVal = UA_Client_connect(client, "opc.tcp://localhost:4840");
  135. if(retVal != UA_STATUSCODE_GOOD) {
  136. UA_Client_delete(client);
  137. }
  138. ck_assert_int_eq(retVal, UA_STATUSCODE_GOOD);
  139. UA_NodeId createdConnection = addPubSubConnection();
  140. UA_LocalizedText connectionDisplayName;
  141. UA_LocalizedText_init(&connectionDisplayName);
  142. retVal = UA_Server_readDisplayName(server, createdConnection, &connectionDisplayName);
  143. ck_assert_int_eq(retVal, UA_STATUSCODE_GOOD);
  144. UA_String compareText = UA_STRING("Model Connection 1");
  145. ck_assert(UA_String_equal(&connectionDisplayName.text, &compareText) == UA_TRUE);
  146. //todo browse and check childs
  147. UA_Variant serverPubSubConnectionValues;
  148. UA_Variant_init(&serverPubSubConnectionValues);
  149. UA_NodeId connectionPublisherId = findSingleChildNode(UA_QUALIFIEDNAME(0, "PublisherId"),
  150. UA_NODEID_NUMERIC(0, UA_NS0ID_HASPROPERTY),
  151. createdConnection);
  152. ck_assert_int_eq(UA_Server_readValue(server, connectionPublisherId, &serverPubSubConnectionValues),
  153. UA_STATUSCODE_GOOD);
  154. ck_assert_uint_eq(*((UA_UInt32 *) serverPubSubConnectionValues.data), 13245);
  155. UA_Variant_deleteMembers(&serverPubSubConnectionValues);
  156. UA_Client_disconnect(client);
  157. UA_Client_delete(client);
  158. UA_LocalizedText_deleteMembers(&connectionDisplayName);
  159. } END_TEST
  160. START_TEST(AddAndRemovePublishedDataSetFolders){
  161. UA_StatusCode retVal;
  162. UA_Client *client = UA_Client_new();
  163. UA_ClientConfig_setDefault(UA_Client_getConfig(client));
  164. retVal = UA_Client_connect(client, "opc.tcp://localhost:4840");
  165. if(retVal != UA_STATUSCODE_GOOD) {
  166. UA_Client_delete(client);
  167. }
  168. ck_assert_int_eq(retVal, UA_STATUSCODE_GOOD);
  169. UA_String folderName = UA_STRING("TestFolder");
  170. UA_Variant inputArguments;
  171. UA_Variant_init(&inputArguments);
  172. UA_Variant_setScalar(&inputArguments, &folderName, &UA_TYPES[UA_TYPES_STRING]);
  173. UA_CallMethodRequest callMethodRequest;
  174. UA_CallMethodRequest_init(&callMethodRequest);
  175. callMethodRequest.inputArgumentsSize = 1;
  176. callMethodRequest.inputArguments = &inputArguments;
  177. callMethodRequest.objectId = UA_NODEID_NUMERIC(0, UA_NS0ID_PUBLISHSUBSCRIBE_PUBLISHEDDATASETS);
  178. callMethodRequest.methodId = UA_NODEID_NUMERIC(0, UA_NS0ID_DATASETFOLDERTYPE_ADDDATASETFOLDER);
  179. UA_CallMethodResult result;
  180. UA_CallMethodResult_init(&result);
  181. result = UA_Server_call(server, &callMethodRequest);
  182. ck_assert_int_eq(1, result.outputArgumentsSize);
  183. ck_assert_int_eq(result.statusCode, UA_STATUSCODE_GOOD);
  184. UA_NodeId createdFolder = UA_NODEID_NULL;
  185. if(result.outputArguments->type == &UA_TYPES[UA_TYPES_NODEID])
  186. createdFolder = *((UA_NodeId *) result.outputArguments->data);
  187. UA_LocalizedText connectionDisplayName;
  188. UA_LocalizedText_init(&connectionDisplayName);
  189. retVal = UA_Server_readDisplayName(server, createdFolder, &connectionDisplayName);
  190. ck_assert_int_eq(retVal, UA_STATUSCODE_GOOD);
  191. UA_String compareText = UA_STRING("TestFolder");
  192. ck_assert(UA_String_equal(&connectionDisplayName.text, &compareText) == UA_TRUE);
  193. retVal = UA_Server_readNodeId(server, createdFolder, &createdFolder);
  194. ck_assert_int_eq(retVal, UA_STATUSCODE_GOOD);
  195. UA_CallMethodResult_deleteMembers(&result);
  196. UA_LocalizedText_deleteMembers(&connectionDisplayName);
  197. //create folder inside the new folder
  198. folderName = UA_STRING("TestFolder2");
  199. UA_Variant_init(&inputArguments);
  200. UA_Variant_setScalar(&inputArguments, &folderName, &UA_TYPES[UA_TYPES_STRING]);
  201. UA_CallMethodRequest_init(&callMethodRequest);
  202. callMethodRequest.inputArgumentsSize = 1;
  203. callMethodRequest.inputArguments = &inputArguments;
  204. callMethodRequest.objectId = createdFolder;
  205. callMethodRequest.methodId = UA_NODEID_NUMERIC(0, UA_NS0ID_DATASETFOLDERTYPE_ADDDATASETFOLDER);
  206. UA_CallMethodResult_init(&result);
  207. result = UA_Server_call(server, &callMethodRequest);
  208. ck_assert_int_eq(1, result.outputArgumentsSize);
  209. ck_assert_int_eq(result.statusCode, UA_STATUSCODE_GOOD);
  210. UA_NodeId createdFolder2 = UA_NODEID_NULL;
  211. if(result.outputArguments->type == &UA_TYPES[UA_TYPES_NODEID])
  212. createdFolder2 = *((UA_NodeId *) result.outputArguments->data);
  213. UA_LocalizedText_init(&connectionDisplayName);
  214. retVal = UA_Server_readDisplayName(server, createdFolder2, &connectionDisplayName);
  215. ck_assert_int_eq(retVal, UA_STATUSCODE_GOOD);
  216. compareText = UA_STRING("TestFolder2");
  217. ck_assert(UA_String_equal(&connectionDisplayName.text, &compareText) == UA_TRUE);
  218. retVal = UA_Server_readNodeId(server, createdFolder2, &createdFolder2);
  219. ck_assert_int_eq(retVal, UA_STATUSCODE_GOOD);
  220. UA_CallMethodResult_deleteMembers(&result);
  221. //delete the folder
  222. UA_Variant_init(&inputArguments);
  223. UA_Variant_setScalar(&inputArguments, &createdFolder, &UA_TYPES[UA_TYPES_NODEID]);
  224. UA_CallMethodRequest_init(&callMethodRequest);
  225. callMethodRequest.inputArgumentsSize = 1;
  226. callMethodRequest.inputArguments = &inputArguments;
  227. callMethodRequest.objectId = UA_NODEID_NUMERIC(0, UA_NS0ID_PUBLISHSUBSCRIBE_PUBLISHEDDATASETS);
  228. callMethodRequest.methodId = UA_NODEID_NUMERIC(0, UA_NS0ID_DATASETFOLDERTYPE_REMOVEDATASETFOLDER);
  229. result = UA_Server_call(server, &callMethodRequest);
  230. ck_assert_int_eq(0, result.outputArgumentsSize);
  231. ck_assert_int_eq(result.statusCode, UA_STATUSCODE_GOOD);
  232. //check if the node is deleted
  233. retVal = UA_Server_readNodeId(server, createdFolder, NULL);
  234. ck_assert_int_eq(retVal, UA_STATUSCODE_BADNODEIDUNKNOWN);
  235. UA_CallMethodResult_deleteMembers(&result);
  236. UA_Client_disconnect(client);
  237. UA_Client_delete(client);
  238. UA_LocalizedText_deleteMembers(&connectionDisplayName);
  239. } END_TEST
  240. START_TEST(AddAndRemovePublishedDataSetItems){
  241. UA_StatusCode retVal;
  242. UA_Client *client = UA_Client_new();
  243. UA_ClientConfig_setDefault(UA_Client_getConfig(client));
  244. retVal = UA_Client_connect(client, "opc.tcp://localhost:4840");
  245. if(retVal != UA_STATUSCODE_GOOD) {
  246. UA_Client_delete(client);
  247. }
  248. ck_assert_int_eq(retVal, UA_STATUSCODE_GOOD);
  249. UA_Variant *inputArguments = (UA_Variant *) UA_calloc(4, (sizeof(UA_Variant)));
  250. UA_String pdsName = UA_STRING("Test PDS");
  251. UA_Variant_setScalar(&inputArguments[0], &pdsName, &UA_TYPES[UA_TYPES_STRING]);
  252. UA_String *fieldNameAliases = (UA_String *) UA_calloc(2, sizeof(UA_String));
  253. fieldNameAliases[0] = UA_STRING("field1");
  254. fieldNameAliases[1] = UA_STRING("field2");
  255. UA_Variant_setArray(&inputArguments[1], fieldNameAliases, 2, &UA_TYPES[UA_TYPES_STRING]);
  256. UA_DataSetFieldFlags *dataSetFieldFlags = (UA_DataSetFieldFlags *) UA_calloc(2, sizeof(UA_DataSetFieldFlags));
  257. dataSetFieldFlags[0] = UA_DATASETFIELDFLAGS_PROMOTEDFIELD;
  258. dataSetFieldFlags[1] = UA_DATASETFIELDFLAGS_PROMOTEDFIELD;
  259. UA_Variant_setArray(&inputArguments[2], dataSetFieldFlags, 2, &UA_TYPES[UA_TYPES_DATASETFIELDFLAGS]);
  260. UA_PublishedVariableDataType *variablesToAdd = (UA_PublishedVariableDataType *) UA_calloc(2, sizeof(UA_PublishedVariableDataType));
  261. variablesToAdd[0].publishedVariable = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_LOCALTIME);
  262. variablesToAdd[0].attributeId = UA_ATTRIBUTEID_VALUE;
  263. variablesToAdd[1].publishedVariable = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERREDUNDANCY_CURRENTSERVERID);
  264. variablesToAdd[1].attributeId = UA_ATTRIBUTEID_VALUE;
  265. UA_Variant_setArray(&inputArguments[3], variablesToAdd, 2, &UA_TYPES[UA_TYPES_PUBLISHEDVARIABLEDATATYPE]);
  266. UA_CallMethodRequest callMethodRequest;
  267. UA_CallMethodRequest_init(&callMethodRequest);
  268. callMethodRequest.inputArgumentsSize = 4;
  269. callMethodRequest.inputArguments = inputArguments;
  270. callMethodRequest.objectId = UA_NODEID_NUMERIC(0, UA_NS0ID_PUBLISHSUBSCRIBE_PUBLISHEDDATASETS);
  271. callMethodRequest.methodId = UA_NODEID_NUMERIC(0, UA_NS0ID_DATASETFOLDERTYPE_ADDPUBLISHEDDATAITEMS);
  272. UA_CallMethodResult result;
  273. UA_CallMethodResult_init(&result);
  274. result = UA_Server_call(server, &callMethodRequest);
  275. ck_assert_int_eq(3, result.outputArgumentsSize);
  276. ck_assert_int_eq(result.statusCode, UA_STATUSCODE_GOOD);
  277. //TODO checked correctness of created items
  278. UA_CallMethodResult_deleteMembers(&result);
  279. UA_free(inputArguments);
  280. UA_free(fieldNameAliases);
  281. UA_free(dataSetFieldFlags);
  282. UA_free(variablesToAdd);
  283. UA_Client_disconnect(client);
  284. UA_Client_delete(client);
  285. } END_TEST
  286. START_TEST(AddAndRemoveWriterGroups){
  287. UA_StatusCode retVal;
  288. UA_Client *client = UA_Client_new();
  289. UA_ClientConfig_setDefault(UA_Client_getConfig(client));
  290. retVal = UA_Client_connect(client, "opc.tcp://localhost:4840");
  291. if(retVal != UA_STATUSCODE_GOOD) {
  292. UA_Client_delete(client);
  293. }
  294. ck_assert_int_eq(retVal, UA_STATUSCODE_GOOD);
  295. UA_NodeId createdConnection = addPubSubConnection();
  296. UA_Variant *inputArgument = (UA_Variant *) UA_calloc(1, (sizeof(UA_Variant)));
  297. UA_WriterGroupDataType writerGroupDataType;
  298. UA_WriterGroupDataType_init(&writerGroupDataType);
  299. writerGroupDataType.name = UA_STRING("TestWriterGroup");
  300. writerGroupDataType.enabled = UA_TRUE;
  301. writerGroupDataType.publishingInterval = 500;
  302. writerGroupDataType.writerGroupId = 1234;
  303. UA_Variant_setScalar(inputArgument, &writerGroupDataType, &UA_TYPES[UA_TYPES_WRITERGROUPDATATYPE]);
  304. UA_CallMethodRequest callMethodRequest;
  305. UA_CallMethodRequest_init(&callMethodRequest);
  306. callMethodRequest.inputArgumentsSize = 1;
  307. callMethodRequest.inputArguments = inputArgument;
  308. callMethodRequest.objectId = createdConnection;
  309. callMethodRequest.methodId = UA_NODEID_NUMERIC(0, UA_NS0ID_PUBSUBCONNECTIONTYPE_ADDWRITERGROUP);
  310. UA_CallMethodResult result;
  311. UA_CallMethodResult_init(&result);
  312. result = UA_Server_call(server, &callMethodRequest);
  313. ck_assert_int_eq(result.statusCode, UA_STATUSCODE_GOOD);
  314. ck_assert_int_eq(1, result.outputArgumentsSize);
  315. UA_NodeId createdWriterGroup = UA_NODEID_NULL;
  316. if(result.outputArguments->type == &UA_TYPES[UA_TYPES_NODEID])
  317. createdWriterGroup = *((UA_NodeId *) result.outputArguments->data);
  318. UA_LocalizedText writerGroupDisplayName;
  319. UA_LocalizedText_init(&writerGroupDisplayName);
  320. retVal = UA_Server_readDisplayName(server, createdWriterGroup, &writerGroupDisplayName);
  321. ck_assert_int_eq(retVal, UA_STATUSCODE_GOOD);
  322. UA_String compareText = UA_STRING("TestWriterGroup");
  323. ck_assert(UA_String_equal(&writerGroupDisplayName.text, &compareText) == UA_TRUE);
  324. UA_free(inputArgument);
  325. UA_CallMethodResult_deleteMembers(&result);
  326. UA_Client_disconnect(client);
  327. UA_Client_delete(client);
  328. UA_LocalizedText_deleteMembers(&writerGroupDisplayName);
  329. } END_TEST
  330. int main(void) {
  331. TCase *tc_add_pubsub_informationmodel_methods_connection = tcase_create("PubSub connection delete and creation using the information model methods");
  332. tcase_add_checked_fixture(tc_add_pubsub_informationmodel_methods_connection, setup, teardown);
  333. tcase_add_test(tc_add_pubsub_informationmodel_methods_connection, AddNewPubSubConnectionUsingTheInformationModelMethod);
  334. tcase_add_test(tc_add_pubsub_informationmodel_methods_connection, AddAndRemovePublishedDataSetFolders);
  335. tcase_add_test(tc_add_pubsub_informationmodel_methods_connection, AddAndRemovePublishedDataSetItems);
  336. tcase_add_test(tc_add_pubsub_informationmodel_methods_connection, AddAndRemoveWriterGroups);
  337. //TODO TestCase add publishedDataItems and removePublishedDataItems, writergroup remove
  338. Suite *s = suite_create("PubSub CRUD configuration by the information model functions");
  339. suite_add_tcase(s, tc_add_pubsub_informationmodel_methods_connection);
  340. SRunner *sr = srunner_create(s);
  341. srunner_set_fork_status(sr, CK_NOFORK);
  342. srunner_run_all(sr,CK_NORMAL);
  343. int number_failed = srunner_ntests_failed(sr);
  344. srunner_free(sr);
  345. return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
  346. }