| 30 #include "util_allocator.h" |
30 #include "util_allocator.h" |
| 31 |
31 |
| 32 #include "cx/properties.h" |
32 #include "cx/properties.h" |
| 33 #include "cx/hash_map.h" |
33 #include "cx/hash_map.h" |
| 34 |
34 |
| 35 CX_TEST(test_cx_properties_init) { |
35 CX_TEST(test_properties_init) { |
| 36 CxProperties prop; |
36 CxProperties prop; |
| 37 CX_TEST_DO { |
37 CX_TEST_DO { |
| 38 cxPropertiesInitDefault(&prop); |
38 cxPropertiesInitDefault(&prop); |
| 39 |
39 |
| 40 CX_TEST_ASSERT(prop.config.delimiter == '='); |
40 CX_TEST_ASSERT(prop.config.delimiter == '='); |
| 175 CX_TEST_ASSERT(result == CX_PROPERTIES_NO_DATA); |
175 CX_TEST_ASSERT(result == CX_PROPERTIES_NO_DATA); |
| 176 } |
176 } |
| 177 cxPropertiesDestroy(&prop); |
177 cxPropertiesDestroy(&prop); |
| 178 } |
178 } |
| 179 |
179 |
| 180 CX_TEST(test_cx_properties_next_part) { |
180 CX_TEST(test_properties_next_part) { |
| 181 CxProperties prop; |
181 CxProperties prop; |
| 182 cxPropertiesInitDefault(&prop); |
182 cxPropertiesInitDefault(&prop); |
| 183 CxPropertiesStatus result; |
183 CxPropertiesStatus result; |
| 184 cxstring key; |
184 cxstring key; |
| 185 cxstring value; |
185 cxstring value; |
| 284 CX_TEST_ASSERT(result == CX_PROPERTIES_NO_DATA); |
284 CX_TEST_ASSERT(result == CX_PROPERTIES_NO_DATA); |
| 285 } |
285 } |
| 286 cxPropertiesDestroy(&prop); |
286 cxPropertiesDestroy(&prop); |
| 287 } |
287 } |
| 288 |
288 |
| 289 CX_TEST(test_ucx_properties_next_long_lines) { |
289 CX_TEST(test_properties_next_long_lines) { |
| 290 CxProperties prop; |
290 CxProperties prop; |
| 291 cxPropertiesInitDefault(&prop); |
291 cxPropertiesInitDefault(&prop); |
| 292 CxPropertiesStatus result; |
292 CxPropertiesStatus result; |
| 293 cxstring key; |
293 cxstring key; |
| 294 cxstring value; |
294 cxstring value; |
| 430 CX_TEST_ASSERT(cx_testing_allocator_verify(&talloc)); |
430 CX_TEST_ASSERT(cx_testing_allocator_verify(&talloc)); |
| 431 } |
431 } |
| 432 cx_testing_allocator_destroy(&talloc); |
432 cx_testing_allocator_destroy(&talloc); |
| 433 } |
433 } |
| 434 |
434 |
| 435 CX_TEST(test_cx_properties_load_file_to_map) { |
435 CX_TEST(test_properties_load_file_to_map) { |
| 436 CxTestingAllocator talloc; |
436 CxTestingAllocator talloc; |
| 437 cx_testing_allocator_init(&talloc); |
437 cx_testing_allocator_init(&talloc); |
| 438 CxAllocator *alloc = &talloc.base; |
438 CxAllocator *alloc = &talloc.base; |
| 439 CX_TEST_DO { |
439 CX_TEST_DO { |
| 440 FILE *f = tmpfile(); |
440 FILE *f = tmpfile(); |
| 506 } |
506 } |
| 507 |
507 |
| 508 CxTestSuite *cx_test_suite_properties(void) { |
508 CxTestSuite *cx_test_suite_properties(void) { |
| 509 CxTestSuite *suite = cx_test_suite_new("properties"); |
509 CxTestSuite *suite = cx_test_suite_new("properties"); |
| 510 |
510 |
| 511 cx_test_register(suite, test_cx_properties_init); |
511 cx_test_register(suite, test_properties_init); |
| 512 cx_test_register(suite, test_cx_properties_next); |
512 cx_test_register(suite, test_properties_next); |
| 513 cx_test_register(suite, test_cx_properties_next_multi); |
513 cx_test_register(suite, test_properties_next_multi); |
| 514 cx_test_register(suite, test_cx_properties_next_part); |
514 cx_test_register(suite, test_properties_next_part); |
| 515 cx_test_register(suite, test_ucx_properties_next_long_lines); |
515 cx_test_register(suite, test_properties_next_long_lines); |
| 516 cx_test_register(suite, test_cx_properties_load_string_to_map); |
516 cx_test_register(suite, test_properties_load_string_to_map); |
| 517 cx_test_register(suite, test_cx_properties_load_file_to_map); |
517 cx_test_register(suite, test_properties_load_file_to_map); |
| 518 |
518 |
| 519 return suite; |
519 return suite; |
| 520 } |
520 } |