mtklein | 5a744b7 | 2015-09-14 11:11:17 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2015 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
mtklein | 0bd57b2 | 2014-11-18 09:32:36 -0800 | [diff] [blame] | 8 | #include "Test.h" |
| 9 | #include "SkVarAlloc.h" |
| 10 | |
| 11 | DEF_TEST(VarAlloc, r) { |
mtklein | 59dba14 | 2014-12-12 08:41:23 -0800 | [diff] [blame] | 12 | SkVarAlloc va(4/*start allocating at 16B*/); |
mtklein | 5a744b7 | 2015-09-14 11:11:17 -0700 | [diff] [blame] | 13 | char* p = va.alloc(128); |
mtklein | 0bd57b2 | 2014-11-18 09:32:36 -0800 | [diff] [blame] | 14 | sk_bzero(p, 128); // Just checking this is safe. |
| 15 | |
smcgruer | b83205a | 2015-03-16 14:45:00 -0700 | [diff] [blame] | 16 | #if !defined(SK_BUILD_FOR_ANDROID) && !defined(__UCLIBC__) |
| 17 | // This method will always return 0 on Android and UCLIBC platforms. |
mtklein | 0bd57b2 | 2014-11-18 09:32:36 -0800 | [diff] [blame] | 18 | REPORTER_ASSERT(r, va.approxBytesAllocated() >= 128); |
| 19 | #endif |
| 20 | } |