| 537 cxMapPut(src, source_keys[i], &source[i]); |
537 cxMapPut(src, source_keys[i], &source[i]); |
| 538 } |
538 } |
| 539 CX_TEST_DO { |
539 CX_TEST_DO { |
| 540 int c = 4; |
540 int c = 4; |
| 541 test_hash_map_clone_func_max_clones = 100; // no limit |
541 test_hash_map_clone_func_max_clones = 100; // no limit |
| 542 size_t cloned = cxMapClone(dst, src, test_hash_map_clone_func, NULL, &c); |
542 CX_TEST_ASSERT(0 == cxMapClone(dst, src, test_hash_map_clone_func, NULL, &c)); |
| 543 CX_TEST_ASSERT(cloned == 3); |
|
| 544 CX_TEST_ASSERT(cxMapSize(dst) == 5); |
543 CX_TEST_ASSERT(cxMapSize(dst) == 5); |
| 545 CX_TEST_ASSERT(*((int*)cxMapGet(dst, "k1")) == 1); |
544 CX_TEST_ASSERT(*((int*)cxMapGet(dst, "k1")) == 1); |
| 546 CX_TEST_ASSERT(*((int*)cxMapGet(dst, "k2")) == 13); |
545 CX_TEST_ASSERT(*((int*)cxMapGet(dst, "k2")) == 13); |
| 547 CX_TEST_ASSERT(*((int*)cxMapGet(dst, "k3")) == 4); |
546 CX_TEST_ASSERT(*((int*)cxMapGet(dst, "k3")) == 4); |
| 548 CX_TEST_ASSERT(*((int*)cxMapGet(dst, "k4")) == 11); |
547 CX_TEST_ASSERT(*((int*)cxMapGet(dst, "k4")) == 11); |
| 568 cxMapPut(src, source_keys[i], &source[i]); |
567 cxMapPut(src, source_keys[i], &source[i]); |
| 569 } |
568 } |
| 570 CX_TEST_DO { |
569 CX_TEST_DO { |
| 571 int c = 4; |
570 int c = 4; |
| 572 test_hash_map_clone_func_max_clones = 2; |
571 test_hash_map_clone_func_max_clones = 2; |
| 573 size_t cloned = cxMapClone(dst, src, test_hash_map_clone_func, NULL, &c); |
572 CX_TEST_ASSERT(0 != cxMapClone(dst, src, test_hash_map_clone_func, NULL, &c)); |
| 574 CX_TEST_ASSERT(cloned == 2); |
|
| 575 CX_TEST_ASSERT(cxMapSize(dst) == 4); |
573 CX_TEST_ASSERT(cxMapSize(dst) == 4); |
| 576 CX_TEST_ASSERT(*((int*)cxMapGet(dst, "k1")) == 1); |
574 CX_TEST_ASSERT(*((int*)cxMapGet(dst, "k1")) == 1); |
| 577 CX_TEST_ASSERT(*((int*)cxMapGet(dst, "k2")) == 13); |
575 CX_TEST_ASSERT(*((int*)cxMapGet(dst, "k2")) == 13); |
| 578 CX_TEST_ASSERT(*((int*)cxMapGet(dst, "k3")) == 4); |
576 CX_TEST_ASSERT(*((int*)cxMapGet(dst, "k3")) == 4); |
| 579 // the concrete element which is affected might change when the hash function changes |
577 // the concrete element which is affected might change when the hash function changes |
| 606 cxMapPut(src, source_keys[i], &source[i]); |
604 cxMapPut(src, source_keys[i], &source[i]); |
| 607 } |
605 } |
| 608 CX_TEST_DO { |
606 CX_TEST_DO { |
| 609 int c = 4; |
607 int c = 4; |
| 610 test_hash_map_clone_func_max_clones = 100; // no limit |
608 test_hash_map_clone_func_max_clones = 100; // no limit |
| 611 size_t cloned = cxMapClone(dst, src, test_hash_map_clone_func, allocator, &c); |
609 CX_TEST_ASSERT(0 == cxMapClone(dst, src, test_hash_map_clone_func, allocator, &c)); |
| 612 CX_TEST_ASSERT(cloned == 3); |
|
| 613 CX_TEST_ASSERT(cxMapSize(dst) == 5); |
610 CX_TEST_ASSERT(cxMapSize(dst) == 5); |
| 614 CX_TEST_ASSERT(*((int*)cxMapGet(dst, "k1")) == 1); |
611 CX_TEST_ASSERT(*((int*)cxMapGet(dst, "k1")) == 1); |
| 615 CX_TEST_ASSERT(*((int*)cxMapGet(dst, "k2")) == 13); |
612 CX_TEST_ASSERT(*((int*)cxMapGet(dst, "k2")) == 13); |
| 616 CX_TEST_ASSERT(*((int*)cxMapGet(dst, "k3")) == 4); |
613 CX_TEST_ASSERT(*((int*)cxMapGet(dst, "k3")) == 4); |
| 617 CX_TEST_ASSERT(*((int*)cxMapGet(dst, "k4")) == 11); |
614 CX_TEST_ASSERT(*((int*)cxMapGet(dst, "k4")) == 11); |