Index: tests/VarAllocTest.cpp |
diff --git a/tests/VarAllocTest.cpp b/tests/VarAllocTest.cpp |
new file mode 100644 |
index 0000000000000000000000000000000000000000..d6a288dccefbddb882ec6e50cde20c34d2b74e1c |
--- /dev/null |
+++ b/tests/VarAllocTest.cpp |
@@ -0,0 +1,13 @@ |
+#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 |
+} |