Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
| 2 * Copyright 2014 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 | |
| 8 #include "SkBase64.h" | |
| 9 | |
| 10 #include "Test.h" | |
| 11 | |
| 12 DEF_TEST(SkBase64Test, reporter) { | |
| 13 signed char all[256]; | |
|
mtklein
2014/01/30 02:33:02
While we're at it, there are a few things we can c
tfarina
2014/01/30 02:44:59
Done.
| |
| 14 for (int index = 0; index < 256; index++) | |
| 15 all[index] = (signed char) (index + 1); | |
|
mtklein
2014/01/30 02:33:02
Let's add {} around this.
tfarina
2014/01/30 02:44:59
Done.
| |
| 16 | |
| 17 for (int offset = 0; offset < 6; offset++) { | |
| 18 size_t length = 256 - offset; | |
| 19 size_t encodeLength = SkBase64::Encode(all + offset, length, NULL); | |
| 20 char* src = (char*)sk_malloc_throw(encodeLength + 1); | |
|
mtklein
2014/01/30 02:33:02
Can you make this guy an SkAutoMalloc or SkAutoTMa
tfarina
2014/01/30 02:44:59
Done.
| |
| 21 SkBase64::Encode(all + offset, length, src); | |
| 22 src[encodeLength] = '\0'; | |
| 23 SkBase64 tryMe; | |
| 24 tryMe.decode(src, encodeLength); | |
| 25 REPORTER_ASSERT(reporter, length == tryMe.length()); | |
| 26 REPORTER_ASSERT(reporter, (strcmp((const char*) (all + offset), tryMe.ge tData()) == 0)); | |
| 27 sk_free(src); | |
| 28 delete[] tryMe.getData(); | |
| 29 } | |
| 30 } | |
| OLD | NEW |