MCPcopy Create free account
hub / github.com/arvidn/libtorrent / TORRENT_TEST

Function TORRENT_TEST

test/test_stack_allocator.cpp:43–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41using namespace lt::literals;
42
43TORRENT_TEST(copy_string)
44{
45 stack_allocator a;
46 allocation_slot const idx1 = a.copy_string("testing");
47
48 // attempt to trigger a reallocation
49 a.allocate(100000);
50
51 allocation_slot const idx2 = a.copy_string(std::string("foobar"));
52
53 TEST_CHECK(a.ptr(idx1) == "testing"_sv);
54 TEST_CHECK(a.ptr(idx2) == "foobar"_sv);
55}
56
57TORRENT_TEST(copy_buffer)
58{

Callers

nothing calls this directly

Calls 8

format_string_helperFunction · 0.85
maxFunction · 0.85
ptrMethod · 0.80
copy_bufferMethod · 0.80
copy_stringMethod · 0.45
allocateMethod · 0.45
is_validMethod · 0.45
swapMethod · 0.45

Tested by

no test coverage detected