skia2/tests/VarAllocTest.cpp
smcgruer b83205a538 Fix build for UCLIBC platforms
malloc_usable_size does not exist in UCLIBC, so fall back to just
returning 0 for SkVarAlloc::heap_size().

BUG=skia:

Review URL: https://codereview.chromium.org/1006073003
2015-03-16 14:45:01 -07:00

14 lines
416 B
C++

#include "Test.h"
#include "SkVarAlloc.h"
DEF_TEST(VarAlloc, r) {
SkVarAlloc va(4/*start allocating at 16B*/);
char* p = va.alloc(128, SK_MALLOC_THROW);
sk_bzero(p, 128); // Just checking this is safe.
#if !defined(SK_BUILD_FOR_ANDROID) && !defined(__UCLIBC__)
// This method will always return 0 on Android and UCLIBC platforms.
REPORTER_ASSERT(r, va.approxBytesAllocated() >= 128);
#endif
}