TEST(TestMemoryAllocatorTest, SetCurrentNewArrayAllocator) { allocator = new TestMemoryAllocator("new array allocator for test"); setCurrentNewArrayAllocator(allocator); POINTERS_EQUAL(allocator, getCurrentNewArrayAllocator()); setCurrentNewArrayAllocatorToDefault(); POINTERS_EQUAL(defaultNewArrayAllocator(), getCurrentNewArrayAllocator()); }
TestMemoryAllocator* SimpleString::getStringAllocator() { if (stringAllocator_ == NULL) return defaultNewArrayAllocator(); return stringAllocator_; }
TEST(TestMemoryAllocatorTest, NewArrayNames) { STRCMP_EQUAL("Standard New [] Allocator", defaultNewArrayAllocator()->name()); STRCMP_EQUAL("new []", defaultNewArrayAllocator()->alloc_name()); STRCMP_EQUAL("delete []", defaultNewArrayAllocator()->free_name()); }
void setCurrentNewArrayAllocatorToDefault() { currentNewArrayAllocator = defaultNewArrayAllocator(); }
bool CodeMemoryReportFormatter::isNewAllocator(TestMemoryAllocator* allocator) { return PlatformSpecificStrCmp(allocator->alloc_name(), defaultNewAllocator()->alloc_name()) == 0 || PlatformSpecificStrCmp(allocator->alloc_name(), defaultNewArrayAllocator()->alloc_name()) == 0; }