Files
loongoffice/basic/qa/basic_coverage/test_datetime_methods.vb
Laurent Balland-Poirier 8a50ea5454 tdf#102872 Add qa unit test for BASIC methods
Add test if several methods still works

Change-Id: I8d26e5e3555dbbc0f07152138e1bc0cd65d90998
Reviewed-on: https://gerrit.libreoffice.org/30166
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: jan iversen <jani@documentfoundation.org>
Tested-by: jan iversen <jani@documentfoundation.org>
Reviewed-by: Laurent BP <laurent.balland-poirier@laposte.net>
2016-11-22 09:30:41 +00:00

78 lines
2.3 KiB
VB.net

'
' This file is part of the LibreOffice project.
'
' This Source Code Form is subject to the terms of the Mozilla Public
' License, v. 2.0. If a copy of the MPL was not distributed with this
' file, You can obtain one at http://mozilla.org/MPL/2.0/.
'
Function doUnitTest as Integer
dim aVector as Variant
aVector = Array( Date(), Time(), "Hello", -3.14)
' CDateFromUnoDate
' CDateTomUnoDate
' CDateFromUnoTime
' CDateToUnoTime
' CDateFromUnoDateTime
' CDateToUnoDateTime
' CDateFromIso CDateToIso
If ( CDateToIso( CDateFromIso("20161016") ) <> "20161016" ) Then
doUnitTest = 0
' DATE DATEDIFF DATEADD
Else If ( DateDiff( "d", aVector(0), DateAdd("d", 1, aVector(0)) ) <> 1 ) Then
doUnitTest = 0
' DATEPART DAY
Else If ( DatePart( "d", aVector(0) ) <> Day( aVector(0) ) ) Then
doUnitTest = 0
' DATESERIAL DATEVALUE
Else If ( DateSerial( 2016, 10, 16 ) <> DateValue("October 16, 2016") ) Then
doUnitTest = 0
' FormatDateTime
' HOUR
Else If ( Hour(aVector(1)) <> Hour(aVector(1)) ) Then
doUnitTest = 0
' MINUTE
Else If ( Minute(aVector(1)) <> Minute(aVector(1)) ) Then
doUnitTest = 0
' MONTH
Else If ( DatePart( "m", aVector(0) ) <> Month( aVector(0) ) ) Then
doUnitTest = 0
' MONTHNAME
'Else If ( CDate( MonthName(10)&" 16, 2016" ) <> DateSerial(2016, 10, 16) ) Then
' doUnitTest = 0
' NOW TIMEVALUE
Else If ( Now() < aVector(0) + TimeValue(aVector(1)) ) Then
doUnitTest = 0
' SECOND
Else If ( Second(aVector(1)) <> Second(aVector(1)) ) Then
doUnitTest = 0
' TIMER max value = 24*3600
Else If ( Timer() > 86400 ) Then
doUnitTest = 0
' TIMESERIAL TIMEVALUE
Else If ( TimeSerial(13,54,48) <> TImeValue("13:54:48") ) Then
doUnitTest = 0
' WEEKDAY WEEKDAYNAME
'Else If ( WeekdayName( Weekday(aVector(0) ) ) <> WeekDayName( DatePart( "w", aVector(0) ) ) ) Then
' doUnitTest = 0
' YEAR
Else If ( DatePart( "yyyy", aVector(0) ) <> Year( aVector(0) ) ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
'End If
'End If
End Function