9ea53f93e7
That way when declaring a test with DEF_TEST() macro, you don't have to uniquify the test name because it might colide with the class it is being testing. For example, if you are testing SkBase64 and do: DEF_TEST(SkBase64, reporter) { } That will generate an error because the macro will declare a function named SkBase64 which colides with the type SkBase64. By adding Test to the function name we avoid this problem. Fixed the entries found with the following command line: $ git grep "Test, r" | grep DEF BUG=None TEST=make tests && out/Debug/tests R=mtklein@google.com Author: tfarina@chromium.org Review URL: https://codereview.chromium.org/345753007
30 lines
857 B
C++
30 lines
857 B
C++
/*
|
|
* Copyright 2014 Google Inc.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
|
|
#include "SkBase64.h"
|
|
|
|
#include "Test.h"
|
|
|
|
DEF_TEST(SkBase64, reporter) {
|
|
char all[256];
|
|
for (int index = 0; index < 256; ++index) {
|
|
all[index] = (signed char) (index + 1);
|
|
}
|
|
|
|
for (int offset = 0; offset < 6; ++offset) {
|
|
size_t length = 256 - offset;
|
|
size_t encodeLength = SkBase64::Encode(all + offset, length, NULL);
|
|
SkAutoTMalloc<char> src(encodeLength + 1);
|
|
SkBase64::Encode(all + offset, length, src.get());
|
|
src[encodeLength] = '\0';
|
|
SkBase64 tryMe;
|
|
tryMe.decode(src.get(), encodeLength);
|
|
REPORTER_ASSERT(reporter, (strcmp((const char*) (all + offset), tryMe.getData()) == 0));
|
|
delete[] tryMe.getData();
|
|
}
|
|
}
|