26 * POSSIBILITY OF SUCH DAMAGE. |
26 * POSSIBILITY OF SUCH DAMAGE. |
27 */ |
27 */ |
28 |
28 |
29 #include "prop_tests.h" |
29 #include "prop_tests.h" |
30 |
30 |
31 UCX_TEST_IMPLEMENT(test_ucx_properties_new) { |
31 UCX_TEST(test_ucx_properties_new) { |
32 UcxProperties *parser = ucx_properties_new(); |
32 UcxProperties *parser = ucx_properties_new(); |
33 |
33 |
34 UCX_TEST_BEGIN |
34 UCX_TEST_BEGIN |
35 |
35 |
36 UCX_TEST_ASSERT(parser != NULL, "failed"); |
36 UCX_TEST_ASSERT(parser != NULL, "failed"); |
284 UCX_TEST_END |
284 UCX_TEST_END |
285 |
285 |
286 ucx_properties_free(parser); |
286 ucx_properties_free(parser); |
287 } |
287 } |
288 |
288 |
289 UCX_TEST_IMPLEMENT(test_ucx_properties_next_long) { |
289 UCX_TEST(test_ucx_properties_next_long) { |
290 UcxProperties *parser = ucx_properties_new(); |
290 UcxProperties *parser = ucx_properties_new(); |
291 int r; |
291 int r; |
292 size_t name_len = 512; |
292 size_t name_len = 512; |
293 char *long_name = (char*)malloc(name_len); |
293 char *long_name = (char*)malloc(name_len); |
294 memset(long_name, 'a', 70); |
294 memset(long_name, 'a', 70); |
415 UCX_TEST_END |
415 UCX_TEST_END |
416 |
416 |
417 ucx_properties_free(parser); |
417 ucx_properties_free(parser); |
418 } |
418 } |
419 |
419 |
420 UCX_TEST_IMPLEMENT(test_ucx_properties_load) { |
420 UCX_TEST(test_ucx_properties_load) { |
421 UCX_TEST_BEGIN |
421 UCX_TEST_BEGIN |
422 FILE *f = tmpfile(); |
422 FILE *f = tmpfile(); |
423 UCX_TEST_ASSERT(f, "test file cannot be opened, test aborted"); |
423 UCX_TEST_ASSERT(f, "test file cannot be opened, test aborted"); |
424 |
424 |
425 fprintf(f, "# properties file\n\nkey1 = value1\nkey2 = value2\n"); |
425 fprintf(f, "# properties file\n\nkey1 = value1\nkey2 = value2\n"); |
478 fclose(f); |
478 fclose(f); |
479 |
479 |
480 UCX_TEST_END |
480 UCX_TEST_END |
481 } |
481 } |
482 |
482 |
483 UCX_TEST_IMPLEMENT(test_ucx_properties_store) { |
483 UCX_TEST(test_ucx_properties_store) { |
484 UcxMap *map1 = ucx_map_new(16); |
484 UcxMap *map1 = ucx_map_new(16); |
485 ucx_map_cstr_put(map1, "key1", "value1"); |
485 ucx_map_cstr_put(map1, "key1", "value1"); |
486 ucx_map_cstr_put(map1, "key2", "value2"); |
486 ucx_map_cstr_put(map1, "key2", "value2"); |
487 ucx_map_cstr_put(map1, "key3", "value3"); |
487 ucx_map_cstr_put(map1, "key3", "value3"); |
488 ucx_map_cstr_put(map1, "key4", "value4"); |
488 ucx_map_cstr_put(map1, "key4", "value4"); |