• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "include/private/SkTo.h"
9 #include "include/utils/SkBase64.h"
10 
11 #include "tests/Test.h"
12 
DEF_TEST(SkBase64,reporter)13 DEF_TEST(SkBase64, reporter) {
14     char all[256];
15     for (int index = 0; index < 255; ++index) {
16         all[index] = (signed char) (index + 1);
17     }
18     all[255] = 0;
19 
20     for (int offset = 0; offset < 6; ++offset) {
21         size_t length = 256 - offset;
22         size_t encodeLength = SkBase64::Encode(all + offset, length, nullptr);
23         SkAutoTMalloc<char> src(encodeLength + 1);
24         SkBase64::Encode(all + offset, length, src.get());
25         src[SkToInt(encodeLength)] = '\0';
26         SkBase64 tryMe;
27         tryMe.decode(src.get(), encodeLength);
28         REPORTER_ASSERT(reporter, (strcmp((const char*) (all + offset), tryMe.getData()) == 0));
29         delete[] tryMe.getData();
30     }
31 }
32