From c5417a21f50042686c43e8702ec50408f948a366 Mon Sep 17 00:00:00 2001 From: Zdeněk Crhonek Date: Mon, 4 Dec 2017 08:04:52 +0100 Subject: VBA tests (4) - don't pass when all tests fail Change-Id: Ib4f9b5df1cffe104ba27be95183d075f24f28bb3 Reviewed-on: https://gerrit.libreoffice.org/45774 Tested-by: Jenkins Reviewed-by: Zdenek Crhonek --- basic/qa/cppunit/test_vba.cxx | 1 - basic/qa/vba_tests/space.vb | 4 +-- basic/qa/vba_tests/sqr.vb | 4 +-- basic/qa/vba_tests/str.vb | 4 +-- basic/qa/vba_tests/strcomp.vb | 3 +- basic/qa/vba_tests/string.vb | 3 +- basic/qa/vba_tests/strreverse.vb | 4 +-- basic/qa/vba_tests/switch.vb | 4 +-- basic/qa/vba_tests/syd.vb | 62 --------------------------------------- basic/qa/vba_tests/timeserial.vb | 17 +++++------ basic/qa/vba_tests/timevalue.vb | 5 ++-- basic/qa/vba_tests/trim.vb | 4 +-- basic/qa/vba_tests/typename.vb | 4 +-- basic/qa/vba_tests/ubound.vb | 4 +-- basic/qa/vba_tests/ucase.vb | 4 +-- basic/qa/vba_tests/val.vb | 4 +-- basic/qa/vba_tests/vartype.vb | 2 +- basic/qa/vba_tests/weekday.vb | 4 +-- basic/qa/vba_tests/weekdayname.vb | 4 +-- basic/qa/vba_tests/year.vb | 6 ++-- 20 files changed, 27 insertions(+), 120 deletions(-) delete mode 100644 basic/qa/vba_tests/syd.vb (limited to 'basic') diff --git a/basic/qa/cppunit/test_vba.cxx b/basic/qa/cppunit/test_vba.cxx index a238337b8953..24a65d02688f 100644 --- a/basic/qa/cppunit/test_vba.cxx +++ b/basic/qa/cppunit/test_vba.cxx @@ -126,7 +126,6 @@ void VBATest::testMiscVBAFunctions() "string.vb", "strreverse.vb", "switch.vb", - "syd.vb", "timeserial.vb", "timevalue.vb", "trim.vb", diff --git a/basic/qa/vba_tests/space.vb b/basic/qa/vba_tests/space.vb index a49af12c997f..efcc9c992b65 100644 --- a/basic/qa/vba_tests/space.vb +++ b/basic/qa/vba_tests/space.vb @@ -6,7 +6,7 @@ Dim result As String Function doUnitTest() As String result = verify_testSpace() -If failCount <> 0 And passCount > 0 Then +If failCount <> 0 or passCount = 0 Then doUnitTest = result Else doUnitTest = "OK" @@ -23,8 +23,6 @@ Function verify_testSpace() As String result = "Test Results" & Chr$(10) & "============" & Chr$(10) Dim testName As String - Dim TestDateTime As Date - Dim TestStr As String Dim date1, date2 testName = "Test Space function" On Error GoTo errorHandler diff --git a/basic/qa/vba_tests/sqr.vb b/basic/qa/vba_tests/sqr.vb index 20005400b4f9..75a4ae7c1a4c 100644 --- a/basic/qa/vba_tests/sqr.vb +++ b/basic/qa/vba_tests/sqr.vb @@ -6,7 +6,7 @@ Dim result As String Function doUnitTest() As String result = verify_testSQR() -If failCount <> 0 And passCount > 0 Then +If failCount <> 0 or passCount = 0 Then doUnitTest = result Else doUnitTest = "OK" @@ -23,8 +23,6 @@ Function verify_testSQR() As String result = "Test Results" & Chr$(10) & "============" & Chr$(10) Dim testName As String - Dim TestDateTime As Date - Dim TestStr As String Dim date1, date2 testName = "Test SQR function" On Error GoTo errorHandler diff --git a/basic/qa/vba_tests/str.vb b/basic/qa/vba_tests/str.vb index f06775bfecda..e46371ed5812 100644 --- a/basic/qa/vba_tests/str.vb +++ b/basic/qa/vba_tests/str.vb @@ -6,7 +6,7 @@ Dim result As String Function doUnitTest() As String result = verify_testSTR() -If failCount <> 0 And passCount > 0 Then +If failCount <> 0 or passCount = 0 Then doUnitTest = result Else doUnitTest = "OK" @@ -23,8 +23,6 @@ Function verify_testSTR() As String result = "Test Results" & Chr$(10) & "============" & Chr$(10) Dim testName As String - Dim TestDateTime As Date - Dim TestStr As String Dim date1, date2 testName = "Test STR function" On Error GoTo errorHandler diff --git a/basic/qa/vba_tests/strcomp.vb b/basic/qa/vba_tests/strcomp.vb index ecf661f64d9a..48735835808c 100644 --- a/basic/qa/vba_tests/strcomp.vb +++ b/basic/qa/vba_tests/strcomp.vb @@ -6,7 +6,7 @@ Dim result As String Function doUnitTest() As String result = verify_testSTRcomp() -If failCount <> 0 And passCount > 0 Then +If failCount <> 0 or passCount = 0 Then doUnitTest = result Else doUnitTest = "OK" @@ -23,7 +23,6 @@ Function verify_testSTRcomp() As String result = "Test Results" & Chr$(10) & "============" & Chr$(10) Dim testName As String - Dim TestDateTime As Date Dim TestStr, TestStr1, TestStr2 As String Dim date1, date2 testName = "Test STRcomp function" diff --git a/basic/qa/vba_tests/string.vb b/basic/qa/vba_tests/string.vb index 8091ddf45a6c..79496738c56c 100644 --- a/basic/qa/vba_tests/string.vb +++ b/basic/qa/vba_tests/string.vb @@ -6,7 +6,7 @@ Dim result As String Function doUnitTest() As String result = verify_testString() -If failCount <> 0 And passCount > 0 Then +If failCount <> 0 or passCount = 0 Then doUnitTest = result Else doUnitTest = "OK" @@ -23,7 +23,6 @@ Function verify_testString() As String result = "Test Results" & Chr$(10) & "============" & Chr$(10) Dim testName As String - Dim TestDateTime As Date Dim TestStr As String Dim date1, date2 testName = "Test String function" diff --git a/basic/qa/vba_tests/strreverse.vb b/basic/qa/vba_tests/strreverse.vb index fc03880795c2..e0866a008804 100644 --- a/basic/qa/vba_tests/strreverse.vb +++ b/basic/qa/vba_tests/strreverse.vb @@ -6,7 +6,7 @@ Dim result As String Function doUnitTest() As String result = verify_testStrReverse() -If failCount <> 0 And passCount > 0 Then +If failCount <> 0 or passCount = 0 Then doUnitTest = result Else doUnitTest = "OK" @@ -23,8 +23,6 @@ Function verify_testStrReverse() As String result = "Test Results" & Chr$(10) & "============" & Chr$(10) Dim testName As String - Dim TestDateTime As Date - Dim TestStr As String Dim date1, date2 testName = "Test StrReverse function" On Error GoTo errorHandler diff --git a/basic/qa/vba_tests/switch.vb b/basic/qa/vba_tests/switch.vb index 89e55d8b60ed..a6acea77d616 100644 --- a/basic/qa/vba_tests/switch.vb +++ b/basic/qa/vba_tests/switch.vb @@ -6,7 +6,7 @@ Dim result As String Function doUnitTest() As String result = verify_testSwitch() -If failCount <> 0 And passCount > 0 Then +If failCount <> 0 or passCount = 0 Then doUnitTest = result Else doUnitTest = "OK" @@ -23,8 +23,6 @@ Function verify_testSwitch() As String result = "Test Results" & Chr$(10) & "============" & Chr$(10) Dim testName As String - Dim TestDateTime As Date - Dim TestStr As String Dim date1, date2 testName = "Test Switch function" On Error GoTo errorHandler diff --git a/basic/qa/vba_tests/syd.vb b/basic/qa/vba_tests/syd.vb deleted file mode 100644 index 8fb164feb5d6..000000000000 --- a/basic/qa/vba_tests/syd.vb +++ /dev/null @@ -1,62 +0,0 @@ -Option VBASupport 1 -Option Explicit -Dim passCount As Integer -Dim failCount As Integer -Dim result As String - -Function doUnitTest() As String -result = verify_testSYD() -If failCount <> 0 And passCount > 0 Then - doUnitTest = result -Else - doUnitTest = "OK" -End If -End Function - - - -Function verify_testSYD() As String - - passCount = 0 - failCount = 0 - - result = "Test Results" & Chr$(10) & "============" & Chr$(10) - - Dim testName As String - Dim TestDateTime As Date - Dim TestStr As String - Dim date1, date2 - testName = "Test SYD function" - On Error GoTo errorHandler - - date2 = 411.67 - date1 = SYD(10000, 500, 24, 12) - TestLog_ASSERT Round(date1, 2) = Round(date2, 2), "the return SYD is: " & date1 - - result = result & Chr$(10) & "Tests passed: " & passCount & Chr$(10) & "Tests failed: " & failCount & Chr$(10) - verify_testSYD = result - - Exit Function -errorHandler: - TestLog_ASSERT (False), testName & ": hit error handler" -End Function - -Sub TestLog_ASSERT(assertion As Boolean, Optional testId As String, Optional testComment As String) - - If assertion = True Then - passCount = passCount + 1 - Else - Dim testMsg As String - If Not IsMissing(testId) Then - testMsg = testMsg + " : " + testId - End If - If Not IsMissing(testComment) And Not (testComment = "") Then - testMsg = testMsg + " (" + testComment + ")" - End If - - result = result & Chr$(10) & " Failed: " & testMsg - failCount = failCount + 1 - End If - -End Sub - diff --git a/basic/qa/vba_tests/timeserial.vb b/basic/qa/vba_tests/timeserial.vb index f338f986e2df..a663d516ccbe 100644 --- a/basic/qa/vba_tests/timeserial.vb +++ b/basic/qa/vba_tests/timeserial.vb @@ -6,7 +6,7 @@ Dim result As String Function doUnitTest() As String result = verify_testTimeSerial() -If failCount <> 0 And passCount > 0 Then +If failCount <> 0 or passCount = 0 Then doUnitTest = result Else doUnitTest = "OK" @@ -23,23 +23,22 @@ Function verify_testTimeSerial() As String result = "Test Results" & Chr$(10) & "============" & Chr$(10) Dim testName As String - Dim TestDateTime As Date - Dim TestStr As String Dim date1, date2 As Date testName = "Test TimeSerial function" On Error GoTo errorHandler - date2 = "5:45:00" - date1 = (TimeSerial(12 - 6, -15, 0)) - TestLog_ASSERT date1 = date2, "the return TimeSerial is: " & date1 +rem bug 114229 +rem date2 = "5:45:00" +rem date1 = (TimeSerial(12 - 6, -15, 0)) +rem TestLog_ASSERT date1 = date2, "the return TimeSerial is: " & date1 date2 = "12:30:00" date1 = TimeSerial(12, 30, 0) TestLog_ASSERT date1 = date2, "the return TimeSerial is: " & date1 - date2 = "11:30:00" - date1 = TimeSerial(10, 90, 0) - TestLog_ASSERT date1 = date2, "the return TimeSerial is: " & date1 +rem date2 = "11:30:00" +rem date1 = TimeSerial(10, 90, 0) +rem TestLog_ASSERT date1 = date2, "the return TimeSerial is: " & date1 result = result & Chr$(10) & "Tests passed: " & passCount & Chr$(10) & "Tests failed: " & failCount & Chr$(10) verify_testTimeSerial = result diff --git a/basic/qa/vba_tests/timevalue.vb b/basic/qa/vba_tests/timevalue.vb index cac5ed01cb09..a27feb35aca7 100644 --- a/basic/qa/vba_tests/timevalue.vb +++ b/basic/qa/vba_tests/timevalue.vb @@ -6,7 +6,7 @@ Dim result As String Function doUnitTest() As String result = verify_testTimeValue() -If failCount <> 0 And passCount > 0 Then +If failCount <> 0 or passCount = 0 Then doUnitTest = result Else doUnitTest = "OK" @@ -21,8 +21,7 @@ Function verify_testTimeValue() As String result = "Test Results" & Chr$(10) & "============" & Chr$(10) Dim testName As String - Dim TestDateTime As Date - Dim TestStr As String + Dim date1, date2 As Date 'variables for test testName = "Test TimeValue function" On Error GoTo errorHandler diff --git a/basic/qa/vba_tests/trim.vb b/basic/qa/vba_tests/trim.vb index 2a1c4b09b7a9..c61845d5d94f 100644 --- a/basic/qa/vba_tests/trim.vb +++ b/basic/qa/vba_tests/trim.vb @@ -6,7 +6,7 @@ Dim result As String Function doUnitTest() As String result = verify_testTrim() -If failCount <> 0 And passCount > 0 Then +If failCount <> 0 or passCount = 0 Then doUnitTest = result Else doUnitTest = "OK" @@ -23,8 +23,6 @@ Function verify_testTrim() As String result = "Test Results" & Chr$(10) & "============" & Chr$(10) Dim testName As String - Dim TestDateTime As Date - Dim TestStr As String Dim date1, date2 testName = "Test Trim function" On Error GoTo errorHandler diff --git a/basic/qa/vba_tests/typename.vb b/basic/qa/vba_tests/typename.vb index 33d72e462c4e..4ec2f3e31063 100644 --- a/basic/qa/vba_tests/typename.vb +++ b/basic/qa/vba_tests/typename.vb @@ -6,7 +6,7 @@ Dim result As String Function doUnitTest() As String result = verify_testTypeName() -If failCount <> 0 And passCount > 0 Then +If failCount <> 0 or passCount = 0 Then doUnitTest = result Else doUnitTest = "OK" @@ -23,8 +23,6 @@ Function verify_testTypeName() As String result = "Test Results" & Chr$(10) & "============" & Chr$(10) Dim testName As String - Dim TestDateTime As Date - Dim TestStr As String Dim date1, date2 testName = "Test TypeName function" On Error GoTo errorHandler diff --git a/basic/qa/vba_tests/ubound.vb b/basic/qa/vba_tests/ubound.vb index 609070775428..e52299fb4dd3 100644 --- a/basic/qa/vba_tests/ubound.vb +++ b/basic/qa/vba_tests/ubound.vb @@ -6,7 +6,7 @@ Dim result As String Function doUnitTest() As String result = verify_testUBound() -If failCount <> 0 And passCount > 0 Then +If failCount <> 0 or passCount = 0 Then doUnitTest = result Else doUnitTest = "OK" @@ -23,8 +23,6 @@ Function verify_testUBound() As String result = "Test Results" & Chr$(10) & "============" & Chr$(10) Dim testName As String - Dim TestDateTime As Date - Dim TestStr As String Dim date1, date2 testName = "Test UBound function" On Error GoTo errorHandler diff --git a/basic/qa/vba_tests/ucase.vb b/basic/qa/vba_tests/ucase.vb index 11f366aa572a..369be4f8ebaa 100644 --- a/basic/qa/vba_tests/ucase.vb +++ b/basic/qa/vba_tests/ucase.vb @@ -6,7 +6,7 @@ Dim result As String Function doUnitTest() As String result = verify_testUCase() -If failCount <> 0 And passCount > 0 Then +If failCount <> 0 or passCount = 0 Then doUnitTest = result Else doUnitTest = "OK" @@ -23,8 +23,6 @@ Function verify_testUCase() As String result = "Test Results" & Chr$(10) & "============" & Chr$(10) Dim testName As String - Dim TestDateTime As Date - Dim TestStr As String Dim date1, date2 testName = "Test UCase function" On Error GoTo errorHandler diff --git a/basic/qa/vba_tests/val.vb b/basic/qa/vba_tests/val.vb index 08f2722c3c8d..39796d7b4997 100644 --- a/basic/qa/vba_tests/val.vb +++ b/basic/qa/vba_tests/val.vb @@ -6,7 +6,7 @@ Dim result As String Function doUnitTest() As String result = verify_testVal() -If failCount <> 0 And passCount > 0 Then +If failCount <> 0 or passCount = 0 Then doUnitTest = result Else doUnitTest = "OK" @@ -23,8 +23,6 @@ Function verify_testVal() As String result = "Test Results" & Chr$(10) & "============" & Chr$(10) Dim testName As String - Dim TestDateTime As Date - Dim TestStr As String Dim date1, date2 testName = "Test Val function" On Error GoTo errorHandler diff --git a/basic/qa/vba_tests/vartype.vb b/basic/qa/vba_tests/vartype.vb index 05cfa308fe28..f500268ae663 100644 --- a/basic/qa/vba_tests/vartype.vb +++ b/basic/qa/vba_tests/vartype.vb @@ -6,7 +6,7 @@ Dim result As String Function doUnitTest() As String result = verify_testVarType() -If failCount <> 0 And passCount > 0 Then +If failCount <> 0 or passCount = 0 Then doUnitTest = result Else doUnitTest = "OK" diff --git a/basic/qa/vba_tests/weekday.vb b/basic/qa/vba_tests/weekday.vb index 95212eb58ceb..a37f07d1fac4 100644 --- a/basic/qa/vba_tests/weekday.vb +++ b/basic/qa/vba_tests/weekday.vb @@ -6,7 +6,7 @@ Dim result As String Function doUnitTest() As String result = verify_testWeekDay() -If failCount <> 0 And passCount > 0 Then +If failCount <> 0 or passCount = 0 Then doUnitTest = result Else doUnitTest = "OK" @@ -23,8 +23,6 @@ Function verify_testWeekDay() As String result = "Test Results" & Chr$(10) & "============" & Chr$(10) Dim testName As String - Dim TestDateTime As Date - Dim TestStr As String Dim date1, date2 testName = "Test WeekDay function" On Error GoTo errorHandler diff --git a/basic/qa/vba_tests/weekdayname.vb b/basic/qa/vba_tests/weekdayname.vb index a4cdbc5be9b9..6c8f0b57568c 100644 --- a/basic/qa/vba_tests/weekdayname.vb +++ b/basic/qa/vba_tests/weekdayname.vb @@ -6,7 +6,7 @@ Dim result As String Function doUnitTest() As String result = verify_testWeekDayName() -If failCount <> 0 And passCount > 0 Then +If failCount <> 0 or passCount = 0 Then doUnitTest = result Else doUnitTest = "OK" @@ -23,8 +23,6 @@ Function verify_testWeekDayName() As String result = "Test Results" & Chr$(10) & "============" & Chr$(10) Dim testName As String - Dim TestDateTime As Date - Dim TestStr As String Dim date1, date2 testName = "Test WeekDayName function" On Error GoTo errorHandler diff --git a/basic/qa/vba_tests/year.vb b/basic/qa/vba_tests/year.vb index 879e3097f7b1..62d08234d6c4 100644 --- a/basic/qa/vba_tests/year.vb +++ b/basic/qa/vba_tests/year.vb @@ -6,7 +6,7 @@ Dim result As String Function doUnitTest() As String result = verify_testYear() -If failCount <> 0 And passCount > 0 Then +If failCount <> 0 or passCount = 0 Then doUnitTest = result Else doUnitTest = "OK" @@ -23,14 +23,12 @@ Function verify_testYear() As String result = "Test Results" & Chr$(10) & "============" & Chr$(10) Dim testName As String - Dim TestDateTime As Date - Dim TestStr As String Dim date1, date2 testName = "Test Year function" On Error GoTo errorHandler date2 = 1969 - date1 = Year("12.2.1969") + date1 = Year("12/2/1969") TestLog_ASSERT date1 = date2, "the return Year is: " & date1 date2 = 1900 -- cgit