Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Unified Diff: source/tools/ctestfw/unicode/uperf.h

Issue 845603002: Update ICU to 54.1 step 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/icu.git@master
Patch Set: remove unusued directories Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « source/tools/ctestfw/tstdtmod.cpp ('k') | source/tools/dumpce/Makefile.in » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: source/tools/ctestfw/unicode/uperf.h
diff --git a/source/tools/ctestfw/unicode/uperf.h b/source/tools/ctestfw/unicode/uperf.h
index a46ca2a740483896122abaa348f0e8d7d0918103..a5f7151ac78dc8abcbdc7674c08f5c60f611c0d5 100644
--- a/source/tools/ctestfw/unicode/uperf.h
+++ b/source/tools/ctestfw/unicode/uperf.h
@@ -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
« no previous file with comments | « source/tools/ctestfw/tstdtmod.cpp ('k') | source/tools/dumpce/Makefile.in » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698