mtklein | 0bd57b2 | 2014-11-18 09:32:36 -0800 | [diff] [blame] | 1 | #include "Test.h" |
| 2 | #include "SkVarAlloc.h" |
| 3 | |
| 4 | DEF_TEST(VarAlloc, r) { |
mtklein | 59dba14 | 2014-12-12 08:41:23 -0800 | [diff] [blame] | 5 | SkVarAlloc va(4/*start allocating at 16B*/); |
mtklein | 0bd57b2 | 2014-11-18 09:32:36 -0800 | [diff] [blame] | 6 | char* p = va.alloc(128, SK_MALLOC_THROW); |
| 7 | sk_bzero(p, 128); // Just checking this is safe. |
| 8 | |
smcgruer | b83205a | 2015-03-16 14:45:00 -0700 | [diff] [blame] | 9 | #if !defined(SK_BUILD_FOR_ANDROID) && !defined(__UCLIBC__) |
| 10 | // This method will always return 0 on Android and UCLIBC platforms. |
mtklein | 0bd57b2 | 2014-11-18 09:32:36 -0800 | [diff] [blame] | 11 | REPORTER_ASSERT(r, va.approxBytesAllocated() >= 128); |
| 12 | #endif |
| 13 | } |