build fix
[LibreOffice.git] / basic / qa / basic_coverage / test_datetime_methods.vb
blob679e1297bac72a6bf12a632059d436b7ba99cd6a
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/.
9 Function doUnitTest as Integer
10 dim aVector as Variant
11 aVector = Array( Date(), Time(), "Hello", -3.14)
12 ' CDateFromUnoDate
13 ' CDateTomUnoDate
14 ' CDateFromUnoTime
15 ' CDateToUnoTime
16 ' CDateFromUnoDateTime
17 ' CDateToUnoDateTime
18 ' CDateFromIso CDateToIso
19 If ( CDateToIso( CDateFromIso("20161016") ) <> "20161016" ) Then
20 doUnitTest = 0
21 ' DATE DATEDIFF DATEADD
22 Else If ( DateDiff( "d", aVector(0), DateAdd("d", 1, aVector(0)) ) <> 1 ) Then
23 doUnitTest = 0
24 ' DATEPART DAY
25 Else If ( DatePart( "d", aVector(0) ) <> Day( aVector(0) ) ) Then
26 doUnitTest = 0
27 ' DATESERIAL DATEVALUE
28 Else If ( DateSerial( 2016, 10, 16 ) <> DateValue("October 16, 2016") ) Then
29 doUnitTest = 0
30 ' FormatDateTime
31 ' HOUR
32 Else If ( Hour(aVector(1)) <> Hour(aVector(1)) ) Then
33 doUnitTest = 0
34 ' MINUTE
35 Else If ( Minute(aVector(1)) <> Minute(aVector(1)) ) Then
36 doUnitTest = 0
37 ' MONTH
38 Else If ( DatePart( "m", aVector(0) ) <> Month( aVector(0) ) ) Then
39 doUnitTest = 0
40 ' MONTHNAME
41 'Else If ( CDate( MonthName(10)&" 16, 2016" ) <> DateSerial(2016, 10, 16) ) Then
42 ' doUnitTest = 0
43 ' NOW TIMEVALUE
44 Else If ( Now() < aVector(0) + TimeValue(aVector(1)) ) Then
45 doUnitTest = 0
46 ' SECOND
47 Else If ( Second(aVector(1)) <> Second(aVector(1)) ) Then
48 doUnitTest = 0
49 ' TIMER max value = 24*3600
50 Else If ( Timer() > 86400 ) Then
51 doUnitTest = 0
52 ' TIMESERIAL TIMEVALUE
53 Else If ( TimeSerial(13,54,48) <> TImeValue("13:54:48") ) Then
54 doUnitTest = 0
55 ' WEEKDAY WEEKDAYNAME
56 'Else If ( WeekdayName( Weekday(aVector(0) ) ) <> WeekDayName( DatePart( "w", aVector(0) ) ) ) Then
57 ' doUnitTest = 0
58 ' YEAR
59 Else If ( DatePart( "yyyy", aVector(0) ) <> Year( aVector(0) ) ) Then
60 doUnitTest = 0
61 Else
62 doUnitTest = 1
63 End If
64 End If
65 End If
66 End If
67 End If
68 End If
69 End If
70 End If
71 End If
72 End If
73 End If
74 End If
75 'End If
76 'End If
77 End Function