| 575 | |
| 576 | #if defined(ASMJIT_TEST) |
| 577 | static void test_string_grow() noexcept { |
| 578 | String s; |
| 579 | size_t c = s.capacity(); |
| 580 | |
| 581 | INFO("Testing string grow strategy (SSO capacity: %zu)", c); |
| 582 | for (size_t i = 0; i < 1000000; i++) { |
| 583 | s.append('x'); |
| 584 | if (s.capacity() != c) { |
| 585 | c = s.capacity(); |
| 586 | INFO(" String reallocated to new capacity: %zu", c); |
| 587 | } |
| 588 | } |
| 589 | |
| 590 | // We don't expect a 1 million character string to occupy 4MiB, for example. So verify that! |
| 591 | EXPECT_LT(c, size_t(4 * 1024 * 1024)); |
| 592 | } |
| 593 | |
| 594 | UNIT(core_string) { |
| 595 | String s; |