MCPcopy Create free account
hub / github.com/cpputest/cpputest / TEST

Function TEST

tests/CppUTest/MemoryLeakDetectorTest.cpp:132–145  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

130};
131
132TEST(MemoryLeakDetectorTest, OneLeak)
133{
134 char* mem = detector->allocMemory(testAllocator, 3);
135 detector->stopChecking();
136 SimpleString output = detector->report(mem_leak_period_checking);
137 STRCMP_CONTAINS("Memory leak(s) found", output.asCharString());
138 STRCMP_CONTAINS("size: 3", output.asCharString());
139 STRCMP_CONTAINS("alloc", output.asCharString());
140 STRCMP_CONTAINS(StringFromFormat("%p", (void*) mem).asCharString(), output.asCharString());
141 STRCMP_CONTAINS("Total number of leaks", output.asCharString());
142 PlatformSpecificFree(mem);
143 LONGS_EQUAL(1, testAllocator->alloc_called);
144 LONGS_EQUAL(0, testAllocator->free_called);
145}
146
147TEST(MemoryLeakDetectorTest, sequenceNumbersOfMemoryLeaks)
148{

Callers

nothing calls this directly

Calls 15

StringFromFormatFunction · 0.85
PlatformSpecificFreeFunction · 0.85
defaultNewAllocatorFunction · 0.85
defaultMallocAllocatorFunction · 0.85
defaultNewArrayAllocatorFunction · 0.85
SimpleStringClass · 0.85
allocMemoryMethod · 0.80
stopCheckingMethod · 0.80
asCharStringMethod · 0.80
containsMethod · 0.80
totalMemoryLeaksMethod · 0.80
deallocMemoryMethod · 0.80

Tested by

no test coverage detected