summaryrefslogtreecommitdiff
path: root/basic
diff options
context:
space:
mode:
authorLaurent Balland-Poirier <laurent.balland-poirier@laposte.net>2016-12-11 13:43:07 +0100
committerLaurent BP <laurent.balland-poirier@laposte.net>2016-12-24 16:28:28 +0000
commit40578897d39c4eb0b528cff04ce82f5becbecc3f (patch)
treeff1fee121ff9d28eb91c0652a889ae0da106e9bd /basic
parent3c96a9c431cda4c3a5b76277c3081f1a2e1786f2 (diff)
basic: cleanup test_*_methods
cleanup remove duplicate test with other tests Change-Id: I4c82ad9f226f25080199ac0dc3815492fc4c265a Reviewed-on: https://gerrit.libreoffice.org/31860 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Arnaud Versini <arnaud.versini@libreoffice.org>
Diffstat (limited to 'basic')
-rw-r--r--basic/qa/basic_coverage/test_array_methods.vb19
-rw-r--r--basic/qa/basic_coverage/test_conversion_methods.vb36
-rw-r--r--basic/qa/basic_coverage/test_datetime_methods.vb43
-rw-r--r--basic/qa/basic_coverage/test_logic_methods.vb24
-rw-r--r--basic/qa/basic_coverage/test_math_methods.vb6
-rw-r--r--basic/qa/basic_coverage/test_string_methods.vb90
-rw-r--r--basic/qa/basic_coverage/test_system_methods.vb12
7 files changed, 84 insertions, 146 deletions
diff --git a/basic/qa/basic_coverage/test_array_methods.vb b/basic/qa/basic_coverage/test_array_methods.vb
index 093867a85440..53b2c8763286 100644
--- a/basic/qa/basic_coverage/test_array_methods.vb
+++ b/basic/qa/basic_coverage/test_array_methods.vb
@@ -13,26 +13,21 @@ Function doUnitTest as Integer
If (aVector(2) <> "Hello") Then
doUnitTest = 0
' LBOUND
- Else If ( LBound( aVector() ) <> 0 ) Then
+ ElseIf ( LBound( aVector() ) <> 0 ) Then
doUnitTest = 0
' TYPELEN
- Else If ( TypeLen(aVector(2)) <> 5 ) Then
+ ElseIf ( TypeLen(aVector(2)) <> 5 ) Then
doUnitTest = 0
' TYPENAME
- Else If ( TypeName(aVector(2)) <> "String" ) Then
- doUnitTest = 0
- ' UBOUND
- Else If ( UBound( aVector() ) <> 3 ) Then
+ ElseIf ( TypeName(aVector(2)) <> "String" ) Then
doUnitTest = 0
+ ' UBOUND already tested
+ 'ElseIf ( UBound( aVector() ) <> 3 ) Then
+ ' doUnitTest = 0
' VARTYPE
- Else If ( VarType(aVector(2)) <> 8 ) Then
+ ElseIf ( VarType(aVector(2)) <> 8 ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
- End If
- End If
- End If
- End If
- End If
End Function
diff --git a/basic/qa/basic_coverage/test_conversion_methods.vb b/basic/qa/basic_coverage/test_conversion_methods.vb
index 7790cbc89a83..6d441e04bca4 100644
--- a/basic/qa/basic_coverage/test_conversion_methods.vb
+++ b/basic/qa/basic_coverage/test_conversion_methods.vb
@@ -14,46 +14,36 @@ Function doUnitTest as Integer
If (CBool(3) <> True) Then
doUnitTest = 0
' CBYTE
- Else If (CByte("3") <> 3) Then
+ ElseIf (CByte("3") <> 3) Then
doUnitTest = 0
' CCUR
- Else If (CCur("100") <> 100) Then
+ ElseIf (CCur("100") <> 100) Then
doUnitTest = 0
' CDATE
- Else If (CDate(100) <> 100) Then
+ ElseIf (CDate(100) <> 100) Then
doUnitTest = 0
- ' CDEC
- 'Else If (CDec("100") <> 100) Then
+ ' CDEC already tested
+ 'ElseIf (CDec("100") <> 100) Then
' doUnitTest = 0
' CDBL
- Else If (CDbl("100") <> 100) Then
+ ElseIf (CDbl("100") <> 100) Then
doUnitTest = 0
' CINT
- Else If (CInt("100") <> 100) Then
- doUnitTest = 0
- ' CLNG
- Else If (CLng("100") <> 100) Then
+ ElseIf (CInt("100") <> 100) Then
doUnitTest = 0
+ ' CLNG already tested
+ 'ElseIf (CLng("100") <> 100) Then
+ ' doUnitTest = 0
' CSNG
- Else If (CSng("100") <> 100) Then
+ ElseIf (CSng("100") <> 100) Then
doUnitTest = 0
' CSTR
- Else If (CStr(100) <> "100") Then
+ ElseIf (CStr(100) <> "100") Then
doUnitTest = 0
' VAL
- Else If ( Val("4") <> 4 ) Then
+ ElseIf ( Val("4") <> 4 ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
- End If
- End If
- End If
- End If
- End If
- End If
- End If
- End If
- End If
- 'End If
End Function
diff --git a/basic/qa/basic_coverage/test_datetime_methods.vb b/basic/qa/basic_coverage/test_datetime_methods.vb
index 679e1297bac7..0ef990c1329b 100644
--- a/basic/qa/basic_coverage/test_datetime_methods.vb
+++ b/basic/qa/basic_coverage/test_datetime_methods.vb
@@ -19,59 +19,46 @@ Function doUnitTest as Integer
If ( CDateToIso( CDateFromIso("20161016") ) <> "20161016" ) Then
doUnitTest = 0
' DATE DATEDIFF DATEADD
- Else If ( DateDiff( "d", aVector(0), DateAdd("d", 1, aVector(0)) ) <> 1 ) Then
+ ElseIf ( DateDiff( "d", aVector(0), DateAdd("d", 1, aVector(0)) ) <> 1 ) Then
doUnitTest = 0
' DATEPART DAY
- Else If ( DatePart( "d", aVector(0) ) <> Day( aVector(0) ) ) Then
- doUnitTest = 0
- ' DATESERIAL DATEVALUE
- Else If ( DateSerial( 2016, 10, 16 ) <> DateValue("October 16, 2016") ) Then
+ 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
- Else If ( Hour(aVector(1)) <> Hour(aVector(1)) ) Then
+ ElseIf ( Hour(aVector(1)) <> Hour(aVector(1)) ) Then
doUnitTest = 0
' MINUTE
- Else If ( Minute(aVector(1)) <> Minute(aVector(1)) ) Then
+ ElseIf ( Minute(aVector(1)) <> Minute(aVector(1)) ) Then
doUnitTest = 0
' MONTH
- Else If ( DatePart( "m", aVector(0) ) <> Month( aVector(0) ) ) Then
+ ElseIf ( DatePart( "m", aVector(0) ) <> Month( aVector(0) ) ) Then
doUnitTest = 0
' MONTHNAME
- 'Else If ( CDate( MonthName(10)&" 16, 2016" ) <> DateSerial(2016, 10, 16) ) Then
+ 'ElseIf ( CDate( MonthName(10)&" 16, 2016" ) <> DateSerial(2016, 10, 16) ) Then
' doUnitTest = 0
' NOW TIMEVALUE
- Else If ( Now() < aVector(0) + TimeValue(aVector(1)) ) Then
+ ElseIf ( Now() < aVector(0) + TimeValue(aVector(1)) ) Then
doUnitTest = 0
' SECOND
- Else If ( Second(aVector(1)) <> Second(aVector(1)) ) Then
+ ElseIf ( Second(aVector(1)) <> Second(aVector(1)) ) Then
doUnitTest = 0
' TIMER max value = 24*3600
- Else If ( Timer() > 86400 ) Then
+ ElseIf ( Timer() > 86400 ) Then
doUnitTest = 0
' TIMESERIAL TIMEVALUE
- Else If ( TimeSerial(13,54,48) <> TImeValue("13:54:48") ) Then
+ ElseIf ( TimeSerial(13,54,48) <> TImeValue("13:54:48") ) Then
doUnitTest = 0
' WEEKDAY WEEKDAYNAME
- 'Else If ( WeekdayName( Weekday(aVector(0) ) ) <> WeekDayName( DatePart( "w", aVector(0) ) ) ) Then
+ 'ElseIf ( WeekdayName( Weekday(aVector(0) ) ) <> WeekDayName( DatePart( "w", aVector(0) ) ) ) Then
' doUnitTest = 0
' YEAR
- Else If ( DatePart( "yyyy", aVector(0) ) <> Year( aVector(0) ) ) Then
+ ElseIf ( DatePart( "yyyy", aVector(0) ) <> Year( aVector(0) ) ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
- End If
- End If
- End If
- End If
- End If
- End If
- End If
- End If
- End If
- End If
- End If
- 'End If
- 'End If
End Function
diff --git a/basic/qa/basic_coverage/test_logic_methods.vb b/basic/qa/basic_coverage/test_logic_methods.vb
index cc0bbee8ab2b..dbec2cefe893 100644
--- a/basic/qa/basic_coverage/test_logic_methods.vb
+++ b/basic/qa/basic_coverage/test_logic_methods.vb
@@ -13,31 +13,31 @@ Function doUnitTest as Integer
If (Choose(2, 1, 100, 3) <> 100) Then
doUnitTest = 0
' FALSE TRUE
- Else If (False = True) Then
+ ElseIf (False = True) Then
doUnitTest = 0
' IIF
- Else If ( IIF(True, 10, 12) <> 10 ) Then
+ ElseIf ( IIF(True, 10, 12) <> 10 ) Then
doUnitTest = 0
' ISARRAY
- Else If ( IsArray( aVector ) = False ) Then
+ ElseIf ( IsArray( aVector ) = False ) Then
doUnitTest = 0
' ISDATE
- Else If ( IsDate( aVector(1) ) = False ) Then
+ ElseIf ( IsDate( aVector(1) ) = False ) Then
doUnitTest = 0
' ISEMPTY
- Else If ( IsEmpty( aVector(2) ) ) Then
+ ElseIf ( IsEmpty( aVector(2) ) ) Then
doUnitTest = 0
' ISERROR
' ISMISSING
' ISNULL
- Else If ( IsNull( aVector ) ) Then
+ ElseIf ( IsNull( aVector ) ) Then
doUnitTest = 0
' ISNUMERIC
- Else If ( IsNumeric( aVector(3) ) = False ) Then
+ ElseIf ( IsNumeric( aVector(3) ) = False ) Then
doUnitTest = 0
' IsUnoStruc
' SWITCH
- Else If ( Switch( False, aVector(0),_
+ ElseIf ( Switch( False, aVector(0),_
True, aVector(1),_
False, aVector(2),_
True, aVector(3) ) <> aVector(1) ) Then
@@ -45,12 +45,4 @@ Function doUnitTest as Integer
Else
doUnitTest = 1
End If
- End If
- End If
- End If
- End If
- End If
- End If
- End If
- End If
End Function
diff --git a/basic/qa/basic_coverage/test_math_methods.vb b/basic/qa/basic_coverage/test_math_methods.vb
index edb90d1b7b1e..27477a73f6e5 100644
--- a/basic/qa/basic_coverage/test_math_methods.vb
+++ b/basic/qa/basic_coverage/test_math_methods.vb
@@ -7,8 +7,6 @@
Function doUnitTest as Integer
Randomize 42
- dim aVector as Variant
- aVector = Array( Date(), Time(), "Hello", -3.14)
' ABS
If (Abs(-3.5) <> 3.5) Then
doUnitTest = 0
@@ -39,13 +37,13 @@ Function doUnitTest as Integer
ElseIf ( Oct(100) <> "144" ) Then
doUnitTest = 0
' ROUND
- ' Else If ( Round( PI, 2 ) <> 3.14 ) Then
+ ' ElseIf ( Round( PI, 2 ) <> 3.14 ) Then
' doUnitTest = 0
' RND
ElseIf ( Rnd >= 1 ) Then
doUnitTest = 0
' SGN
- ElseIf ( Sgn(aVector(3)) <> -1 ) Then
+ ElseIf ( Sgn(-3.14) <> -1 ) Then
doUnitTest = 0
' SQR
ElseIf ( Sqr( 4 ) <> 2 ) Then
diff --git a/basic/qa/basic_coverage/test_string_methods.vb b/basic/qa/basic_coverage/test_string_methods.vb
index cf2499ed5b9d..deac1cf0b319 100644
--- a/basic/qa/basic_coverage/test_string_methods.vb
+++ b/basic/qa/basic_coverage/test_string_methods.vb
@@ -7,101 +7,79 @@
'
Function doUnitTest as Integer
- dim aVector as Variant
- aVector = Array( Date(), Time(), "Hello", -3.14)
+ dim aString as Variant
+ aString = "Hello"
' ASC
If (Asc("€") <> 8364) Then
doUnitTest = 0
' ASCw
- 'Else If (AscW("€") <> 8364) Then
+ 'ElseIf (AscW("€") <> 8364) Then
+ ' doUnitTest = 0
+ ' FORMAT already tested
+ ' ElseIf (Format(PI, "0") <> "3") Then
' doUnitTest = 0
- ' FORMAT
- Else If (Format(PI, "0") <> "3") Then
- doUnitTest = 0
' InStr
- Else If ( InStr( 1, aVector(2), "l", 1) <> 3 ) Then
+ ElseIf ( InStr( 1, aString, "l", 1) <> 3 ) Then
doUnitTest = 0
' InStrRev
- 'Else If ( InStrRev( aVector(2), "l" ) <> 4 ) Then
+ 'ElseIf ( InStrRev( aString, "l" ) <> 4 ) Then
' doUnitTest = 0
' LCASE
- Else If ( LCase( aVector(2) ) <> "hello" ) Then
- doUnitTest = 0
- ' LEFT
- Else If ( Left( aVector(2), 2 ) <> "He" ) Then
+ ElseIf ( LCase( aString ) <> "hello" ) Then
doUnitTest = 0
+ ' LEFT already test
+ ' ElseIf ( Left( aString, 2 ) <> "He" ) Then
+ ' doUnitTest = 0
' LEN
- Else If ( Len( aVector(2) ) <> 5 ) Then
+ ElseIf ( Len( aString ) <> 5 ) Then
doUnitTest = 0
' LENB
- Else If ( LenB( aVector(2) ) <> 5 ) Then
+ ElseIf ( LenB( aString ) <> 5 ) Then
doUnitTest = 0
' LTRIM
- Else If ( LTrim( " Hello" ) <> aVector(2) ) Then
- doUnitTest = 0
- ' MID
- Else If ( Mid( aVector(2), 2, 2 ) <> "el" ) Then
- doUnitTest = 0
- ' REPLACE
- Else If ( Replace ( aVector(2), "l", "jo", 1, 2 ) <> "Hejojoo" ) Then
- doUnitTest = 0
- ' RIGHT
- Else If ( Right( aVector(2), 2 ) <> "lo" ) Then
+ 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
- Else If ( RTrim( "Hello " ) <> aVector(2) ) Then
+ ElseIf ( RTrim( "Hello " ) <> aString ) Then
doUnitTest = 0
' SPACE
- Else If ( Space(3) <> " " ) Then
+ ElseIf ( Space(3) <> " " ) Then
doUnitTest = 0
' SPC
- Else If ( Spc(3) <> " " ) Then
+ ElseIf ( Spc(3) <> " " ) Then
doUnitTest = 0
' SPLIT
- Else If ( Split( "Hello world" )(1) <> "world" ) Then
+ ElseIf ( Split( "Hello world" )(1) <> "world" ) Then
doUnitTest = 0
' STR TRIM
- Else If ( Trim( Str( 4 ) ) <> "4" ) Then
+ ElseIf ( Trim( Str( 4 ) ) <> "4" ) Then
doUnitTest = 0
' STRCOMP
- Else If ( StrComp( aVector(2), "Hello" ) <> 0 ) Then
+ ElseIf ( StrComp( aString, "Hello" ) <> 0 ) Then
doUnitTest = 0
' StrConv
' STRING
- Else If ( String( 3, "H" ) <> "HHH" ) Then
+ ElseIf ( String( 3, "H" ) <> "HHH" ) Then
doUnitTest = 0
' STRREVERSE
- 'Else If ( StrReverse( aVector(2) ) <> "olleH" ) Then
+ 'ElseIf ( StrReverse( aString ) <> "olleH" ) Then
' doUnitTest = 0
' TAB
- Else If ( "Hello" & Tab(0) & "World" <> "HelloWorld" ) Then
+ ElseIf ( "Hello" & Tab(0) & "World" <> "HelloWorld" ) Then
doUnitTest = 0
' UCASE
- Else If ( UCase( aVector(2) ) <> "HELLO" ) Then
+ ElseIf ( UCase( aString ) <> "HELLO" ) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
- End If
- End If
- End If
- End If
- End If
- End If
- End If
- End If
- End If
- End If
- End If
- End If
- End If
- End If
- End If
- End If
- End If
- End If
- End If
- 'End If
- 'End If
- 'End If
End Function
diff --git a/basic/qa/basic_coverage/test_system_methods.vb b/basic/qa/basic_coverage/test_system_methods.vb
index 1a76c784bd41..02c6547e1e1c 100644
--- a/basic/qa/basic_coverage/test_system_methods.vb
+++ b/basic/qa/basic_coverage/test_system_methods.vb
@@ -9,21 +9,19 @@
Function doUnitTest as Integer
Wait(0)
Beep
- 'dim aVector as Variant
- 'aVector = Array( Date(), Time(), "Hello", -3.14)
- 'WaitUntil( aVector(0) )
+ 'dim aDate as Variant
+ 'aDate = Date()
+ 'WaitUntil( aDate )
' CompatibilityMode
If (CompatibilityMode(True) <> True) Then
doUnitTest = 0
' ConvertFromUrl ConvertToUrl
- Else If ( ConvertToUrl( ConvertFromUrl("") ) <> "") Then
+ ElseIf ( ConvertToUrl( ConvertFromUrl("") ) <> "") Then
doUnitTest = 0
' GetSolarVersion
- Else If ( GetSolarVersion() < 50000) Then
+ ElseIf ( GetSolarVersion() < 50000) Then
doUnitTest = 0
Else
doUnitTest = 1
End If
- End If
- End If
End Function