MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / test_string_grow

Function test_string_grow

lib/asmjit/asmjit/core/string.cpp:577–592  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

575
576#if defined(ASMJIT_TEST)
577static 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
594UNIT(core_string) {
595 String s;

Callers 1

UNITFunction · 0.85

Calls 2

capacityMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected