aboutsummaryrefslogtreecommitdiff
path: root/test/unit/bsearch_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/unit/bsearch_test.cpp')
-rw-r--r--test/unit/bsearch_test.cpp49
1 files changed, 0 insertions, 49 deletions
diff --git a/test/unit/bsearch_test.cpp b/test/unit/bsearch_test.cpp
deleted file mode 100644
index 27dcc02..0000000
--- a/test/unit/bsearch_test.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-#include <algorithm>
-
-#include "cppunit/cppunit_proxy.h"
-
-#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
-using namespace std;
-#endif
-
-//
-// TestCase class
-//
-class BsearchTest : public CPPUNIT_NS::TestCase
-{
- CPPUNIT_TEST_SUITE(BsearchTest);
- CPPUNIT_TEST(bsearch1);
- CPPUNIT_TEST(bsearch2);
- CPPUNIT_TEST_SUITE_END();
-
-protected:
- void bsearch1();
- void bsearch2();
- static bool str_compare(const char* a_, const char* b_);
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION(BsearchTest);
-
-//
-// tests implementation
-//
-void BsearchTest::bsearch1()
-{
- int vector[100];
- for(int i = 0; i < 100; i++)
- vector[i] = i;
- CPPUNIT_ASSERT(binary_search(vector, vector + 100, 42));
-}
-
-void BsearchTest::bsearch2()
-{
- char const* labels[] = { "aa", "dd", "ff", "jj", "ss", "zz" };
- const unsigned count = sizeof(labels) / sizeof(labels[0]);
- // DEC C++ generates incorrect template instatiation code
- // for "ff" so must cast
- CPPUNIT_ASSERT(binary_search(labels, labels + count, (const char *)"ff", str_compare));
-}
-bool BsearchTest::str_compare(const char* a_, const char* b_)
-{
- return strcmp(a_, b_) < 0 ? 1 : 0;
-}