X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/33ccf3d1ecb0c52bf4a1323587af92d67a672eb7..32cdc45397d8c0a24735f84e1dcf83bba1980f2d:/tests/benchmarks/strings.cpp diff --git a/tests/benchmarks/strings.cpp b/tests/benchmarks/strings.cpp index f8219729a2..cc09a35418 100644 --- a/tests/benchmarks/strings.cpp +++ b/tests/benchmarks/strings.cpp @@ -48,7 +48,11 @@ const wxString& GetTestAsciiString() static wxString testString; if ( testString.empty() ) { - for ( long n = 0; n < Bench::GetNumericParameter(); n++ ) + long num = Bench::GetNumericParameter(); + if ( !num ) + num = 1; + + for ( long n = 0; n < num; n++ ) testString += wxString::FromAscii(asciistr); } @@ -277,6 +281,18 @@ BENCHMARK_FUNC(ReplaceAll) return str.Replace("x", "y") != 0; } +BENCHMARK_FUNC(ReplaceLonger) +{ + wxString str('x', ASCIISTR_LEN); + return str.Replace("x", "yy") != 0; +} + +BENCHMARK_FUNC(ReplaceShorter) +{ + wxString str('x', ASCIISTR_LEN); + return str.Replace("xx", "y") != 0; +} + // ---------------------------------------------------------------------------- // string buffers: wx[W]CharBuffer @@ -318,7 +334,11 @@ BENCHMARK_FUNC(ParseHTML) // this is going to make for some invalid HTML, of course, but it // doesn't really matter - for ( long n = 0; n < Bench::GetNumericParameter(); n++ ) + long num = Bench::GetNumericParameter(); + if ( !num ) + num = 1; + + for ( long n = 0; n < num; n++ ) html += html1; }