| 1 |
' |
| 2 |
' This file is part of the LibreOffice project. |
| 3 |
' |
| 4 |
' This Source Code Form is subject to the terms of the Mozilla Public |
| 5 |
' License, v. 2.0. If a copy of the MPL was not distributed with this |
| 6 |
' file, You can obtain one at http://mozilla.org/MPL/2.0/. |
| 7 |
' |
| 8 |
|
| 9 |
Function doUnitTest as String |
| 10 |
TestUtil.TestInit |
| 11 |
TestReplacePerformance() |
| 12 |
doUnitTest = TestUtil.GetResult() |
| 13 |
End Function |
| 14 |
|
| 15 |
Sub TestReplacePerformance() |
| 16 |
On Error GoTo errorHandler |
| 17 |
' Assume the normal case to be much faster than 60 s even on slow boxes, and the test string |
| 18 |
' is long enough to cause serious performance regressions make it perform much longer |
| 19 |
n = 10000000 |
| 20 |
s = Space(n) |
| 21 |
t = Now |
| 22 |
s = Replace(s, " ", "*", 1, -1, 1) |
| 23 |
t = Now - t |
| 24 |
TestUtil.Assert(t <= TimeSerial(0, 2, 0), "TestReplacePerformance", Format(t, """t = ""[s]"" s""")) |
| 25 |
Exit Sub |
| 26 |
errorHandler: |
| 27 |
TestUtil.ReportErrorHandler("TestReplacePerformance", Err, Error$, Erl) |
| 28 |
End Sub |