2 ' This file is part of the LibreOffice project.
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/.
12 Function doUnitTest() As String
15 doUnitTest
= TestUtil
.GetResult()
18 Sub verify_testDateDiff()
19 On Error GoTo errorHandler
21 TestUtil
.AssertEqual(DateDiff("yyyy", "22/11/2003", "22/11/2013"), 10, "DateDiff(""yyyy"", ""22/11/2003"", ""22/11/2013"")")
22 TestUtil
.AssertEqual(DateDiff("q", "22/11/2003", "22/11/2013"), 40, "DateDiff(""q"", ""22/11/2003"", ""22/11/2013"")")
23 TestUtil
.AssertEqual(DateDiff("m", "22/11/2003", "22/11/2013"), 120, "DateDiff(""m"", ""22/11/2003"", ""22/11/2013"")")
24 TestUtil
.AssertEqual(DateDiff("y", "22/11/2003", "22/11/2013"), 3653, "DateDiff(""y"", ""22/11/2003"", ""22/11/2013"")")
25 TestUtil
.AssertEqual(DateDiff("d", "22/11/2003", "22/11/2013"), 3653, "DateDiff(""d"", ""22/11/2003"", ""22/11/2013"")")
26 TestUtil
.AssertEqual(DateDiff("w", "22/11/2003", "22/11/2013"), 521, "DateDiff(""w"", ""22/11/2003"", ""22/11/2013"")")
27 TestUtil
.AssertEqual(DateDiff("ww", "22/11/2003", "22/11/2013"), 522, "DateDiff(""ww"", ""22/11/2003"", ""22/11/2013"")")
28 TestUtil
.AssertEqual(DateDiff("h", "22/11/2003", "22/11/2013"), 87672, "DateDiff(""h"", ""22/11/2003"", ""22/11/2013"")")
29 TestUtil
.AssertEqual(DateDiff("n", "22/11/2012", "22/11/2013"), 525600, "DateDiff(""n"", ""22/11/2012"", ""22/11/2013"")")
30 TestUtil
.AssertEqual(DateDiff("s", "22/10/2013", "22/11/2013"), 2678400, "DateDiff(""s"", ""22/10/2013"", ""22/11/2013"")")
31 TestUtil
.AssertEqual(DateDiff("d", "22/11/2003", "22/11/2013", vbFriday
), 3653, "DateDiff(""d"", ""22/11/2003"", ""22/11/2013"", vbFriday)")
32 TestUtil
.AssertEqual(DateDiff("d", "22/11/2003", "22/11/2013", vbMonday
), 3653, "DateDiff(""d"", ""22/11/2003"", ""22/11/2013"", vbMonday)")
33 TestUtil
.AssertEqual(DateDiff("d", "22/12/2003", "22/11/2013", vbSaturday
), 3623, "DateDiff(""d"", ""22/12/2003"", ""22/11/2013"", vbSaturday)")
34 TestUtil
.AssertEqual(DateDiff("d", "22/10/2003", "22/11/2013", vbSunday
), 3684, "DateDiff(""d"", ""22/10/2003"", ""22/11/2013"", vbSunday)")
35 TestUtil
.AssertEqual(DateDiff("d", "22/11/2003", "22/11/2013", vbThursday
), 3653, "DateDiff(""d"", ""22/11/2003"", ""22/11/2013"", vbThursday)")
36 TestUtil
.AssertEqual(DateDiff("d", "22/11/2003", "22/11/2013", vbTuesday
), 3653, "DateDiff(""d"", ""22/11/2003"", ""22/11/2013"", vbTuesday)")
37 TestUtil
.AssertEqual(DateDiff("d", "22/11/2003", "22/11/2013", vbFriday
, vbFirstJan1
), 3653, "DateDiff(""d"", ""22/11/2003"", ""22/11/2013"", vbFriday, vbFirstJan1)")
38 TestUtil
.AssertEqual(DateDiff("d", "22/11/2003", "22/11/2013", vbThursday
, vbFirstFourDays
), 3653, "DateDiff(""d"", ""22/11/2003"", ""22/11/2013"", vbThursday, vbFirstFourDays)")
39 TestUtil
.AssertEqual(DateDiff("d", "22/11/2003", "22/11/2013", vbSunday
, vbFirstFullWeek
), 3653, "DateDiff(""d"", ""22/11/2003"", ""22/11/2013"", vbSunday, vbFirstFullWeek)")
40 TestUtil
.AssertEqual(DateDiff("d", "22/11/2003", "22/11/2013", vbSaturday
, vbFirstFullWeek
), 3653, "DateDiff(""d"", ""22/11/2003"", ""22/11/2013"", vbSaturday, vbFirstFullWeek)")
44 TestUtil
.ReportErrorHandler("verify_testDateDiff", Err
, Error$, Erl
)