From 543cf9ba1accbeea3cf5ad4b6f283d8deff18b16 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 30 Jul 2008 15:25:19 +0000 Subject: [PATCH 1/1] added another Replace() test git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54851 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- tests/benchmarks/strings.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/tests/benchmarks/strings.cpp b/tests/benchmarks/strings.cpp index 321a860f4a..e8506c91f9 100644 --- a/tests/benchmarks/strings.cpp +++ b/tests/benchmarks/strings.cpp @@ -226,7 +226,7 @@ BENCHMARK_FUNC(ForStringRIter) // wxString::Replace() // ---------------------------------------------------------------------------- -const size_t REPLACE_STR_LEN = 1000; +const size_t REPLACE_STR_LEN = strlen(asciistr); BENCHMARK_FUNC(ReplaceLoop) { @@ -240,19 +240,21 @@ BENCHMARK_FUNC(ReplaceLoop) return str.length() != 0; } -BENCHMARK_FUNC(ReplaceMiss) +BENCHMARK_FUNC(ReplaceNone) { wxString str('x', REPLACE_STR_LEN); - str.Replace("a", "z"); + return str.Replace("a", "z") == 0; +} - return str.length() != 0; +BENCHMARK_FUNC(ReplaceSome) +{ + wxString str(asciistr); + return str.Replace("7", "8") != 0; } -BENCHMARK_FUNC(ReplaceHit) +BENCHMARK_FUNC(ReplaceAll) { wxString str('x', REPLACE_STR_LEN); - str.Replace("x", "y"); - - return str.length() != 0; + return str.Replace("x", "y") != 0; } -- 2.45.2