skia2/tests/VarAllocTest.cpp
mtklein 0bd57b2e1e SkVarAlloc::approxBytesAllocated()
This is what I was getting at on the other CL.

BUG=skia:

Committed: https://skia.googlesource.com/skia/+/f27f1bcce50c8f95aea8469684a70b70c9baee09

CQ_EXTRA_TRYBOTS=client.skia.android:Test-Android-Nexus5-Adreno330-Arm7-Release-Trybot

Review URL: https://codereview.chromium.org/730193003
2014-11-18 09:32:36 -08:00

14 lines
335 B
C++

#include "Test.h"
#include "SkVarAlloc.h"
DEF_TEST(VarAlloc, r) {
SkVarAlloc va;
char* p = va.alloc(128, SK_MALLOC_THROW);
sk_bzero(p, 128); // Just checking this is safe.
#ifndef SK_BUILD_FOR_ANDROID
// This method will always return 0 on Android.
REPORTER_ASSERT(r, va.approxBytesAllocated() >= 128);
#endif
}