]> git.saurik.com Git - apple/icu.git/blobdiff - icuSources/test/perf/strsrchperf/strsrchperf.cpp
ICU-531.30.tar.gz
[apple/icu.git] / icuSources / test / perf / strsrchperf / strsrchperf.cpp
index 23d16d7de2a0a32184311e857f9d09b3d7b4c9d4..1c70316ba968b682ab429fccce7b5b47415ae584 100644 (file)
@@ -1,6 +1,6 @@
 /********************************************************************
  * COPYRIGHT:
- * Copyright (C) 2008-2009 IBM, Inc.   All Rights Reserved.
+ * Copyright (C) 2008-2012 IBM, Inc.   All Rights Reserved.
  *
  ********************************************************************/
 /** 
 StringSearchPerformanceTest::StringSearchPerformanceTest(int32_t argc, const char *argv[], UErrorCode &status)
 :UPerfTest(argc,argv,status){
     int32_t start, end;
-
-#ifdef TEST_BOYER_MOORE_SEARCH
-    bms = NULL;
-#else
     srch = NULL;
-#endif
-
     pttrn = NULL;
     if(status== U_ILLEGAL_ARGUMENT_ERROR || line_mode){
        fprintf(stderr,gUsageString, "strsrchperf");
@@ -65,17 +59,8 @@ StringSearchPerformanceTest::StringSearchPerformanceTest(int32_t argc, const cha
     pttrn = temp; /* store word in pttrn */
 #endif
     
-#ifdef TEST_BOYER_MOORE_SEARCH
-    UnicodeString patternString(pttrn, pttrnLen);
-    UCollator *coll = ucol_open(locale, &status);
-    CollData *data = CollData::open(coll, status);
-
-    targetString = new UnicodeString(src, srcLen);
-    bms = new BoyerMooreSearch(data, patternString, targetString, status);
-#else
     /* Create the StringSearch object to be use in performance test. */
     srch = usearch_open(pttrn, pttrnLen, src, srcLen, locale, NULL, &status);
-#endif
 
     if(U_FAILURE(status)){
         fprintf(stderr, "FAILED to create UPerfTest object. Error: %s\n", u_errorName(status));
@@ -85,23 +70,12 @@ StringSearchPerformanceTest::StringSearchPerformanceTest(int32_t argc, const cha
 }
 
 StringSearchPerformanceTest::~StringSearchPerformanceTest() {
-    CollData *data  = bms->getData();
-    UCollator *coll = data->getCollator();
-
-    delete bms;
-    delete targetString;
-    CollData::close(data);
-    ucol_close(coll);
-
     if (pttrn != NULL) {
         free(pttrn);
     }
-
-#ifndef TEST_BOYER_MOORE_SEARCH
     if (srch != NULL) {
         usearch_close(srch);
     }
-#endif
 }
 
 UPerfFunction* StringSearchPerformanceTest::runIndexedTest(int32_t index, UBool exec, const char *&name, char *par) {
@@ -117,20 +91,12 @@ UPerfFunction* StringSearchPerformanceTest::runIndexedTest(int32_t index, UBool
 }
 
 UPerfFunction* StringSearchPerformanceTest::Test_ICU_Forward_Search(){
-#ifdef TEST_BOYER_MOORE_SEARCH
-    StringSearchPerfFunction *func = new StringSearchPerfFunction(ICUForwardSearch, bms, src, srcLen, pttrn, pttrnLen);
-#else
     StringSearchPerfFunction* func = new StringSearchPerfFunction(ICUForwardSearch, srch, src, srcLen, pttrn, pttrnLen);
-#endif
     return func;
 }
 
 UPerfFunction* StringSearchPerformanceTest::Test_ICU_Backward_Search(){
-#ifdef TEST_BOYER_MOORE_SEARCH
-    StringSearchPerfFunction *func = new StringSearchPerfFunction(ICUBackwardSearch, bms, src, srcLen, pttrn, pttrnLen);
-#else
     StringSearchPerfFunction* func = new StringSearchPerfFunction(ICUBackwardSearch, srch, src, srcLen, pttrn, pttrnLen);
-#endif
     return func;
 }