2 * Copyright 2014 Google Inc.
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
8 // This is a GPU-backend specific test
13 // If we aren't inheriting these as #defines from elsewhere,
14 // clang demands they be declared before we #include the template
15 // that relies on them.
16 static bool LT(const int& elem, int value) {
19 static bool EQ(const int& elem, int value) {
23 #include "GrTBSearch.h"
25 DEF_TEST(GrTBSearch, reporter) {
27 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 22, 33, 44, 55, 66, 77, 88, 99
30 for (int n = 0; n < static_cast<int>(SK_ARRAY_COUNT(array)); ++n) {
31 for (int i = 0; i < n; i++) {
32 int index = GrTBSearch<int, int>(array, n, array[i]);
33 REPORTER_ASSERT(reporter, index == (int) i);
34 index = GrTBSearch<int, int>(array, n, -array[i]);
35 REPORTER_ASSERT(reporter, index < 0);