diff options
author | Laurent Balland-Poirier <laurent.balland-poirier@laposte.net> | 2016-12-30 21:10:26 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2017-01-06 09:35:44 +0000 |
commit | 060c2b9b1b0d3c9cf27f1b289a620cfa82b5b060 (patch) | |
tree | 8f33030aa9634f2c8741a37e1f7f2dd098650eca /basic/qa/basic_coverage | |
parent | ff8f5e6255ed7b627fb42ecd9e2222f18293218f (diff) |
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/32519
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'basic/qa/basic_coverage')
111 files changed, 1683 insertions, 348 deletions
diff --git a/basic/qa/basic_coverage/test_abs_method.vb b/basic/qa/basic_coverage/test_abs_method.vb new file mode 100644 index 000000000000..b79b9bcbb562 --- /dev/null +++ b/basic/qa/basic_coverage/test_abs_method.vb @@ -0,0 +1,17 @@ +' 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 + ' ABS + If (Abs(-3.5) <> 3.5) Then + doUnitTest = 0 + ElseIf (Abs(3.5) <> 3.5) Then + doUnitTest = 0 + Else + doUnitTest = 1 + End If +End Function diff --git a/basic/qa/basic_coverage/test_array_method.vb b/basic/qa/basic_coverage/test_array_method.vb new file mode 100644 index 000000000000..42f10a25ae8a --- /dev/null +++ b/basic/qa/basic_coverage/test_array_method.vb @@ -0,0 +1,20 @@ +' +' 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) + If (aVector(0) <> "Hello") Then + doUnitTest = 0 + ElseIf ( aVector(1) <> -3.14 ) Then + doUnitTest = 0 + Else + doUnitTest = 1 + End If +End Function diff --git a/basic/qa/basic_coverage/test_array_methods.vb b/basic/qa/basic_coverage/test_array_methods.vb deleted file mode 100644 index 53b2c8763286..000000000000 --- a/basic/qa/basic_coverage/test_array_methods.vb +++ /dev/null @@ -1,33 +0,0 @@ -' -' 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( Date(), Time(), "Hello", -3.14) - If (aVector(2) <> "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 - doUnitTest = 0 - Else - doUnitTest = 1 - End If -End Function diff --git a/basic/qa/basic_coverage/test_asc_method.vb b/basic/qa/basic_coverage/test_asc_method.vb new file mode 100644 index 000000000000..48b88933f9ac --- /dev/null +++ b/basic/qa/basic_coverage/test_asc_method.vb @@ -0,0 +1,15 @@ +' 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 diff --git a/basic/qa/basic_coverage/test_atn_method.vb b/basic/qa/basic_coverage/test_atn_method.vb new file mode 100644 index 000000000000..771714134fcc --- /dev/null +++ b/basic/qa/basic_coverage/test_atn_method.vb @@ -0,0 +1,15 @@ +' 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 diff --git a/basic/qa/basic_coverage/test_beep_method.vb b/basic/qa/basic_coverage/test_beep_method.vb new file mode 100644 index 000000000000..28eed61a6c1d --- /dev/null +++ b/basic/qa/basic_coverage/test_beep_method.vb @@ -0,0 +1,12 @@ +' 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 diff --git a/basic/qa/basic_coverage/test_cbool_method.vb b/basic/qa/basic_coverage/test_cbool_method.vb new file mode 100644 index 000000000000..d1d995f19db3 --- /dev/null +++ b/basic/qa/basic_coverage/test_cbool_method.vb @@ -0,0 +1,16 @@ +' +' 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 + ' CBOOL + If (CBool(3) <> True) Then + doUnitTest = 0 + Else + doUnitTest = 1 + End If +End Function diff --git a/basic/qa/basic_coverage/test_cbyte_method.vb b/basic/qa/basic_coverage/test_cbyte_method.vb new file mode 100644 index 000000000000..35bb1654c63e --- /dev/null +++ b/basic/qa/basic_coverage/test_cbyte_method.vb @@ -0,0 +1,16 @@ +' +' 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 diff --git a/basic/qa/basic_coverage/test_ccur_method.vb b/basic/qa/basic_coverage/test_ccur_method.vb new file mode 100644 index 000000000000..b84ddafd5713 --- /dev/null +++ b/basic/qa/basic_coverage/test_ccur_method.vb @@ -0,0 +1,16 @@ +' +' 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 diff --git a/basic/qa/basic_coverage/test_cdate_method.vb b/basic/qa/basic_coverage/test_cdate_method.vb new file mode 100644 index 000000000000..c26287b1f013 --- /dev/null +++ b/basic/qa/basic_coverage/test_cdate_method.vb @@ -0,0 +1,16 @@ +' +' 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 diff --git a/basic/qa/basic_coverage/test_cdatetofromiso_methods.vb b/basic/qa/basic_coverage/test_cdatetofromiso_methods.vb new file mode 100644 index 000000000000..02ec5853ccb4 --- /dev/null +++ b/basic/qa/basic_coverage/test_cdatetofromiso_methods.vb @@ -0,0 +1,16 @@ +' +' 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 diff --git a/basic/qa/basic_coverage/test_cdatetounodatecdatefromunodate_methods.vb b/basic/qa/basic_coverage/test_cdatetounodatecdatefromunodate_methods.vb new file mode 100644 index 000000000000..2aa735c54d17 --- /dev/null +++ b/basic/qa/basic_coverage/test_cdatetounodatecdatefromunodate_methods.vb @@ -0,0 +1,18 @@ +' +' 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 diff --git a/basic/qa/basic_coverage/test_cdatetounodatetimecdatefromunodatetime_methods.vb b/basic/qa/basic_coverage/test_cdatetounodatetimecdatefromunodatetime_methods.vb new file mode 100644 index 000000000000..9aa5680b1f8c --- /dev/null +++ b/basic/qa/basic_coverage/test_cdatetounodatetimecdatefromunodatetime_methods.vb @@ -0,0 +1,18 @@ +' +' 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 diff --git a/basic/qa/basic_coverage/test_cdatetounotimecdatefromunotime_methods.vb b/basic/qa/basic_coverage/test_cdatetounotimecdatefromunotime_methods.vb new file mode 100644 index 000000000000..38fd9da45f47 --- /dev/null +++ b/basic/qa/basic_coverage/test_cdatetounotimecdatefromunotime_methods.vb @@ -0,0 +1,18 @@ +' +' 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 diff --git a/basic/qa/basic_coverage/test_cdbl_method.vb b/basic/qa/basic_coverage/test_cdbl_method.vb new file mode 100644 index 000000000000..a0ba8f0298c8 --- /dev/null +++ b/basic/qa/basic_coverage/test_cdbl_method.vb @@ -0,0 +1,16 @@ +' +' 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 diff --git a/basic/qa/basic_coverage/test_chdircurdir_methods.vb b/basic/qa/basic_coverage/test_chdircurdir_methods.vb new file mode 100644 index 000000000000..dadd65b100e5 --- /dev/null +++ b/basic/qa/basic_coverage/test_chdircurdir_methods.vb @@ -0,0 +1,12 @@ +' 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 diff --git a/basic/qa/basic_coverage/test_choose_method.vb b/basic/qa/basic_coverage/test_choose_method.vb new file mode 100644 index 000000000000..6ab2aea80f09 --- /dev/null +++ b/basic/qa/basic_coverage/test_choose_method.vb @@ -0,0 +1,16 @@ +' +' 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 + ' CHOOSE + If (Choose(2, 1, 100, 3) <> 100) Then + doUnitTest = 0 + Else + doUnitTest = 1 + End If +End Function diff --git a/basic/qa/basic_coverage/test_cint_method.vb b/basic/qa/basic_coverage/test_cint_method.vb new file mode 100644 index 000000000000..b84af04d74fe --- /dev/null +++ b/basic/qa/basic_coverage/test_cint_method.vb @@ -0,0 +1,16 @@ +' +' 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 diff --git a/basic/qa/basic_coverage/test_system_methods.vb b/basic/qa/basic_coverage/test_compatibilitymode_method.vb index 02c6547e1e1c..599adb963f66 100644 --- a/basic/qa/basic_coverage/test_system_methods.vb +++ b/basic/qa/basic_coverage/test_compatibilitymode_method.vb @@ -1,4 +1,3 @@ -' ' 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 diff --git a/basic/qa/basic_coverage/test_conversion_methods.vb b/basic/qa/basic_coverage/test_conversion_methods.vb deleted file mode 100644 index 6d441e04bca4..000000000000 --- a/basic/qa/basic_coverage/test_conversion_methods.vb +++ /dev/null @@ -1,49 +0,0 @@ -' -' 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 - 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 -End Function diff --git a/basic/qa/basic_coverage/test_converttofromurl_methods.vb b/basic/qa/basic_coverage/test_converttofromurl_methods.vb new file mode 100644 index 000000000000..40c6494bd314 --- /dev/null +++ b/basic/qa/basic_coverage/test_converttofromurl_methods.vb @@ -0,0 +1,15 @@ +' 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 diff --git a/basic/qa/basic_coverage/test_cossin_methods.vb b/basic/qa/basic_coverage/test_cossin_methods.vb new file mode 100644 index 000000000000..c4a5cc5e537b --- /dev/null +++ b/basic/qa/basic_coverage/test_cossin_methods.vb @@ -0,0 +1,15 @@ +' 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 diff --git a/basic/qa/basic_coverage/test_createobject_method.vb b/basic/qa/basic_coverage/test_createobject_method.vb new file mode 100644 index 000000000000..6ae316b5795f --- /dev/null +++ b/basic/qa/basic_coverage/test_createobject_method.vb @@ -0,0 +1,21 @@ +' +' 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 diff --git a/basic/qa/basic_coverage/test_createunolistener_method.vb b/basic/qa/basic_coverage/test_createunolistener_method.vb new file mode 100644 index 000000000000..08c71fd8aaa0 --- /dev/null +++ b/basic/qa/basic_coverage/test_createunolistener_method.vb @@ -0,0 +1,13 @@ +' 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 diff --git a/basic/qa/basic_coverage/test_createunoservice_method.vb b/basic/qa/basic_coverage/test_createunoservice_method.vb new file mode 100644 index 000000000000..8fc043fd3e1d --- /dev/null +++ b/basic/qa/basic_coverage/test_createunoservice_method.vb @@ -0,0 +1,13 @@ +' 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 diff --git a/basic/qa/basic_coverage/test_createunostruct_method.vb b/basic/qa/basic_coverage/test_createunostruct_method.vb new file mode 100644 index 000000000000..f08368fed219 --- /dev/null +++ b/basic/qa/basic_coverage/test_createunostruct_method.vb @@ -0,0 +1,13 @@ +' 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 diff --git a/basic/qa/basic_coverage/test_createunovalue_method.vb b/basic/qa/basic_coverage/test_createunovalue_method.vb new file mode 100644 index 000000000000..e640354acba9 --- /dev/null +++ b/basic/qa/basic_coverage/test_createunovalue_method.vb @@ -0,0 +1,15 @@ +' 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 diff --git a/basic/qa/basic_coverage/test_csng_method.vb b/basic/qa/basic_coverage/test_csng_method.vb new file mode 100644 index 000000000000..87704ec1d431 --- /dev/null +++ b/basic/qa/basic_coverage/test_csng_method.vb @@ -0,0 +1,16 @@ +' +' 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 diff --git a/basic/qa/basic_coverage/test_cstr_method.vb b/basic/qa/basic_coverage/test_cstr_method.vb new file mode 100644 index 000000000000..53484b06fe17 --- /dev/null +++ b/basic/qa/basic_coverage/test_cstr_method.vb @@ -0,0 +1,16 @@ +' +' 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 diff --git a/basic/qa/basic_coverage/test_cvar_method.vb b/basic/qa/basic_coverage/test_cvar_method.vb new file mode 100644 index 000000000000..cc13bef6c8f9 --- /dev/null +++ b/basic/qa/basic_coverage/test_cvar_method.vb @@ -0,0 +1,16 @@ +' +' 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 diff --git a/basic/qa/basic_coverage/test_cverr_method.vb b/basic/qa/basic_coverage/test_cverr_method.vb new file mode 100644 index 000000000000..b1c3f8bec51c --- /dev/null +++ b/basic/qa/basic_coverage/test_cverr_method.vb @@ -0,0 +1,16 @@ +' +' 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 diff --git a/basic/qa/basic_coverage/test_datedateadddatediff_methods.vb b/basic/qa/basic_coverage/test_datedateadddatediff_methods.vb new file mode 100644 index 000000000000..4ba40f8ebe29 --- /dev/null +++ b/basic/qa/basic_coverage/test_datedateadddatediff_methods.vb @@ -0,0 +1,18 @@ +' +' 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 diff --git a/basic/qa/basic_coverage/test_datedatepartday_methods.vb b/basic/qa/basic_coverage/test_datedatepartday_methods.vb new file mode 100644 index 000000000000..04cc326f7d52 --- /dev/null +++ b/basic/qa/basic_coverage/test_datedatepartday_methods.vb @@ -0,0 +1,18 @@ +' +' 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 diff --git a/basic/qa/basic_coverage/test_datetime_methods.vb b/basic/qa/basic_coverage/test_datetime_methods.vb deleted file mode 100644 index 0ef990c1329b..000000000000 --- a/basic/qa/basic_coverage/test_datetime_methods.vb +++ /dev/null @@ -1,64 +0,0 @@ -' -' 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 diff --git a/basic/qa/basic_coverage/test_dimarray_method.vb b/basic/qa/basic_coverage/test_dimarray_method.vb new file mode 100644 index 000000000000..f92c7459dbe7 --- /dev/null +++ b/basic/qa/basic_coverage/test_dimarray_method.vb @@ -0,0 +1,18 @@ +' 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 diff --git a/basic/qa/basic_coverage/test_environ_method.vb b/basic/qa/basic_coverage/test_environ_method.vb new file mode 100644 index 000000000000..63b6f360aa61 --- /dev/null +++ b/basic/qa/basic_coverage/test_environ_method.vb @@ -0,0 +1,12 @@ +' 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 diff --git a/basic/qa/basic_coverage/test_equalunoobjects_method.vb b/basic/qa/basic_coverage/test_equalunoobjects_method.vb new file mode 100644 index 000000000000..b48111546cb3 --- /dev/null +++ b/basic/qa/basic_coverage/test_equalunoobjects_method.vb @@ -0,0 +1,25 @@ +' 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 diff --git a/basic/qa/basic_coverage/test_erl_method.vb b/basic/qa/basic_coverage/test_erl_method.vb new file mode 100644 index 000000000000..b541b15faf9f --- /dev/null +++ b/basic/qa/basic_coverage/test_erl_method.vb @@ -0,0 +1,22 @@ +' 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 diff --git a/basic/qa/basic_coverage/test_err_method.vb b/basic/qa/basic_coverage/test_err_method.vb new file mode 100644 index 000000000000..c21b417b4200 --- /dev/null +++ b/basic/qa/basic_coverage/test_err_method.vb @@ -0,0 +1,22 @@ +' 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 diff --git a/basic/qa/basic_coverage/test_falsetrue_method.vb b/basic/qa/basic_coverage/test_falsetrue_method.vb new file mode 100644 index 000000000000..f99b8032b4eb --- /dev/null +++ b/basic/qa/basic_coverage/test_falsetrue_method.vb @@ -0,0 +1,16 @@ +' +' 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 diff --git a/basic/qa/basic_coverage/test_fix_method.vb b/basic/qa/basic_coverage/test_fix_method.vb new file mode 100644 index 000000000000..91d2f01fc433 --- /dev/null +++ b/basic/qa/basic_coverage/test_fix_method.vb @@ -0,0 +1,15 @@ +' 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 diff --git a/basic/qa/basic_coverage/test_frac_method.vb b/basic/qa/basic_coverage/test_frac_method.vb new file mode 100644 index 000000000000..14d6863dbe40 --- /dev/null +++ b/basic/qa/basic_coverage/test_frac_method.vb @@ -0,0 +1,15 @@ +' 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 diff --git a/basic/qa/basic_coverage/test_freefile_method.vb b/basic/qa/basic_coverage/test_freefile_method.vb new file mode 100644 index 000000000000..d2a5cb93bae9 --- /dev/null +++ b/basic/qa/basic_coverage/test_freefile_method.vb @@ -0,0 +1,15 @@ +' 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 diff --git a/basic/qa/basic_coverage/test_freelibrary_method.vb b/basic/qa/basic_coverage/test_freelibrary_method.vb new file mode 100644 index 000000000000..4f6f9cd2d866 --- /dev/null +++ b/basic/qa/basic_coverage/test_freelibrary_method.vb @@ -0,0 +1,12 @@ +' 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 diff --git a/basic/qa/basic_coverage/test_getdefaultcontext_method.vb b/basic/qa/basic_coverage/test_getdefaultcontext_method.vb new file mode 100644 index 000000000000..8a90d6e96453 --- /dev/null +++ b/basic/qa/basic_coverage/test_getdefaultcontext_method.vb @@ -0,0 +1,12 @@ +' 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 diff --git a/basic/qa/basic_coverage/test_getdialogzoomfactorx_method.vb b/basic/qa/basic_coverage/test_getdialogzoomfactorx_method.vb new file mode 100644 index 000000000000..279fc005d731 --- /dev/null +++ b/basic/qa/basic_coverage/test_getdialogzoomfactorx_method.vb @@ -0,0 +1,15 @@ +' 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 diff --git a/basic/qa/basic_coverage/test_getdialogzoomfactory_method.vb b/basic/qa/basic_coverage/test_getdialogzoomfactory_method.vb new file mode 100644 index 000000000000..f4139bed591c --- /dev/null +++ b/basic/qa/basic_coverage/test_getdialogzoomfactory_method.vb @@ -0,0 +1,15 @@ +' 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 diff --git a/basic/qa/basic_coverage/test_getguitype_method.vb b/basic/qa/basic_coverage/test_getguitype_method.vb new file mode 100644 index 000000000000..c1606da10339 --- /dev/null +++ b/basic/qa/basic_coverage/test_getguitype_method.vb @@ -0,0 +1,15 @@ +' 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 diff --git a/basic/qa/basic_coverage/test_getguiversion_method.vb b/basic/qa/basic_coverage/test_getguiversion_method.vb new file mode 100644 index 000000000000..a70ff07e6d88 --- /dev/null +++ b/basic/qa/basic_coverage/test_getguiversion_method.vb @@ -0,0 +1,15 @@ +' 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 diff --git a/basic/qa/basic_coverage/test_getpathseparator_method.vb b/basic/qa/basic_coverage/test_getpathseparator_method.vb new file mode 100644 index 000000000000..63a7b6737b92 --- /dev/null +++ b/basic/qa/basic_coverage/test_getpathseparator_method.vb @@ -0,0 +1,15 @@ +' 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 diff --git a/basic/qa/basic_coverage/test_getprocessservicemanager_method.vb b/basic/qa/basic_coverage/test_getprocessservicemanager_method.vb new file mode 100644 index 000000000000..90e2012d698d --- /dev/null +++ b/basic/qa/basic_coverage/test_getprocessservicemanager_method.vb @@ -0,0 +1,12 @@ +' 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 diff --git a/basic/qa/basic_coverage/test_getsolarversion_method.vb b/basic/qa/basic_coverage/test_getsolarversion_method.vb new file mode 100644 index 000000000000..c2a75d11d44e --- /dev/null +++ b/basic/qa/basic_coverage/test_getsolarversion_method.vb @@ -0,0 +1,15 @@ +' 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 diff --git a/basic/qa/basic_coverage/test_getsystemticks_method.vb b/basic/qa/basic_coverage/test_getsystemticks_method.vb new file mode 100644 index 000000000000..878b38bf2f77 --- /dev/null +++ b/basic/qa/basic_coverage/test_getsystemticks_method.vb @@ -0,0 +1,15 @@ +' 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 diff --git a/basic/qa/basic_coverage/test_getsystemtype_method.vb b/basic/qa/basic_coverage/test_getsystemtype_method.vb new file mode 100644 index 000000000000..eced70204891 --- /dev/null +++ b/basic/qa/basic_coverage/test_getsystemtype_method.vb @@ -0,0 +1,15 @@ +' 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 diff --git a/basic/qa/basic_coverage/test_hasunointerfaces_method.vb b/basic/qa/basic_coverage/test_hasunointerfaces_method.vb new file mode 100644 index 000000000000..06472d847200 --- /dev/null +++ b/basic/qa/basic_coverage/test_hasunointerfaces_method.vb @@ -0,0 +1,16 @@ +' 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 diff --git a/basic/qa/basic_coverage/test_hex_method.vb b/basic/qa/basic_coverage/test_hex_method.vb new file mode 100644 index 000000000000..72edd9d8e573 --- /dev/null +++ b/basic/qa/basic_coverage/test_hex_method.vb @@ -0,0 +1,15 @@ +' 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 diff --git a/basic/qa/basic_coverage/test_hour_method.vb b/basic/qa/basic_coverage/test_hour_method.vb new file mode 100644 index 000000000000..e132775f8473 --- /dev/null +++ b/basic/qa/basic_coverage/test_hour_method.vb @@ -0,0 +1,16 @@ +' +' 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 diff --git a/basic/qa/basic_coverage/test_iif_method.vb b/basic/qa/basic_coverage/test_iif_method.vb new file mode 100644 index 000000000000..502cadcb35c1 --- /dev/null +++ b/basic/qa/basic_coverage/test_iif_method.vb @@ -0,0 +1,16 @@ +' +' 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 diff --git a/basic/qa/basic_coverage/test_instr_method.vb b/basic/qa/basic_coverage/test_instr_method.vb new file mode 100644 index 000000000000..716aa215878b --- /dev/null +++ b/basic/qa/basic_coverage/test_instr_method.vb @@ -0,0 +1,17 @@ +' 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 diff --git a/basic/qa/basic_coverage/test_int_method.vb b/basic/qa/basic_coverage/test_int_method.vb new file mode 100644 index 000000000000..69e811648d1d --- /dev/null +++ b/basic/qa/basic_coverage/test_int_method.vb @@ -0,0 +1,15 @@ +' 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 diff --git a/basic/qa/basic_coverage/test_isarray_method.vb b/basic/qa/basic_coverage/test_isarray_method.vb new file mode 100644 index 000000000000..9d73984b5f59 --- /dev/null +++ b/basic/qa/basic_coverage/test_isarray_method.vb @@ -0,0 +1,18 @@ +' +' 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 diff --git a/basic/qa/basic_coverage/test_isdate_method.vb b/basic/qa/basic_coverage/test_isdate_method.vb new file mode 100644 index 000000000000..5ce72f87b146 --- /dev/null +++ b/basic/qa/basic_coverage/test_isdate_method.vb @@ -0,0 +1,18 @@ +' +' 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 diff --git a/basic/qa/basic_coverage/test_isempty_method.vb b/basic/qa/basic_coverage/test_isempty_method.vb new file mode 100644 index 000000000000..6ca2fae6d498 --- /dev/null +++ b/basic/qa/basic_coverage/test_isempty_method.vb @@ -0,0 +1,18 @@ +' +' 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 diff --git a/basic/qa/basic_coverage/test_iserror_method.vb b/basic/qa/basic_coverage/test_iserror_method.vb new file mode 100644 index 000000000000..fb12abe6a257 --- /dev/null +++ b/basic/qa/basic_coverage/test_iserror_method.vb @@ -0,0 +1,22 @@ +' +' 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 diff --git a/basic/qa/basic_coverage/test_isnull_method.vb b/basic/qa/basic_coverage/test_isnull_method.vb new file mode 100644 index 000000000000..0d9044d8f0d4 --- /dev/null +++ b/basic/qa/basic_coverage/test_isnull_method.vb @@ -0,0 +1,18 @@ +' +' 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 diff --git a/basic/qa/basic_coverage/test_isnumeric_method.vb b/basic/qa/basic_coverage/test_isnumeric_method.vb new file mode 100644 index 000000000000..d3b614f564bd --- /dev/null +++ b/basic/qa/basic_coverage/test_isnumeric_method.vb @@ -0,0 +1,18 @@ +' +' 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 diff --git a/basic/qa/basic_coverage/test_isobject_method.vb b/basic/qa/basic_coverage/test_isobject_method.vb new file mode 100644 index 000000000000..bb5e270b3dfb --- /dev/null +++ b/basic/qa/basic_coverage/test_isobject_method.vb @@ -0,0 +1,17 @@ +' +' 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 diff --git a/basic/qa/basic_coverage/test_isunostruct_method.vb b/basic/qa/basic_coverage/test_isunostruct_method.vb new file mode 100644 index 000000000000..ac45f1961f7e --- /dev/null +++ b/basic/qa/basic_coverage/test_isunostruct_method.vb @@ -0,0 +1,17 @@ +' +' 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 diff --git a/basic/qa/basic_coverage/test_join_method.vb b/basic/qa/basic_coverage/test_join_method.vb new file mode 100644 index 000000000000..236062516826 --- /dev/null +++ b/basic/qa/basic_coverage/test_join_method.vb @@ -0,0 +1,18 @@ +' 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 diff --git a/basic/qa/basic_coverage/test_lbound_method.vb b/basic/qa/basic_coverage/test_lbound_method.vb new file mode 100644 index 000000000000..b7a91fd3f106 --- /dev/null +++ b/basic/qa/basic_coverage/test_lbound_method.vb @@ -0,0 +1,19 @@ +' +' 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 diff --git a/basic/qa/basic_coverage/test_lcase_method.vb b/basic/qa/basic_coverage/test_lcase_method.vb new file mode 100644 index 000000000000..65df764ef6d5 --- /dev/null +++ b/basic/qa/basic_coverage/test_lcase_method.vb @@ -0,0 +1,17 @@ +' 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 diff --git a/basic/qa/basic_coverage/test_len_method.vb b/basic/qa/basic_coverage/test_len_method.vb new file mode 100644 index 000000000000..0a7e1abf2ceb --- /dev/null +++ b/basic/qa/basic_coverage/test_len_method.vb @@ -0,0 +1,17 @@ +' 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 diff --git a/basic/qa/basic_coverage/test_lenb_method.vb b/basic/qa/basic_coverage/test_lenb_method.vb new file mode 100644 index 000000000000..550b8313afec --- /dev/null +++ b/basic/qa/basic_coverage/test_lenb_method.vb @@ -0,0 +1,17 @@ +' 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 diff --git a/basic/qa/basic_coverage/test_logexp_methods.vb b/basic/qa/basic_coverage/test_logexp_methods.vb new file mode 100644 index 000000000000..00db9983754a --- /dev/null +++ b/basic/qa/basic_coverage/test_logexp_methods.vb @@ -0,0 +1,15 @@ +' 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 diff --git a/basic/qa/basic_coverage/test_logic_methods.vb b/basic/qa/basic_coverage/test_logic_methods.vb deleted file mode 100644 index dbec2cefe893..000000000000 --- a/basic/qa/basic_coverage/test_logic_methods.vb +++ /dev/null @@ -1,48 +0,0 @@ -' -' 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) - ' 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 -End Function diff --git a/basic/qa/basic_coverage/test_ltrim_method.vb b/basic/qa/basic_coverage/test_ltrim_method.vb new file mode 100644 index 000000000000..562193c8b036 --- /dev/null +++ b/basic/qa/basic_coverage/test_ltrim_method.vb @@ -0,0 +1,17 @@ +' 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 diff --git a/basic/qa/basic_coverage/test_math_methods.vb b/basic/qa/basic_coverage/test_math_methods.vb deleted file mode 100644 index 27477a73f6e5..000000000000 --- a/basic/qa/basic_coverage/test_math_methods.vb +++ /dev/null @@ -1,57 +0,0 @@ -' 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 - ' 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 -End Function diff --git a/basic/qa/basic_coverage/test_minute_method.vb b/basic/qa/basic_coverage/test_minute_method.vb new file mode 100644 index 000000000000..0f1230462242 --- /dev/null +++ b/basic/qa/basic_coverage/test_minute_method.vb @@ -0,0 +1,16 @@ +' +' 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 diff --git a/basic/qa/basic_coverage/test_month_method.vb b/basic/qa/basic_coverage/test_month_method.vb new file mode 100644 index 000000000000..38d8ae4062a2 --- /dev/null +++ b/basic/qa/basic_coverage/test_month_method.vb @@ -0,0 +1,18 @@ +' +' 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 diff --git a/basic/qa/basic_coverage/test_nowtimevalue_methods.vb b/basic/qa/basic_coverage/test_nowtimevalue_methods.vb new file mode 100644 index 000000000000..42dce2fc66fb --- /dev/null +++ b/basic/qa/basic_coverage/test_nowtimevalue_methods.vb @@ -0,0 +1,20 @@ +' +' 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 diff --git a/basic/qa/basic_coverage/test_oct_method.vb b/basic/qa/basic_coverage/test_oct_method.vb new file mode 100644 index 000000000000..4c610539de3e --- /dev/null +++ b/basic/qa/basic_coverage/test_oct_method.vb @@ -0,0 +1,15 @@ +' 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 diff --git a/basic/qa/basic_coverage/test_qbcolor_method.vb b/basic/qa/basic_coverage/test_qbcolor_method.vb new file mode 100644 index 000000000000..8051a80b64a7 --- /dev/null +++ b/basic/qa/basic_coverage/test_qbcolor_method.vb @@ -0,0 +1,15 @@ +' 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 diff --git a/basic/qa/basic_coverage/test_random_methods.vb b/basic/qa/basic_coverage/test_random_methods.vb new file mode 100644 index 000000000000..ea5d1c9797e1 --- /dev/null +++ b/basic/qa/basic_coverage/test_random_methods.vb @@ -0,0 +1,16 @@ +' 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 diff --git a/basic/qa/basic_coverage/test_resolvepath_method.vb b/basic/qa/basic_coverage/test_resolvepath_method.vb new file mode 100644 index 000000000000..888a29dfbc13 --- /dev/null +++ b/basic/qa/basic_coverage/test_resolvepath_method.vb @@ -0,0 +1,15 @@ +' 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 diff --git a/basic/qa/basic_coverage/test_rgb_method.vb b/basic/qa/basic_coverage/test_rgb_method.vb new file mode 100644 index 000000000000..7bdaf9660138 --- /dev/null +++ b/basic/qa/basic_coverage/test_rgb_method.vb @@ -0,0 +1,15 @@ +' 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 diff --git a/basic/qa/basic_coverage/test_rtrim_method.vb b/basic/qa/basic_coverage/test_rtrim_method.vb new file mode 100644 index 000000000000..79a8093fe20d --- /dev/null +++ b/basic/qa/basic_coverage/test_rtrim_method.vb @@ -0,0 +1,17 @@ +' 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 diff --git a/basic/qa/basic_coverage/test_second_method.vb b/basic/qa/basic_coverage/test_second_method.vb new file mode 100644 index 000000000000..77311e9d3ccf --- /dev/null +++ b/basic/qa/basic_coverage/test_second_method.vb @@ -0,0 +1,16 @@ +' +' 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 diff --git a/basic/qa/basic_coverage/test_sgn_method.vb b/basic/qa/basic_coverage/test_sgn_method.vb new file mode 100644 index 000000000000..da2cf6757ba2 --- /dev/null +++ b/basic/qa/basic_coverage/test_sgn_method.vb @@ -0,0 +1,15 @@ +' 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 diff --git a/basic/qa/basic_coverage/test_space_method.vb b/basic/qa/basic_coverage/test_space_method.vb new file mode 100644 index 000000000000..8b35b108b504 --- /dev/null +++ b/basic/qa/basic_coverage/test_space_method.vb @@ -0,0 +1,15 @@ +' 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 diff --git a/basic/qa/basic_coverage/test_spc_method.vb b/basic/qa/basic_coverage/test_spc_method.vb new file mode 100644 index 000000000000..7ed291e13e71 --- /dev/null +++ b/basic/qa/basic_coverage/test_spc_method.vb @@ -0,0 +1,15 @@ +' 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 diff --git a/basic/qa/basic_coverage/test_split_method.vb b/basic/qa/basic_coverage/test_split_method.vb new file mode 100644 index 000000000000..d09e8c3e7e3b --- /dev/null +++ b/basic/qa/basic_coverage/test_split_method.vb @@ -0,0 +1,15 @@ +' 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 diff --git a/basic/qa/basic_coverage/test_sqr_method.vb b/basic/qa/basic_coverage/test_sqr_method.vb new file mode 100644 index 000000000000..55db95403030 --- /dev/null +++ b/basic/qa/basic_coverage/test_sqr_method.vb @@ -0,0 +1,15 @@ +' 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 diff --git a/basic/qa/basic_coverage/test_strcomp_method.vb b/basic/qa/basic_coverage/test_strcomp_method.vb new file mode 100644 index 000000000000..aeb146e572d3 --- /dev/null +++ b/basic/qa/basic_coverage/test_strcomp_method.vb @@ -0,0 +1,17 @@ +' 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 diff --git a/basic/qa/basic_coverage/test_string_method.vb b/basic/qa/basic_coverage/test_string_method.vb new file mode 100644 index 000000000000..8664ac0111f9 --- /dev/null +++ b/basic/qa/basic_coverage/test_string_method.vb @@ -0,0 +1,15 @@ +' 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 diff --git a/basic/qa/basic_coverage/test_string_methods.vb b/basic/qa/basic_coverage/test_string_methods.vb deleted file mode 100644 index deac1cf0b319..000000000000 --- a/basic/qa/basic_coverage/test_string_methods.vb +++ /dev/null @@ -1,85 +0,0 @@ -' -' 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 diff --git a/basic/qa/basic_coverage/test_strtrim_methods.vb b/basic/qa/basic_coverage/test_strtrim_methods.vb new file mode 100644 index 000000000000..b9da11d7fa1d --- /dev/null +++ b/basic/qa/basic_coverage/test_strtrim_methods.vb @@ -0,0 +1,15 @@ +' 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 diff --git a/basic/qa/basic_coverage/test_switch_method.vb b/basic/qa/basic_coverage/test_switch_method.vb new file mode 100644 index 000000000000..9dc00fa525e8 --- /dev/null +++ b/basic/qa/basic_coverage/test_switch_method.vb @@ -0,0 +1,20 @@ +' +' 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 diff --git a/basic/qa/basic_coverage/test_tab_method.vb b/basic/qa/basic_coverage/test_tab_method.vb new file mode 100644 index 000000000000..a5e4e9815197 --- /dev/null +++ b/basic/qa/basic_coverage/test_tab_method.vb @@ -0,0 +1,15 @@ +' 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 diff --git a/basic/qa/basic_coverage/test_tan_method.vb b/basic/qa/basic_coverage/test_tan_method.vb new file mode 100644 index 000000000000..117d2824bcd6 --- /dev/null +++ b/basic/qa/basic_coverage/test_tan_method.vb @@ -0,0 +1,15 @@ +' 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 diff --git a/basic/qa/basic_coverage/test_timer_method.vb b/basic/qa/basic_coverage/test_timer_method.vb new file mode 100644 index 000000000000..3ccb120f6284 --- /dev/null +++ b/basic/qa/basic_coverage/test_timer_method.vb @@ -0,0 +1,16 @@ +' +' 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 diff --git a/basic/qa/basic_coverage/test_timeserialtimevalue_methods.vb b/basic/qa/basic_coverage/test_timeserialtimevalue_methods.vb new file mode 100644 index 000000000000..6e84329d041b --- /dev/null +++ b/basic/qa/basic_coverage/test_timeserialtimevalue_methods.vb @@ -0,0 +1,16 @@ +' +' 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 diff --git a/basic/qa/basic_coverage/test_twipsperpixelx_method.vb b/basic/qa/basic_coverage/test_twipsperpixelx_method.vb new file mode 100644 index 000000000000..2b8890ad715c --- /dev/null +++ b/basic/qa/basic_coverage/test_twipsperpixelx_method.vb @@ -0,0 +1,16 @@ +' +' 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 diff --git a/basic/qa/basic_coverage/test_twipsperpixely_method.vb b/basic/qa/basic_coverage/test_twipsperpixely_method.vb new file mode 100644 index 000000000000..efc41e1ffc81 --- /dev/null +++ b/basic/qa/basic_coverage/test_twipsperpixely_method.vb @@ -0,0 +1,16 @@ +' +' 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 diff --git a/basic/qa/basic_coverage/test_typelen_method.vb b/basic/qa/basic_coverage/test_typelen_method.vb new file mode 100644 index 000000000000..4684790078c5 --- /dev/null +++ b/basic/qa/basic_coverage/test_typelen_method.vb @@ -0,0 +1,16 @@ +' +' 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 diff --git a/basic/qa/basic_coverage/test_typename_method.vb b/basic/qa/basic_coverage/test_typename_method.vb new file mode 100644 index 000000000000..eba2d86c404b --- /dev/null +++ b/basic/qa/basic_coverage/test_typename_method.vb @@ -0,0 +1,16 @@ +' +' 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 + ' TYPENAME + If ( TypeName("Hello") <> "String" ) Then + doUnitTest = 0 + Else + doUnitTest = 1 + End If +End Function diff --git a/basic/qa/basic_coverage/test_ucase_method.vb b/basic/qa/basic_coverage/test_ucase_method.vb new file mode 100644 index 000000000000..940c0897b0cd --- /dev/null +++ b/basic/qa/basic_coverage/test_ucase_method.vb @@ -0,0 +1,17 @@ +' 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" + ' UCASE + If ( UCase( aString ) <> "HELLO" ) Then + doUnitTest = 0 + Else + doUnitTest = 1 + End If +End Function diff --git a/basic/qa/basic_coverage/test_val_method.vb b/basic/qa/basic_coverage/test_val_method.vb new file mode 100644 index 000000000000..c25610cebd92 --- /dev/null +++ b/basic/qa/basic_coverage/test_val_method.vb @@ -0,0 +1,16 @@ +' +' 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 + ' VAL + If ( Val("4") <> 4 ) Then + doUnitTest = 0 + Else + doUnitTest = 1 + End If +End Function diff --git a/basic/qa/basic_coverage/test_vartype_method.vb b/basic/qa/basic_coverage/test_vartype_method.vb new file mode 100644 index 000000000000..bd45adef00df --- /dev/null +++ b/basic/qa/basic_coverage/test_vartype_method.vb @@ -0,0 +1,16 @@ +' +' 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 + ' VARTYPE + If ( VarType("Hello") <> 8 ) Then + doUnitTest = 0 + Else + doUnitTest = 1 + End If +End Function diff --git a/basic/qa/basic_coverage/test_wait_method.vb b/basic/qa/basic_coverage/test_wait_method.vb new file mode 100644 index 000000000000..776a2efadffa --- /dev/null +++ b/basic/qa/basic_coverage/test_wait_method.vb @@ -0,0 +1,12 @@ +' 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 + ' WAIT + Wait(0) + doUnitTest = 1 +End Function diff --git a/basic/qa/basic_coverage/test_weekday_method.vb b/basic/qa/basic_coverage/test_weekday_method.vb new file mode 100644 index 000000000000..48279434dd78 --- /dev/null +++ b/basic/qa/basic_coverage/test_weekday_method.vb @@ -0,0 +1,18 @@ +' +' 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() + ' WEEKDAY + If ( Weekday( aDate ) <> WeekDay( aDate ) ) Then + doUnitTest = 0 + Else + doUnitTest = 1 + End If +End Function diff --git a/basic/qa/basic_coverage/test_year_method.vb b/basic/qa/basic_coverage/test_year_method.vb new file mode 100644 index 000000000000..0863e11b35fe --- /dev/null +++ b/basic/qa/basic_coverage/test_year_method.vb @@ -0,0 +1,18 @@ +' +' 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() + ' YEAR + If ( DatePart( "yyyy", aDate ) <> Year( aDate ) ) Then + doUnitTest = 0 + Else + doUnitTest = 1 + End If +End Function |