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
41 lines
1.0 KiB
C++
41 lines
1.0 KiB
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.
|
|
*/
|
|
|
|
// This is a GPU-backend specific test
|
|
#if SK_SUPPORT_GPU
|
|
|
|
#include "Test.h"
|
|
|
|
// If we aren't inheriting these as #defines from elsewhere,
|
|
// clang demands they be declared before we #include the template
|
|
// that relies on them.
|
|
static bool LT(const int& elem, int value) {
|
|
return elem < value;
|
|
}
|
|
static bool EQ(const int& elem, int value) {
|
|
return elem == value;
|
|
}
|
|
|
|
#include "GrTBSearch.h"
|
|
|
|
DEF_TEST(GrTBSearch, reporter) {
|
|
const int array[] = {
|
|
1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 22, 33, 44, 55, 66, 77, 88, 99
|
|
};
|
|
|
|
for (int n = 0; n < static_cast<int>(SK_ARRAY_COUNT(array)); ++n) {
|
|
for (int i = 0; i < n; i++) {
|
|
int index = GrTBSearch<int, int>(array, n, array[i]);
|
|
REPORTER_ASSERT(reporter, index == (int) i);
|
|
index = GrTBSearch<int, int>(array, n, -array[i]);
|
|
REPORTER_ASSERT(reporter, index < 0);
|
|
}
|
|
}
|
|
}
|
|
|
|
#endif
|