MCPcopy Create free account
hub / github.com/Snapchat/Valdi / TEST

Function TEST

valdi/test/runtime/AutoMalloc_tests.cpp:8–22  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6namespace ValdiTest {
7
8TEST(AutoMalloc, doesntAllocateWhenCapacityIsLargeEnough) {
9 AutoMalloc<uint32_t, 16> storage(8);
10
11 ASSERT_FALSE(storage.allocated());
12
13 ASSERT_TRUE(storage.data() != nullptr);
14
15 for (size_t i = 0; i < 8; i++) {
16 storage.data()[i] = 42;
17 }
18
19 for (size_t i = 0; i < 8; i++) {
20 ASSERT_EQ(static_cast<uint32_t>(42), storage.data()[i]);
21 }
22}
23
24TEST(AutoMalloc, allocatesWhenCapacityIsNotLargeEnough) {
25 AutoMalloc<uint32_t, 16> storage(32);

Callers

nothing calls this directly

Calls 3

allocatedMethod · 0.80
dataMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected