Bump version to 6.4.7.2.M8
[LibreOffice.git] / basic / qa / vba_tests / isnull.vb
blob145294f6d96172efd09f90dd5ba04eb702cdad09
1 Option VBASupport 1
2 Option Explicit
3 Dim passCount As Integer
4 Dim failCount As Integer
5 Dim result As String
7 Function doUnitTest() As String
8 result = verify_testIsNull()
9 If failCount <> 0 Or passCount = 0 Then
10 doUnitTest = result
11 Else
12 doUnitTest = "OK"
13 End If
14 End Function
18 Function verify_testIsNull() As String
20 passCount = 0
21 failCount = 0
23 result = "Test Results" & Chr$(10) & "============" & Chr$(10)
25 Dim testName As String
26 Dim date1, date2
27 testName = "Test IsNull function"
28 On Error GoTo errorHandler
30 date2 = True
31 date1 = IsNull(Null)
32 TestLog_ASSERT date1 = date2, "the return IsNull is: " & date1
34 date2 = False
35 date1 = IsNull("")
36 TestLog_ASSERT date1 = date2, "the return IsNull is: " & date1
38 result = result & Chr$(10) & "Tests passed: " & passCount & Chr$(10) & "Tests failed: " & failCount & Chr$(10)
39 verify_testIsNull = result
41 Exit Function
42 errorHandler:
43 TestLog_ASSERT (False), testName & ": hit error handler"
44 End Function
46 Sub TestLog_ASSERT(assertion As Boolean, Optional testId As String, Optional testComment As String)
48 If assertion = True Then
49 passCount = passCount + 1
50 Else
51 Dim testMsg As String
52 If Not IsMissing(testId) Then
53 testMsg = testMsg + " : " + testId
54 End If
55 If Not IsMissing(testComment) And Not (testComment = "") Then
56 testMsg = testMsg + " (" + testComment + ")"
57 End If
59 result = result & Chr$(10) & " Failed: " & testMsg
60 failCount = failCount + 1
61 End If
63 End Sub