Kaydet (Commit) 060c2b9b authored tarafından Laurent Balland-Poirier's avatar Laurent Balland-Poirier Kaydeden (comit) Miklos Vajna

QA Basic: split tests of methods in different files

Following resolution of "Missing TAN method" [1]
as discussed on dev list [2]
a large majority of methods are now tested
with (almost) one method per file

Missing methods:
- colors failed: RED, GREEN, BLUE
- file methods: DIR, CHDRIVE, EOF,...
- financial methods calling Calc functions: IPmt, IRR,...
- not totaly implemented methods (?): ROUND, WAITUNTIL...

[1] https://bugs.documentfoundation.org/show_bug.cgi?id=102872
[2] http://nabble.documentfoundation.org/QA-test-for-BASIC-functions-tt4202257.html

Change-Id: I2b2824b5b18a2cfbbee2bbc5369e9e2b9e5c930b
Reviewed-on: https://gerrit.libreoffice.org/32519Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
üst ff8f5e62
......@@ -6,51 +6,11 @@
'
Function doUnitTest as Integer
Randomize 42
' ABS
If (Abs(-3.5) <> 3.5) Then
doUnitTest = 0
ElseIf (Abs(3.5) <> 3.5) Then
doUnitTest = 0
' ATN
ElseIf (Atn(1) <> PI/4) Then
doUnitTest = 0
' COS SIN
ElseIf ( Abs(Cos(PI/3) - Sin(PI/6)) > 1E-6 ) Then
doUnitTest = 0
' EXP LOG
ElseIf ( Log( Exp(1) ) <> 1 ) Then
doUnitTest = 0
' FIX
ElseIf (Fix(PI) <> 3) Then
doUnitTest = 0
' FRAC
ElseIf ( 3+Frac(PI) <> PI) Then
doUnitTest = 0
' HEX
ElseIf ( Hex(100) <> "64") Then
doUnitTest = 0
' INT
ElseIf ( Int(PI) <> 3 ) Then
doUnitTest = 0
' OCT
ElseIf ( Oct(100) <> "144" ) Then
doUnitTest = 0
' ROUND
' ElseIf ( Round( PI, 2 ) <> 3.14 ) Then
' doUnitTest = 0
' RND
ElseIf ( Rnd >= 1 ) Then
doUnitTest = 0
' SGN
ElseIf ( Sgn(-3.14) <> -1 ) Then
doUnitTest = 0
' SQR
ElseIf ( Sqr( 4 ) <> 2 ) Then
doUnitTest = 0
' TAN
ElseIf ( Abs( Tan(PI/4) - 1 ) > 1E-6 ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
......
......@@ -9,23 +9,10 @@
Function doUnitTest as Integer
dim aVector as Variant
' ARRAY
aVector = Array( Date(), Time(), "Hello", -3.14)
If (aVector(2) <> "Hello") Then
aVector = Array( "Hello", -3.14)
If (aVector(0) <> "Hello") Then
doUnitTest = 0
' LBOUND
ElseIf ( LBound( aVector() ) <> 0 ) Then
doUnitTest = 0
' TYPELEN
ElseIf ( TypeLen(aVector(2)) <> 5 ) Then
doUnitTest = 0
' TYPENAME
ElseIf ( TypeName(aVector(2)) <> "String" ) Then
doUnitTest = 0
' UBOUND already tested
'ElseIf ( UBound( aVector() ) <> 3 ) Then
' doUnitTest = 0
' VARTYPE
ElseIf ( VarType(aVector(2)) <> 8 ) Then
ElseIf ( aVector(1) <> -3.14 ) Then
doUnitTest = 0
Else
doUnitTest = 1
......
' 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
' ASC
If (Asc("€a") <> 8364) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
' 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
' ATN (arc tan)
If (Atn(1) <> PI/4) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
' 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
' BEEP
Beep
doUnitTest = 1
End Function
......@@ -7,42 +7,9 @@
'
Function doUnitTest as Integer
Randomize 42
dim aVector as Variant
aVector = Array( Date(), Time(), "Hello", -3.14)
' CBOOL
If (CBool(3) <> True) Then
doUnitTest = 0
' CBYTE
ElseIf (CByte("3") <> 3) Then
doUnitTest = 0
' CCUR
ElseIf (CCur("100") <> 100) Then
doUnitTest = 0
' CDATE
ElseIf (CDate(100) <> 100) Then
doUnitTest = 0
' CDEC already tested
'ElseIf (CDec("100") <> 100) Then
' doUnitTest = 0
' CDBL
ElseIf (CDbl("100") <> 100) Then
doUnitTest = 0
' CINT
ElseIf (CInt("100") <> 100) Then
doUnitTest = 0
' CLNG already tested
'ElseIf (CLng("100") <> 100) Then
' doUnitTest = 0
' CSNG
ElseIf (CSng("100") <> 100) Then
doUnitTest = 0
' CSTR
ElseIf (CStr(100) <> "100") Then
doUnitTest = 0
' VAL
ElseIf ( Val("4") <> 4 ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
......
'
' 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
' CBYTE
If (CByte("3") <> 3) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
'
' 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
' CCUR
If (CCur("100") <> 100) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
'
' 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
' CDATE
If (CDate(100) <> 100) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
'
' 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
' CDateFromIso CDateToIso
If ( CDateToIso( CDateFromIso("20161016") ) <> "20161016" ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
'
' 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 aDate as Date
aDate = Date()
' CDateToUnoDate CDateFromUnoDate
If ( CDateFromUnoDate( CDateToUnoDate( aDate ) ) <> aDate ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
'
' 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 aDate as Date
aDate = Now()
' CDateToUnoDateTime CDateFromUnoDateTime
If ( CDateFromUnoDateTime( CDateToUnoDateTime( aDate ) ) <> aDate ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
'
' 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 aDate as Date
aDate = Time()
' CDateToUnoTime CDateFromUnoTime
If ( CDateFromUnoTime( CDateToUnoTime( aDate ) ) <> aDate ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
'
' 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
' CDBL
If (CDbl("100") <> 100) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
' 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
' CHDIR CURDIR
ChDir( CurDir )
doUnitTest = 1
End Function
......@@ -7,41 +7,9 @@
'
Function doUnitTest as Integer
dim aVector as Variant
aVector = Array( Date(), Time(), "Hello", -3.14)
' CHOOSE
If (Choose(2, 1, 100, 3) <> 100) Then
doUnitTest = 0
' FALSE TRUE
ElseIf (False = True) Then
doUnitTest = 0
' IIF
ElseIf ( IIF(True, 10, 12) <> 10 ) Then
doUnitTest = 0
' ISARRAY
ElseIf ( IsArray( aVector ) = False ) Then
doUnitTest = 0
' ISDATE
ElseIf ( IsDate( aVector(1) ) = False ) Then
doUnitTest = 0
' ISEMPTY
ElseIf ( IsEmpty( aVector(2) ) ) Then
doUnitTest = 0
' ISERROR
' ISMISSING
' ISNULL
ElseIf ( IsNull( aVector ) ) Then
doUnitTest = 0
' ISNUMERIC
ElseIf ( IsNumeric( aVector(3) ) = False ) Then
doUnitTest = 0
' IsUnoStruc
' SWITCH
ElseIf ( Switch( False, aVector(0),_
True, aVector(1),_
False, aVector(2),_
True, aVector(3) ) <> aVector(1) ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
......
'
' 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
' CINT
If (CInt("100") <> 100) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
'
' This file is part of the LibreOffice project.
'
' This Source Code Form is subject to the terms of the Mozilla Public
......@@ -7,20 +6,9 @@
'
Function doUnitTest as Integer
Wait(0)
Beep
'dim aDate as Variant
'aDate = Date()
'WaitUntil( aDate )
' CompatibilityMode
If (CompatibilityMode(True) <> True) Then
doUnitTest = 0
' ConvertFromUrl ConvertToUrl
ElseIf ( ConvertToUrl( ConvertFromUrl("") ) <> "") Then
doUnitTest = 0
' GetSolarVersion
ElseIf ( GetSolarVersion() < 50000) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
......
' 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
' ConvertFromUrl ConvertToUrl
If ( ConvertToUrl( ConvertFromUrl("") ) <> "") Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
' 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
' COS SIN
If ( Abs(Cos(PI/3) - Sin(PI/6)) > 1E-6 ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
'
' 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/.
'
Type address
Name1 As String
City As String
End Type
Function doUnitTest as Integer
' CREATEOBJECT
If ( IsObject( CreateObject("address") ) = False ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
' 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
' CreateUnoListener
Dim oListener
oListener = CreateUnoListener( "ContListener_","com.sun.star.container.XContainerListener" )
doUnitTest = 1
End Function
' 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
' CreateUnoService
Dim filepicker
filepicker = CreateUnoService("com.sun.star.ui.dialogs.FilePicker")
doUnitTest = 1
End Function
' 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
' CreateUnoStruct
Dim oStruct
oStruct = CreateUnoStruct( "com.sun.star.beans.Property" )
doUnitTest = 1
End Function
' 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
' CreateUnoValue
Dim oUnoValue as Variant
Dim aValue as Variant
aValue = Array ( 1, 1 )
oUnoValue = CreateUnoValue( "[]byte", aValue )
doUnitTest = 1
End Function
'
' 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
' CSNG
If (CSng("100") <> 100) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
'
' 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
' CSTR
If (CStr(100) <> "100") Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
'
' 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
' CVAR
If (CVar(100) <> 100) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
'
' 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
' CVERR
If (CVerr(100) <> 100) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
'
' 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 aDate as Date
aDate = Date()
' DATE DATEDIFF DATEADD
If ( DateDiff( "d", aDate, DateAdd("d", 1, aDate) ) <> 1 ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
'
' 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 aDate as Date
aDate = Date()
' DATEPART DAY
If ( DatePart( "d", aDate ) <> Day( aDate ) ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
'
' 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
ElseIf ( DateDiff( "d", aVector(0), DateAdd("d", 1, aVector(0)) ) <> 1 ) Then
doUnitTest = 0
' DATEPART DAY
ElseIf ( DatePart( "d", aVector(0) ) <> Day( aVector(0) ) ) Then
doUnitTest = 0
' DATESERIAL DATEVALUE already tested
'ElseIf ( DateSerial( 2016, 10, 16 ) <> DateValue("October 16, 2016") ) Then
' doUnitTest = 0
' FormatDateTime
' HOUR
ElseIf ( Hour(aVector(1)) <> Hour(aVector(1)) ) Then
doUnitTest = 0
' MINUTE
ElseIf ( Minute(aVector(1)) <> Minute(aVector(1)) ) Then
doUnitTest = 0
' MONTH
ElseIf ( DatePart( "m", aVector(0) ) <> Month( aVector(0) ) ) Then
doUnitTest = 0
' MONTHNAME
'ElseIf ( CDate( MonthName(10)&" 16, 2016" ) <> DateSerial(2016, 10, 16) ) Then
' doUnitTest = 0
' NOW TIMEVALUE
ElseIf ( Now() < aVector(0) + TimeValue(aVector(1)) ) Then
doUnitTest = 0
' SECOND
ElseIf ( Second(aVector(1)) <> Second(aVector(1)) ) Then
doUnitTest = 0
' TIMER max value = 24*3600
ElseIf ( Timer() > 86400 ) Then
doUnitTest = 0
' TIMESERIAL TIMEVALUE
ElseIf ( TimeSerial(13,54,48) <> TImeValue("13:54:48") ) Then
doUnitTest = 0
' WEEKDAY WEEKDAYNAME
'ElseIf ( WeekdayName( Weekday(aVector(0) ) ) <> WeekDayName( DatePart( "w", aVector(0) ) ) ) Then
' doUnitTest = 0
' YEAR
ElseIf ( DatePart( "yyyy", aVector(0) ) <> Year( aVector(0) ) ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
' 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 aValue as variant
aValue = DimArray( 1, 2, 4 )
aValue( 1, 2, 4 ) = 3
' DIMARRAY
If ( aValue( 1, 2, 4 ) <> 3 ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
' 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
' ENVIRON
Environ ("TMP")
doUnitTest = 1
End Function
' 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
' EqualUnoObjects
' Copy of objects -> same instance
oIntrospection = CreateUnoService( "com.sun.star.beans.Introspection" )
oIntro2 = oIntrospection
If ( EqualUnoObjects( oIntrospection, oIntro2 ) = False ) Then
doUnitTest = 0
Else
' Copy of structs as value -> new instance
Dim Struct1 as new com.sun.star.beans.Property
Struct2 = Struct1
If ( EqualUnoObjects( Struct1, Struct2 ) ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End If
End Function
' 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
' ERL
On Error GoTo ErrorHandler ' Set up error handler
Dim nVar As Integer
nVar = 0
nVar = 1/nVar
doUnitTest = 0
Exit Function
ErrorHandler:
If ( Erl <> 13 ) Then
doUnitTest = 0
Else
doUnitTest = 1
Endif
End Function
' 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
' ERR
On Error GoTo ErrorHandler ' Set up error handler
Dim nVar As Integer
nVar = 0
nVar = 1/nVar
doUnitTest = 0
Exit Function
ErrorHandler:
If ( Err <> 11 ) Then
doUnitTest = 0
Else
doUnitTest = 1
Endif
End Function
'
' 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
' FALSE TRUE
If (False = True) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
' 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
' FIX
If (Fix(PI) <> 3) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
' 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
' FRAC
If ( 3+Frac(PI) <> PI) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
' 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
' FREEFILE
If ( FreeFile < 0 ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
' 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
' FREELIBRARY
FreeLibrary("")
doUnitTest = 1
End Function
' 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
' GetDefaultContext
GetDefaultContext()
doUnitTest = 1
End Function
' 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
' GETDIALOGFACTORX
If ( GetDialogZoomFactorX(100) < 0 ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
' 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
' GETDIALOGFACTORY
If ( GetDialogZoomFactorY(100) < 0 ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
' 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
' GETGUITYPE
If ( GetGuiType = 0 ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
' 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
' GETGUIVERSION
If ( GetGuiVersion = 0 ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
' 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
' GETPATHSEPARATOR
If ( GetPathSeparator = "" ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
' 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
' GetProcessServiceManager
GetProcessServiceManager()
doUnitTest = 1
End Function
' 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
' GetSolarVersion
If ( GetSolarVersion() < 50000) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
' 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
' GETSYSTEMTICKS
If ( GetSystemTicks < 0 ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
' 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
' GETSYSTEMTYPE
If ( GetSystemType <> -1 ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
' 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
' HASUNOINTERFACES
dim aObject as Object
If ( HasUnoInterfaces( aObject, "com.sun.star.beans.XIntrospection" ) ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
' 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
' HEX
If ( Hex(100) <> "64") Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
'
' 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
' HOUR
If ( Hour(TimeSerial(12,30,41)) <> 12 ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
'
' 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
' IIF
If ( IIF(True, 10, 12) <> 10 ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
' 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 aString as Variant
aString = "Hello"
' InStr
If ( InStr( 1, aString, "l", 1) <> 3 ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
' 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
' INT
If ( Int(PI) <> 3 ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
'
' 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( 123, "Hello", -3.14)
' ISARRAY
If ( IsArray( aVector ) = False ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
'
' 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 aDate as Date
aDate = Date( )
' ISDATE
If ( IsDate( aDate ) = False ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
'
' 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 aVariant as Variant
aVariant = Date( )
' ISEMPTY
If ( IsEmpty( aVariant ) ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
'
' 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/.
'
Type MyType
tName as String
End Type
Function doUnitTest as Integer
dim aVariant as MyType
aVariant.tName = "A string"
' ISERROR
If ( IsError( aVariant ) ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
'
' 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 aVariant as Variant
aVariant = Null
' ISNULL
If ( IsNull( aVariant ) = False ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
'
' 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 aVariant as Variant
aVariant = 3
' ISNUMERIC
If ( IsNumeric( aVariant ) = False ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
'
' 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 aVariant as Object
' ISOBJECT
If ( IsObject( aVariant ) = False ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
'
' 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 aVariant as Object
' ISUNOSTRUCT
If ( IsUnoStruct( aVariant ) ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
' 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
' Join
Dim aStrings(2) as String
aStrings(0) = "Hello"
aStrings(1) = "world"
If ( Join( aStrings, " " ) <> "Hello world " ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
'
' 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
' ARRAY
aVector = Array( "Hello", -3.14)
' LBOUND
If ( LBound( aVector() ) <> 0 ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
' 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 aString as Variant
aString = "Hello"
' LCASE
If ( LCase( aString ) <> "hello" ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
' 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 aString as Variant
aString = "Hello"
' LEN
If ( Len( aString ) <> 5 ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
' 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 aString as Variant
aString = "Hello"
' LENB
If ( LenB( aString ) <> 5 ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
' 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
' EXP LOG
If ( Log( Exp(1) ) <> 1 ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
' 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 aString as Variant
aString = "Hello"
' LTRIM
If ( LTrim( " Hello" ) <> aString ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
'
' 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
' MINUTE
If ( Minute(TimeSerial(12,30,41)) <> 30 ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
'
' 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 aDate as Date
aDate = Date()
' MONTH
If ( DatePart( "m", aDate ) <> Month( aDate ) ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
'
' 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 aDate as Date
dim aTime as Date
aDate = Date()
aTime = Time()
' NOW TIMEVALUE
If ( Now() < aDate + TimeValue(aTime) ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
' 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
' OCT
If ( Oct(100) <> "144" ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
' 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
' QBCOLOR
If ( QBColor(7) <> 12632256 ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
' 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
Randomize 42
' RND
If ( Rnd >= 1 ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
' 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
' RESOLVEPATH
If ( ResolvePath( "" ) <> "" ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
' 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
' RGB
If ( RGB( 128, 50, 200 ) <> 8401608 ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
' 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 aString as Variant
aString = "Hello"
' RTRIM
If ( RTrim( "Hello " ) <> aString ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
'
' 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
' SECOND
If ( Second(TimeSerial(12,30,41)) <> 41 ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
' 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
' SGN
If ( Sgn(-3.14) <> -1 ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
' 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
' SPACE
If ( Space(3) <> " " ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
' 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
' SPC
If ( Spc(3) <> " " ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
' 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
' SPLIT
If ( Split( "Hello world" )(1) <> "world" ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
' 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
' SQR
If ( Sqr( 4 ) <> 2 ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
' 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 aString as Variant
aString = "Hello"
' STRCOMP
If ( StrComp( aString, "Hello" ) <> 0 ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
' 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
' STRING
If ( String( 3, "H" ) <> "HHH" ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
'
' 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 aString as Variant
aString = "Hello"
' ASC
If (Asc("€") <> 8364) Then
doUnitTest = 0
' ASCw
'ElseIf (AscW("€") <> 8364) Then
' doUnitTest = 0
' FORMAT already tested
' ElseIf (Format(PI, "0") <> "3") Then
' doUnitTest = 0
' InStr
ElseIf ( InStr( 1, aString, "l", 1) <> 3 ) Then
doUnitTest = 0
' InStrRev
'ElseIf ( InStrRev( aString, "l" ) <> 4 ) Then
' doUnitTest = 0
' LCASE
ElseIf ( LCase( aString ) <> "hello" ) Then
doUnitTest = 0
' LEFT already test
' ElseIf ( Left( aString, 2 ) <> "He" ) Then
' doUnitTest = 0
' LEN
ElseIf ( Len( aString ) <> 5 ) Then
doUnitTest = 0
' LENB
ElseIf ( LenB( aString ) <> 5 ) Then
doUnitTest = 0
' LTRIM
ElseIf ( LTrim( " Hello" ) <> aString ) Then
doUnitTest = 0
' MID already tested
' ElseIf ( Mid( aString, 2, 2 ) <> "el" ) Then
' doUnitTest = 0
' REPLACE already tested
' ElseIf ( Replace ( aString, "l", "jo", 1, 2 ) <> "Hejojoo" ) Then
' doUnitTest = 0
' RIGHT already tested
' ElseIf ( Right( aString, 2 ) <> "lo" ) Then
' doUnitTest = 0
' RTRIM
ElseIf ( RTrim( "Hello " ) <> aString ) Then
doUnitTest = 0
' SPACE
ElseIf ( Space(3) <> " " ) Then
doUnitTest = 0
' SPC
ElseIf ( Spc(3) <> " " ) Then
doUnitTest = 0
' SPLIT
ElseIf ( Split( "Hello world" )(1) <> "world" ) Then
doUnitTest = 0
' STR TRIM
ElseIf ( Trim( Str( 4 ) ) <> "4" ) Then
doUnitTest = 0
' STRCOMP
ElseIf ( StrComp( aString, "Hello" ) <> 0 ) Then
doUnitTest = 0
' StrConv
' STRING
ElseIf ( String( 3, "H" ) <> "HHH" ) Then
doUnitTest = 0
' STRREVERSE
'ElseIf ( StrReverse( aString ) <> "olleH" ) Then
' doUnitTest = 0
' TAB
ElseIf ( "Hello" & Tab(0) & "World" <> "HelloWorld" ) Then
doUnitTest = 0
' UCASE
ElseIf ( UCase( aString ) <> "HELLO" ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
' 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
' STR TRIM
If ( Trim( Str( 4 ) ) <> "4" ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
'
' 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 aVariant as Object
' SWITCH
If ( Switch( False, 10,_
True, 11,_
False, 12,_
True, 13 ) <> 11 ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
' 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
' TAB
If ( "Hello" & Tab(0) & "World" <> "HelloWorld" ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
' 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
' TAN
If ( Abs( Tan(PI/4) - 1 ) > 1E-6 ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
'
' 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
' TIMER max value = 24*3600
If ( Timer() > 86400 ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
'
' 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
' TIMESERIAL TIMEVALUE
If ( TimeSerial(13,54,48) <> TimeValue("13:54:48") ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
'
' 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
' TWIPSPERPIXELX
If ( TwipsPerPixelX < 0 ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
'
' 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
' TWIPSPERPIXELY
If ( TwipsPerPixelY < 0 ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
'
' 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
' TYPELEN
If ( TypeLen("Hello") <> 5 ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment