Split GrUnitTests.cpp into two separate unit tests.

GrUnitTests is too generic. Instead we split this file between the two
APIs being tested there, GrTBSearch and GrBinHashKey.

BUG=None
TEST=tests -m GrTBSearchTest && tests -m GrBinHashKeyTest
R=brian@thesalomons.net, robertphillips@google.com

Review URL: https://codereview.chromium.org/150943002

git-svn-id: http://skia.googlecode.com/svn/trunk@13273 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tests/GrBinHashKeyTest.cpp b/tests/GrBinHashKeyTest.cpp
new file mode 100644
index 0000000..96b851f
--- /dev/null
+++ b/tests/GrBinHashKeyTest.cpp
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2010 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 "GrBinHashKey.h"
+
+#include "Test.h"
+
+DEF_TEST(GrBinHashKeyTest, reporter) {
+    const char* testStringA_ = "abcdABCD";
+    const char* testStringB_ = "abcdBBCD";
+    const uint32_t* testStringA = reinterpret_cast<const uint32_t*>(testStringA_);
+    const uint32_t* testStringB = reinterpret_cast<const uint32_t*>(testStringB_);
+    enum {
+        kDataLenUsedForKey = 8
+    };
+
+    GrBinHashKey<kDataLenUsedForKey> keyA;
+    keyA.setKeyData(testStringA);
+    // test copy constructor and comparison
+    GrBinHashKey<kDataLenUsedForKey> keyA2(keyA);
+    REPORTER_ASSERT(reporter, keyA == keyA2);
+    REPORTER_ASSERT(reporter, keyA.getHash() == keyA2.getHash());
+    // test re-init
+    keyA2.setKeyData(testStringA);
+    REPORTER_ASSERT(reporter, keyA == keyA2);
+    REPORTER_ASSERT(reporter, keyA.getHash() == keyA2.getHash());
+    // test sorting
+    GrBinHashKey<kDataLenUsedForKey> keyB;
+    keyB.setKeyData(testStringB);
+    REPORTER_ASSERT(reporter, keyA < keyB);
+    REPORTER_ASSERT(reporter, keyA.getHash() != keyB.getHash());
+}
+
+#endif
diff --git a/tests/GrTBSearchTest.cpp b/tests/GrTBSearchTest.cpp
new file mode 100644
index 0000000..70a24d3
--- /dev/null
+++ b/tests/GrTBSearchTest.cpp
@@ -0,0 +1,40 @@
+/*
+ * 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(GrTBSearchTest, 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
diff --git a/tests/GrUnitTests.cpp b/tests/GrUnitTests.cpp
deleted file mode 100644
index 4c605d6..0000000
--- a/tests/GrUnitTests.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-
-/*
- * Copyright 2010 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-#include "Test.h"
-
-// This is a GPU-backend specific test
-#if SK_SUPPORT_GPU
-#include "GrBinHashKey.h"
-#include "GrDrawTarget.h"
-#include "GrRedBlackTree.h"
-#include "SkMatrix.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(GrUnitTests_bsearch, 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>(GR_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);
-        }
-    }
-}
-
-DEF_TEST(GrUnitTests_binHashKey, reporter) {
-    const char* testStringA_ = "abcdABCD";
-    const char* testStringB_ = "abcdBBCD";
-    const uint32_t* testStringA = reinterpret_cast<const uint32_t*>(testStringA_);
-    const uint32_t* testStringB = reinterpret_cast<const uint32_t*>(testStringB_);
-    enum {
-        kDataLenUsedForKey = 8
-    };
-
-    GrBinHashKey<kDataLenUsedForKey> keyA;
-    keyA.setKeyData(testStringA);
-    // test copy constructor and comparison
-    GrBinHashKey<kDataLenUsedForKey> keyA2(keyA);
-    REPORTER_ASSERT(reporter, keyA == keyA2);
-    REPORTER_ASSERT(reporter, keyA.getHash() == keyA2.getHash());
-    // test re-init
-    keyA2.setKeyData(testStringA);
-    REPORTER_ASSERT(reporter, keyA == keyA2);
-    REPORTER_ASSERT(reporter, keyA.getHash() == keyA2.getHash());
-    // test sorting
-    GrBinHashKey<kDataLenUsedForKey> keyB;
-    keyB.setKeyData(testStringB);
-    REPORTER_ASSERT(reporter, keyA < keyB);
-    REPORTER_ASSERT(reporter, keyA.getHash() != keyB.getHash());
-}
-
-
-#endif