test/prop_tests.c

changeset 158
81d580042da1
parent 147
1aa598f36872
child 177
11ad03783baf
equal deleted inserted replaced
157:ae7cc5716f38 158:81d580042da1
363 ucx_properties_free(parser); 363 ucx_properties_free(parser);
364 } 364 }
365 365
366 UCX_TEST(test_ucx_properties2map) { 366 UCX_TEST(test_ucx_properties2map) {
367 UcxMempool *mp = ucx_mempool_new(64); 367 UcxMempool *mp = ucx_mempool_new(64);
368 UcxAllocator *a = ucx_mempool_allocator(mp); 368 UcxMap *map = ucx_map_new_a(mp->allocator, 16);
369 UcxMap *map = ucx_map_new_a(a, 16);
370 UcxProperties *parser = ucx_properties_new(); 369 UcxProperties *parser = ucx_properties_new();
371 370
372 UCX_TEST_BEGIN 371 UCX_TEST_BEGIN
373 372
374 const char *str = "key1 = value1\nkey2 = value2\n\n#comment\n\nkey3 = value3\n"; 373 const char *str = "key1 = value1\nkey2 = value2\n\n#comment\n\nkey3 = value3\n";
391 UCX_TEST_ASSERT((!strcmp(v2, "value2")), "wrong value for key2"); 390 UCX_TEST_ASSERT((!strcmp(v2, "value2")), "wrong value for key2");
392 UCX_TEST_ASSERT((!strcmp(v3, "value3")), "wrong value for key3"); 391 UCX_TEST_ASSERT((!strcmp(v3, "value3")), "wrong value for key3");
393 392
394 // second test 393 // second test
395 ucx_map_free(map); 394 ucx_map_free(map);
396 map = ucx_map_new_a(a, 16); 395 map = ucx_map_new_a(mp->allocator, 16);
397 396
398 str = "\n#comment\n"; 397 str = "\n#comment\n";
399 ucx_properties_fill(parser, (char*)str, strlen(str)); 398 ucx_properties_fill(parser, (char*)str, strlen(str));
400 399
401 r = ucx_properties2map(parser, map); 400 r = ucx_properties2map(parser, map);

mercurial