property_write.c 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578
  1. #include <CUnit/CUnit.h>
  2. #include <CUnit/Basic.h>
  3. #include "mqtt_protocol.h"
  4. #include "property_mosq.h"
  5. #include "packet_mosq.h"
  6. static void byte_prop_write_helper(
  7. int command,
  8. uint32_t remaining_length,
  9. int rc_expected,
  10. int identifier,
  11. uint8_t value_expected)
  12. {
  13. mosquitto_property property;
  14. struct mosquitto__packet packet;
  15. mosquitto_property *properties;
  16. int rc;
  17. memset(&property, 0, sizeof(mosquitto_property));
  18. property.identifier = identifier;
  19. property.value.i8 = value_expected;
  20. memset(&packet, 0, sizeof(struct mosquitto__packet));
  21. packet.remaining_length = property__get_length_all(&property)+1;
  22. packet.packet_length = packet.remaining_length+10;
  23. packet.payload = calloc(packet.remaining_length+10, 1);
  24. CU_ASSERT_PTR_NOT_NULL(packet.payload);
  25. if(!packet.payload) return;
  26. property__write_all(&packet, &property, true);
  27. packet.pos = 0;
  28. rc = property__read_all(command, &packet, &properties);
  29. CU_ASSERT_EQUAL(rc, rc_expected);
  30. CU_ASSERT_EQUAL(packet.pos, remaining_length);
  31. if(properties){
  32. CU_ASSERT_EQUAL(properties->identifier, identifier);
  33. CU_ASSERT_EQUAL(properties->value.i8, value_expected);
  34. CU_ASSERT_PTR_EQUAL(properties->next, NULL);
  35. CU_ASSERT_EQUAL(property__get_length_all(properties), 2);
  36. mosquitto_property_free_all(&properties);
  37. }
  38. CU_ASSERT_PTR_EQUAL(properties, NULL);
  39. free(packet.payload);
  40. }
  41. static void int32_prop_write_helper(
  42. int command,
  43. uint32_t remaining_length,
  44. int rc_expected,
  45. int identifier,
  46. uint32_t value_expected)
  47. {
  48. mosquitto_property property;
  49. struct mosquitto__packet packet;
  50. mosquitto_property *properties;
  51. int rc;
  52. memset(&property, 0, sizeof(mosquitto_property));
  53. property.identifier = identifier;
  54. property.value.i32 = value_expected;
  55. memset(&packet, 0, sizeof(struct mosquitto__packet));
  56. packet.remaining_length = property__get_length_all(&property)+1;
  57. packet.packet_length = packet.remaining_length+10;
  58. packet.payload = calloc(packet.remaining_length+10, 1);
  59. CU_ASSERT_PTR_NOT_NULL(packet.payload);
  60. if(!packet.payload) return;
  61. property__write_all(&packet, &property, true);
  62. packet.pos = 0;
  63. rc = property__read_all(command, &packet, &properties);
  64. CU_ASSERT_EQUAL(rc, rc_expected);
  65. CU_ASSERT_EQUAL(packet.pos, remaining_length);
  66. if(properties){
  67. CU_ASSERT_EQUAL(properties->identifier, identifier);
  68. CU_ASSERT_EQUAL(properties->value.i32, value_expected);
  69. CU_ASSERT_PTR_EQUAL(properties->next, NULL);
  70. CU_ASSERT_EQUAL(property__get_length_all(properties), 5);
  71. mosquitto_property_free_all(&properties);
  72. }
  73. CU_ASSERT_PTR_EQUAL(properties, NULL);
  74. free(packet.payload);
  75. }
  76. static void int16_prop_write_helper(
  77. int command,
  78. uint32_t remaining_length,
  79. int rc_expected,
  80. int identifier,
  81. uint16_t value_expected)
  82. {
  83. mosquitto_property property;
  84. struct mosquitto__packet packet;
  85. mosquitto_property *properties;
  86. int rc;
  87. memset(&property, 0, sizeof(mosquitto_property));
  88. property.identifier = identifier;
  89. property.value.i16 = value_expected;
  90. memset(&packet, 0, sizeof(struct mosquitto__packet));
  91. packet.remaining_length = property__get_length_all(&property)+1;
  92. packet.packet_length = packet.remaining_length+10;
  93. packet.payload = calloc(packet.remaining_length+10, 1);
  94. CU_ASSERT_PTR_NOT_NULL(packet.payload);
  95. if(!packet.payload) return;
  96. property__write_all(&packet, &property, true);
  97. packet.pos = 0;
  98. rc = property__read_all(command, &packet, &properties);
  99. CU_ASSERT_EQUAL(rc, rc_expected);
  100. CU_ASSERT_EQUAL(packet.pos, remaining_length);
  101. if(properties){
  102. CU_ASSERT_EQUAL(properties->identifier, identifier);
  103. CU_ASSERT_EQUAL(properties->value.i16, value_expected);
  104. CU_ASSERT_PTR_EQUAL(properties->next, NULL);
  105. CU_ASSERT_EQUAL(property__get_length_all(properties), 3);
  106. mosquitto_property_free_all(&properties);
  107. }
  108. CU_ASSERT_PTR_EQUAL(properties, NULL);
  109. free(packet.payload);
  110. }
  111. static void string_prop_write_helper(
  112. int command,
  113. uint32_t remaining_length,
  114. int rc_expected,
  115. int identifier,
  116. const char *value_expected)
  117. {
  118. mosquitto_property property;
  119. struct mosquitto__packet packet;
  120. mosquitto_property *properties;
  121. int rc;
  122. memset(&property, 0, sizeof(mosquitto_property));
  123. property.identifier = identifier;
  124. property.value.s.v = strdup(value_expected);
  125. CU_ASSERT_PTR_NOT_NULL(property.value.s.v);
  126. if(!property.value.s.v) return;
  127. property.value.s.len = (uint16_t)strlen(value_expected);
  128. memset(&packet, 0, sizeof(struct mosquitto__packet));
  129. packet.remaining_length = property__get_length_all(&property)+1;
  130. packet.packet_length = packet.remaining_length+10;
  131. packet.payload = calloc(packet.remaining_length+10, 1);
  132. CU_ASSERT_PTR_NOT_NULL(packet.payload);
  133. if(!packet.payload) return;
  134. property__write_all(&packet, &property, true);
  135. packet.pos = 0;
  136. rc = property__read_all(command, &packet, &properties);
  137. CU_ASSERT_EQUAL(rc, rc_expected);
  138. CU_ASSERT_EQUAL(packet.pos, remaining_length);
  139. if(properties){
  140. CU_ASSERT_EQUAL(properties->identifier, identifier);
  141. CU_ASSERT_EQUAL(properties->value.s.len, strlen(value_expected));
  142. CU_ASSERT_STRING_EQUAL(properties->value.s.v, value_expected);
  143. CU_ASSERT_PTR_EQUAL(properties->next, NULL);
  144. CU_ASSERT_EQUAL(property__get_length_all(properties), 1+2+strlen(value_expected));
  145. mosquitto_property_free_all(&properties);
  146. }
  147. CU_ASSERT_PTR_EQUAL(properties, NULL);
  148. free(property.value.s.v);
  149. free(packet.payload);
  150. }
  151. static void binary_prop_write_helper(
  152. int command,
  153. uint32_t remaining_length,
  154. int rc_expected,
  155. int identifier,
  156. const uint8_t *value_expected,
  157. uint16_t len_expected)
  158. {
  159. mosquitto_property property;
  160. struct mosquitto__packet packet;
  161. mosquitto_property *properties;
  162. int rc;
  163. memset(&property, 0, sizeof(mosquitto_property));
  164. property.identifier = identifier;
  165. property.value.bin.v = malloc(len_expected);
  166. CU_ASSERT_PTR_NOT_NULL(property.value.bin.v);
  167. if(!property.value.bin.v) return;
  168. memcpy(property.value.bin.v, value_expected, len_expected);
  169. property.value.bin.len = len_expected;
  170. memset(&packet, 0, sizeof(struct mosquitto__packet));
  171. packet.remaining_length = property__get_length_all(&property)+1;
  172. packet.packet_length = packet.remaining_length+10;
  173. packet.payload = calloc(packet.remaining_length+10, 1);
  174. CU_ASSERT_PTR_NOT_NULL(packet.payload);
  175. if(!packet.payload) return;
  176. property__write_all(&packet, &property, true);
  177. packet.pos = 0;
  178. rc = property__read_all(command, &packet, &properties);
  179. CU_ASSERT_EQUAL(rc, rc_expected);
  180. CU_ASSERT_EQUAL(packet.pos, remaining_length);
  181. if(properties){
  182. CU_ASSERT_EQUAL(properties->identifier, identifier);
  183. CU_ASSERT_EQUAL(properties->value.bin.len, len_expected);
  184. CU_ASSERT_EQUAL(memcmp(properties->value.bin.v, value_expected, len_expected), 0);
  185. CU_ASSERT_PTR_EQUAL(properties->next, NULL);
  186. CU_ASSERT_EQUAL(property__get_length_all(properties), 1+2+len_expected);
  187. mosquitto_property_free_all(&properties);
  188. }
  189. CU_ASSERT_PTR_EQUAL(properties, NULL);
  190. free(property.value.bin.v);
  191. free(packet.payload);
  192. }
  193. static void string_pair_prop_write_helper(
  194. uint32_t remaining_length,
  195. int rc_expected,
  196. int identifier,
  197. const char *name_expected,
  198. const char *value_expected,
  199. bool expect_multiple)
  200. {
  201. mosquitto_property property;
  202. struct mosquitto__packet packet;
  203. mosquitto_property *properties;
  204. int rc;
  205. memset(&property, 0, sizeof(mosquitto_property));
  206. property.identifier = identifier;
  207. property.value.s.v = strdup(value_expected);
  208. CU_ASSERT_PTR_NOT_NULL(property.value.s.v);
  209. if(!property.value.s.v) return;
  210. property.value.s.len = (uint16_t)strlen(value_expected);
  211. property.name.v = strdup(name_expected);
  212. CU_ASSERT_PTR_NOT_NULL(property.name.v);
  213. if(!property.name.v) return;
  214. property.name.len = (uint16_t)strlen(name_expected);
  215. memset(&packet, 0, sizeof(struct mosquitto__packet));
  216. packet.remaining_length = property__get_length_all(&property)+1;
  217. packet.packet_length = packet.remaining_length+10;
  218. packet.payload = calloc(packet.remaining_length+10, 1);
  219. CU_ASSERT_PTR_NOT_NULL(packet.payload);
  220. if(!packet.payload) return;
  221. property__write_all(&packet, &property, true);
  222. packet.pos = 0;
  223. rc = property__read_all(CMD_CONNECT, &packet, &properties);
  224. CU_ASSERT_EQUAL(rc, rc_expected);
  225. CU_ASSERT_EQUAL(packet.pos, remaining_length);
  226. if(properties){
  227. CU_ASSERT_EQUAL(properties->identifier, identifier);
  228. CU_ASSERT_EQUAL(properties->name.len, strlen(name_expected));
  229. CU_ASSERT_EQUAL(properties->value.s.len, strlen(value_expected));
  230. CU_ASSERT_STRING_EQUAL(properties->name.v, name_expected);
  231. CU_ASSERT_STRING_EQUAL(properties->value.s.v, value_expected);
  232. if(expect_multiple){
  233. CU_ASSERT_PTR_NOT_NULL(properties->next);
  234. }else{
  235. CU_ASSERT_PTR_NULL(properties->next);
  236. CU_ASSERT_EQUAL(property__get_length_all(properties), 1+2+strlen(name_expected)+2+strlen(value_expected));
  237. }
  238. mosquitto_property_free_all(&properties);
  239. }
  240. CU_ASSERT_PTR_NULL(properties);
  241. free(property.value.s.v);
  242. free(property.name.v);
  243. free(packet.payload);
  244. }
  245. static void varint_prop_write_helper(
  246. uint32_t remaining_length,
  247. int rc_expected,
  248. int identifier,
  249. uint32_t value_expected)
  250. {
  251. mosquitto_property property;
  252. struct mosquitto__packet packet;
  253. mosquitto_property *properties;
  254. int rc;
  255. memset(&property, 0, sizeof(mosquitto_property));
  256. property.identifier = identifier;
  257. property.value.varint = value_expected;
  258. memset(&packet, 0, sizeof(struct mosquitto__packet));
  259. packet.remaining_length = property__get_length_all(&property)+1;
  260. CU_ASSERT_EQUAL(packet.remaining_length, remaining_length);
  261. packet.packet_length = packet.remaining_length+10;
  262. packet.payload = calloc(packet.remaining_length+10, 1);
  263. CU_ASSERT_PTR_NOT_NULL(packet.payload);
  264. if(!packet.payload) return;
  265. property__write_all(&packet, &property, true);
  266. packet.pos = 0;
  267. rc = property__read_all(CMD_PUBLISH, &packet, &properties);
  268. CU_ASSERT_EQUAL(rc, rc_expected);
  269. if(properties){
  270. CU_ASSERT_EQUAL(properties->identifier, identifier);
  271. CU_ASSERT_EQUAL(properties->value.varint, value_expected);
  272. CU_ASSERT_PTR_NULL(properties->next);
  273. if(value_expected < 128){
  274. CU_ASSERT_EQUAL(property__get_length_all(properties), 2);
  275. }else if(value_expected < 16384){
  276. CU_ASSERT_EQUAL(property__get_length_all(properties), 3);
  277. }else if(value_expected < 2097152){
  278. CU_ASSERT_EQUAL(property__get_length_all(properties), 4);
  279. }else if(value_expected < 268435456){
  280. CU_ASSERT_EQUAL(property__get_length_all(properties), 5);
  281. }else{
  282. CU_FAIL("Incorrect varint value.");
  283. }
  284. mosquitto_property_free_all(&properties);
  285. }
  286. CU_ASSERT_PTR_NULL(properties);
  287. free(packet.payload);
  288. }
  289. /* ========================================================================
  290. * BAD IDENTIFIER
  291. * ======================================================================== */
  292. static void TEST_bad_identifier(void)
  293. {
  294. mosquitto_property property;
  295. struct mosquitto__packet packet;
  296. uint8_t payload[10];
  297. int rc;
  298. memset(&property, 0, sizeof(mosquitto_property));
  299. memset(&packet, 0, sizeof(struct mosquitto__packet));
  300. property.identifier = 0xFFFF;
  301. packet.packet_length = 10;
  302. packet.remaining_length = 8;
  303. packet.payload = payload;
  304. rc = property__write_all(&packet, &property, true);
  305. CU_ASSERT_EQUAL(rc, MOSQ_ERR_INVAL);
  306. }
  307. /* ========================================================================
  308. * SINGLE PROPERTIES
  309. * ======================================================================== */
  310. static void TEST_single_payload_format_indicator(void)
  311. {
  312. byte_prop_write_helper(CMD_PUBLISH, 3, MOSQ_ERR_SUCCESS, MQTT_PROP_PAYLOAD_FORMAT_INDICATOR, 1);
  313. }
  314. static void TEST_single_request_problem_information(void)
  315. {
  316. byte_prop_write_helper(CMD_CONNECT, 3, MOSQ_ERR_SUCCESS, MQTT_PROP_REQUEST_PROBLEM_INFORMATION, 1);
  317. }
  318. static void TEST_single_request_response_information(void)
  319. {
  320. byte_prop_write_helper(CMD_CONNECT, 3, MOSQ_ERR_SUCCESS, MQTT_PROP_REQUEST_RESPONSE_INFORMATION, 1);
  321. }
  322. static void TEST_single_maximum_qos(void)
  323. {
  324. byte_prop_write_helper(CMD_CONNACK, 3, MOSQ_ERR_SUCCESS, MQTT_PROP_MAXIMUM_QOS, 1);
  325. }
  326. static void TEST_single_retain_available(void)
  327. {
  328. byte_prop_write_helper(CMD_CONNACK, 3, MOSQ_ERR_SUCCESS, MQTT_PROP_RETAIN_AVAILABLE, 1);
  329. }
  330. static void TEST_single_wildcard_subscription_available(void)
  331. {
  332. byte_prop_write_helper(CMD_CONNACK, 3, MOSQ_ERR_SUCCESS, MQTT_PROP_WILDCARD_SUB_AVAILABLE, 0);
  333. }
  334. static void TEST_single_subscription_identifier_available(void)
  335. {
  336. byte_prop_write_helper(CMD_CONNACK, 3, MOSQ_ERR_SUCCESS, MQTT_PROP_SUBSCRIPTION_ID_AVAILABLE, 0);
  337. }
  338. static void TEST_single_shared_subscription_available(void)
  339. {
  340. byte_prop_write_helper(CMD_CONNACK, 3, MOSQ_ERR_SUCCESS, MQTT_PROP_SHARED_SUB_AVAILABLE, 1);
  341. }
  342. static void TEST_single_message_expiry_interval(void)
  343. {
  344. int32_prop_write_helper(CMD_PUBLISH, 6, MOSQ_ERR_SUCCESS, MQTT_PROP_MESSAGE_EXPIRY_INTERVAL, 0x12233445);
  345. }
  346. static void TEST_single_session_expiry_interval(void)
  347. {
  348. int32_prop_write_helper(CMD_CONNACK, 6, MOSQ_ERR_SUCCESS, MQTT_PROP_SESSION_EXPIRY_INTERVAL, 0x45342312);
  349. }
  350. static void TEST_single_will_delay_interval(void)
  351. {
  352. int32_prop_write_helper(CMD_WILL, 6, MOSQ_ERR_SUCCESS, MQTT_PROP_WILL_DELAY_INTERVAL, 0x45342312);
  353. }
  354. static void TEST_single_maximum_packet_size(void)
  355. {
  356. int32_prop_write_helper(CMD_CONNECT, 6, MOSQ_ERR_SUCCESS, MQTT_PROP_MAXIMUM_PACKET_SIZE, 0x45342312);
  357. }
  358. static void TEST_single_server_keep_alive(void)
  359. {
  360. int16_prop_write_helper(CMD_CONNACK, 4, MOSQ_ERR_SUCCESS, MQTT_PROP_SERVER_KEEP_ALIVE, 0x4534);
  361. }
  362. static void TEST_single_receive_maximum(void)
  363. {
  364. int16_prop_write_helper(CMD_CONNACK, 4, MOSQ_ERR_SUCCESS, MQTT_PROP_RECEIVE_MAXIMUM, 0x6842);
  365. }
  366. static void TEST_single_topic_alias_maximum(void)
  367. {
  368. int16_prop_write_helper(CMD_CONNECT, 4, MOSQ_ERR_SUCCESS, MQTT_PROP_TOPIC_ALIAS_MAXIMUM, 0x6842);
  369. }
  370. static void TEST_single_topic_alias(void)
  371. {
  372. int16_prop_write_helper(CMD_PUBLISH, 4, MOSQ_ERR_SUCCESS, MQTT_PROP_TOPIC_ALIAS, 0x6842);
  373. }
  374. static void TEST_single_content_type(void)
  375. {
  376. string_prop_write_helper(CMD_PUBLISH, 9, MOSQ_ERR_SUCCESS, MQTT_PROP_CONTENT_TYPE, "hello");
  377. }
  378. static void TEST_single_response_topic(void)
  379. {
  380. string_prop_write_helper(CMD_WILL, 9, MOSQ_ERR_SUCCESS, MQTT_PROP_RESPONSE_TOPIC, "hello");
  381. }
  382. static void TEST_single_assigned_client_identifier(void)
  383. {
  384. string_prop_write_helper(CMD_CONNACK, 9, MOSQ_ERR_SUCCESS, MQTT_PROP_ASSIGNED_CLIENT_IDENTIFIER, "hello");
  385. }
  386. static void TEST_single_authentication_method(void)
  387. {
  388. string_prop_write_helper(CMD_CONNECT, 9, MOSQ_ERR_SUCCESS, MQTT_PROP_AUTHENTICATION_METHOD, "hello");
  389. }
  390. static void TEST_single_response_information(void)
  391. {
  392. string_prop_write_helper(CMD_CONNACK, 9, MOSQ_ERR_SUCCESS, MQTT_PROP_RESPONSE_INFORMATION, "hello");
  393. }
  394. static void TEST_single_server_reference(void)
  395. {
  396. string_prop_write_helper(CMD_CONNACK, 9, MOSQ_ERR_SUCCESS, MQTT_PROP_SERVER_REFERENCE, "hello");
  397. }
  398. static void TEST_single_reason_string(void)
  399. {
  400. string_prop_write_helper(CMD_PUBREC, 9, MOSQ_ERR_SUCCESS, MQTT_PROP_REASON_STRING, "hello");
  401. }
  402. static void TEST_single_correlation_data(void)
  403. {
  404. uint8_t payload[5] = {1, 'e', 0, 'l', 9};
  405. binary_prop_write_helper(CMD_PUBLISH, 9, MOSQ_ERR_SUCCESS, MQTT_PROP_CORRELATION_DATA, payload, 5);
  406. }
  407. static void TEST_single_authentication_data(void)
  408. {
  409. uint8_t payload[5] = {1, 'e', 0, 'l', 9};
  410. binary_prop_write_helper(CMD_CONNECT, 9, MOSQ_ERR_SUCCESS, MQTT_PROP_AUTHENTICATION_DATA, payload, 5);
  411. }
  412. static void TEST_single_user_property(void)
  413. {
  414. string_pair_prop_write_helper(10, MOSQ_ERR_SUCCESS, MQTT_PROP_USER_PROPERTY, "za", "bc", false);
  415. }
  416. static void TEST_single_subscription_identifier(void)
  417. {
  418. varint_prop_write_helper(3, MOSQ_ERR_SUCCESS, MQTT_PROP_SUBSCRIPTION_IDENTIFIER, 0);
  419. varint_prop_write_helper(3, MOSQ_ERR_SUCCESS, MQTT_PROP_SUBSCRIPTION_IDENTIFIER, 127);
  420. varint_prop_write_helper(4, MOSQ_ERR_SUCCESS, MQTT_PROP_SUBSCRIPTION_IDENTIFIER, 128);
  421. varint_prop_write_helper(4, MOSQ_ERR_SUCCESS, MQTT_PROP_SUBSCRIPTION_IDENTIFIER, 16383);
  422. varint_prop_write_helper(5, MOSQ_ERR_SUCCESS, MQTT_PROP_SUBSCRIPTION_IDENTIFIER, 16384);
  423. varint_prop_write_helper(5, MOSQ_ERR_SUCCESS, MQTT_PROP_SUBSCRIPTION_IDENTIFIER, 2097151);
  424. varint_prop_write_helper(6, MOSQ_ERR_SUCCESS, MQTT_PROP_SUBSCRIPTION_IDENTIFIER, 2097152);
  425. varint_prop_write_helper(6, MOSQ_ERR_SUCCESS, MQTT_PROP_SUBSCRIPTION_IDENTIFIER, 268435455);
  426. }
  427. /* ========================================================================
  428. * TEST SUITE SETUP
  429. * ======================================================================== */
  430. int init_property_write_tests(void)
  431. {
  432. CU_pSuite test_suite = NULL;
  433. test_suite = CU_add_suite("Property write", NULL, NULL);
  434. if(!test_suite){
  435. printf("Error adding CUnit Property write test suite.\n");
  436. return 1;
  437. }
  438. if(0
  439. || !CU_add_test(test_suite, "Bad identifier", TEST_bad_identifier)
  440. || !CU_add_test(test_suite, "Single Payload Format Indicator", TEST_single_payload_format_indicator)
  441. || !CU_add_test(test_suite, "Single Request Problem Information", TEST_single_request_problem_information)
  442. || !CU_add_test(test_suite, "Single Request Response Information", TEST_single_request_response_information)
  443. || !CU_add_test(test_suite, "Single Maximum QoS", TEST_single_maximum_qos)
  444. || !CU_add_test(test_suite, "Single Retain Available", TEST_single_retain_available)
  445. || !CU_add_test(test_suite, "Single Wildcard Subscription Available", TEST_single_wildcard_subscription_available)
  446. || !CU_add_test(test_suite, "Single Subscription Identifier Available", TEST_single_subscription_identifier_available)
  447. || !CU_add_test(test_suite, "Single Shared Subscription Available", TEST_single_shared_subscription_available)
  448. || !CU_add_test(test_suite, "Single Message Expiry Interval", TEST_single_message_expiry_interval)
  449. || !CU_add_test(test_suite, "Single Session Expiry Interval", TEST_single_session_expiry_interval)
  450. || !CU_add_test(test_suite, "Single Will Delay Interval", TEST_single_will_delay_interval)
  451. || !CU_add_test(test_suite, "Single Maximum Packet Size", TEST_single_maximum_packet_size)
  452. || !CU_add_test(test_suite, "Single Server Keep Alive", TEST_single_server_keep_alive)
  453. || !CU_add_test(test_suite, "Single Receive Maximum", TEST_single_receive_maximum)
  454. || !CU_add_test(test_suite, "Single Topic Alias Maximum", TEST_single_topic_alias_maximum)
  455. || !CU_add_test(test_suite, "Single Topic Alias", TEST_single_topic_alias)
  456. || !CU_add_test(test_suite, "Single Content Type", TEST_single_content_type)
  457. || !CU_add_test(test_suite, "Single Response Topic", TEST_single_response_topic)
  458. || !CU_add_test(test_suite, "Single Assigned Client Identifier", TEST_single_assigned_client_identifier)
  459. || !CU_add_test(test_suite, "Single Authentication Method", TEST_single_authentication_method)
  460. || !CU_add_test(test_suite, "Single Response Information", TEST_single_response_information)
  461. || !CU_add_test(test_suite, "Single Server Reference", TEST_single_server_reference)
  462. || !CU_add_test(test_suite, "Single Reason String", TEST_single_reason_string)
  463. || !CU_add_test(test_suite, "Single Correlation Data", TEST_single_correlation_data)
  464. || !CU_add_test(test_suite, "Single Authentication Data", TEST_single_authentication_data)
  465. || !CU_add_test(test_suite, "Single User Property", TEST_single_user_property)
  466. || !CU_add_test(test_suite, "Single Subscription Identifier", TEST_single_subscription_identifier)
  467. ){
  468. printf("Error adding Property read CUnit tests.\n");
  469. return 1;
  470. }
  471. return 0;
  472. }