mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-07 22:44:49 +00:00
ICU-10549 collperf2 also test sorting & binary search
X-SVN-Rev: 34836
This commit is contained in:
parent
d72df4a157
commit
e38cc9f41b
3 changed files with 672 additions and 178 deletions
|
@ -1,10 +1,31 @@
|
|||
#!/usr/bin/perl
|
||||
# ********************************************************************
|
||||
# COPYRIGHT:
|
||||
# Copyright (c) 2013, International Business Machines Corporation and
|
||||
# Copyright (c) 2013-2014, International Business Machines Corporation and
|
||||
# others. All Rights Reserved.
|
||||
# ********************************************************************
|
||||
|
||||
# Variables need to be set in ../perldriver/Common.pl for where ICU is on your machine.
|
||||
# Copy Common.pl.template to Common.pl and modify it.
|
||||
#
|
||||
# Sample Common.pl "Settings by user" for a Linux out-of-source build:
|
||||
#
|
||||
# $ICULatestVersion = "collv2";
|
||||
# $ICUPreviousVersion = "52";
|
||||
#
|
||||
# $PerformanceDataPath = "/home/mscherer/svn.icudata/trunk/src/test/perf";
|
||||
#
|
||||
# $ICULatest = "/home/mscherer/svn.icu/collv2/bld";
|
||||
# $ICUPrevious = "/home/mscherer/svn.icu/trunk/bld";
|
||||
#
|
||||
# The first time around, you also need to
|
||||
# source/test/perf/collperf2$ mkdir ../results
|
||||
# Then invoke
|
||||
# source/test/perf/collperf2$ ./CollPerf2_r.pl
|
||||
#
|
||||
# Sample debug invocation:
|
||||
# ~/svn.icu/trunk/dbg/test/perf/collperf2$ LD_LIBRARY_PATH=../../../lib:../../../tools/ctestfw ./collperf2 -t 5 -p 1 -L "de" -f /home/mscherer/svn.icudata/trunk/src/test/perf/collation/TestNames_Latin.txt TestStringPieceSort
|
||||
|
||||
#use strict;
|
||||
|
||||
use lib '../perldriver';
|
||||
|
@ -18,7 +39,7 @@ my $options = {
|
|||
"headers"=>"ICU".$ICUPreviousVersion." ICU".$ICULatestVersion,
|
||||
"operationIs"=>"Collator",
|
||||
"passes"=>"1",
|
||||
"time"=>"5",
|
||||
"time"=>"2",
|
||||
#"outputType"=>"HTML",
|
||||
"dataDir"=>$CollationDataPath,
|
||||
"outputDir"=>"../results"
|
||||
|
@ -32,8 +53,8 @@ if ($OnWindows) {
|
|||
$p1 = "cd ".$ICUPrevious."/bin && ".$ICUPathPrevious."/collperf2/$WindowsPlatform/Release/collperf2.exe";
|
||||
$p2 = "cd ".$ICULatest."/bin && ".$ICUPathLatest."/collperf2/$WindowsPlatform/Release/collperf2.exe";
|
||||
} else {
|
||||
$p1 = "LD_LIBRARY_PATH=".$ICUPrevious."/source/lib:".$ICUPrevious."/source/tools/ctestfw ".$ICUPathPrevious."/collperf2/collperf2";
|
||||
$p2 = "LD_LIBRARY_PATH=".$ICULatest."/source/lib:".$ICULatest."/source/tools/ctestfw ".$ICUPathLatest."/collperf2/collperf2";
|
||||
$p1 = "LD_LIBRARY_PATH=".$ICUPrevious."/lib:".$ICUPrevious."/tools/ctestfw ".$ICUPrevious."/test/perf/collperf2/collperf2";
|
||||
$p2 = "LD_LIBRARY_PATH=".$ICULatest."/lib:".$ICULatest."/tools/ctestfw ".$ICULatest."/test/perf/collperf2/collperf2";
|
||||
}
|
||||
|
||||
my $tests = {
|
||||
|
@ -70,6 +91,14 @@ my $tests = {
|
|||
|
||||
"Collator::getCollationKey/len", ["$p1,TestCppGetCollationKey", "$p2,TestCppGetCollationKey"],
|
||||
"Collator::getCollationKey/null", ["$p1,TestCppGetCollationKeyNull", "$p2,TestCppGetCollationKeyNull"],
|
||||
|
||||
"sort UnicodeString*[]: compare()", ["$p1,TestUniStrSort", "$p2,TestUniStrSort"],
|
||||
"sort StringPiece[]: compareUTF8()", ["$p1,TestStringPieceSortCpp", "$p2,TestStringPieceSortCpp"],
|
||||
"sort StringPiece[]: ucol_strcollUTF8()", ["$p1,TestStringPieceSortC", "$p2,TestStringPieceSortC"],
|
||||
|
||||
"binary search UnicodeString*[]: compare()", ["$p1,TestUniStrBinSearch", "$p2,TestUniStrBinSearch"],
|
||||
"binary search StringPiece[]: compareUTF8()", ["$p1,TestStringPieceBinSearchCpp", "$p2,TestStringPieceBinSearchCpp"],
|
||||
"binary search StringPiece[]: ucol_strcollUTF8()", ["$p1,TestStringPieceBinSearchC", "$p2,TestStringPieceBinSearchC"],
|
||||
};
|
||||
|
||||
my $dataFiles = {
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
**********************************************************************
|
||||
* Copyright (c) 2002-2011, International Business Machines
|
||||
* Copyright (c) 2002-2014, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
**********************************************************************
|
||||
*/
|
||||
|
@ -22,7 +22,7 @@ typedef struct UOption UOption;
|
|||
#if !UCONFIG_NO_CONVERSION
|
||||
|
||||
U_NAMESPACE_USE
|
||||
// Use the TESTCASE macro in subclasses of IntlTest. Define the
|
||||
// Use the TESTCASE macro in subclasses of UPerfTest. Define the
|
||||
// runIndexedTest method in this fashion:
|
||||
//
|
||||
//| void MyTest::runIndexedTest(int32_t index, UBool exec,
|
||||
|
@ -32,29 +32,48 @@ U_NAMESPACE_USE
|
|||
//| TESTCASE(1,TestSomethingElse);
|
||||
//| TESTCASE(2,TestAnotherThing);
|
||||
//| default:
|
||||
//| name = "";
|
||||
//| return NULL;
|
||||
//| name = "";
|
||||
//| break;
|
||||
//| }
|
||||
//| return NULL;
|
||||
//| }
|
||||
#if 0
|
||||
#define TESTCASE(id,test) \
|
||||
case id: \
|
||||
name = #test; \
|
||||
if (exec) { \
|
||||
fprintf(stdout,#test "---"); \
|
||||
fprintf(stdout,"\n"); \
|
||||
return test(); \
|
||||
} \
|
||||
break
|
||||
|
||||
#endif
|
||||
#define TESTCASE(id,test) \
|
||||
case id: \
|
||||
name = #test; \
|
||||
if (exec) { \
|
||||
return test(); \
|
||||
} \
|
||||
break
|
||||
// More convenient macros. These allow easy reordering of the test cases.
|
||||
// Copied from intltest.h, and adjusted to not logln() but return a UPerfFunction.
|
||||
//
|
||||
//| void MyTest::runIndexedTest(int32_t index, UBool exec,
|
||||
//| const char* &name, char* /*par*/) {
|
||||
//| TESTCASE_AUTO_BEGIN;
|
||||
//| TESTCASE_AUTO(TestSomething);
|
||||
//| TESTCASE_AUTO(TestSomethingElse);
|
||||
//| TESTCASE_AUTO(TestAnotherThing);
|
||||
//| TESTCASE_AUTO_END;
|
||||
//| return NULL;
|
||||
//| }
|
||||
#define TESTCASE_AUTO_BEGIN \
|
||||
for(;;) { \
|
||||
int32_t testCaseAutoNumber = 0
|
||||
|
||||
#define TESTCASE_AUTO(test) \
|
||||
if (index == testCaseAutoNumber++) { \
|
||||
name = #test; \
|
||||
if (exec) { \
|
||||
return test(); \
|
||||
} \
|
||||
break; \
|
||||
}
|
||||
|
||||
#define TESTCASE_AUTO_END \
|
||||
name = ""; \
|
||||
break; \
|
||||
}
|
||||
|
||||
/**
|
||||
* Subclasses of PerfTest will need to create subclasses of
|
||||
|
|
Loading…
Add table
Reference in a new issue