Bump version to 6.4.7.2.M8
[LibreOffice.git] / basic / qa / vba_tests / constants.vb
blobe879ce5abce5828151ea9c5638878e8ab71fe6fb
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_testConstants()
9 If failCount <> 0 Or passCount = 0 Then
10 doUnitTest = result
11 Else
12 doUnitTest = "OK"
13 End If
14 End Function
16 Function verify_testConstants() As String
17 passCount = 0
18 failCount = 0
20 result = "Test Results" & Chr$(10) & "============" & Chr$(10)
22 Dim testName As String
23 testName = "Test Constants"
24 On Error GoTo errorHandler
26 If GetGuiType() = 1 Then
27 TestLog_ASSERT vbNewline = vbCrLf, "vbNewLine is the same as vbCrLf on Windows"
28 Else
29 TestLog_ASSERT vbNewLine = vbLf, "vbNewLine is the same as vbLf on others than Windows"
30 End If
32 result = result & Chr$(10) & "Tests passed: " & passCount & Chr$(10) & "Tests failed: " & failCount & Chr$(10)
33 verify_testConstants = result
35 Exit Function
36 errorHandler:
37 TestLog_ASSERT (False), testName & ": hit error handler"
38 End Function
40 Sub TestLog_ASSERT(assertion As Boolean, Optional testId As String, Optional testComment As String)
42 If assertion = True Then
43 passCount = passCount + 1
44 Else
45 Dim testMsg As String
46 If Not IsMissing(testId) Then
47 testMsg = testMsg + " : " + testId
48 End If
49 If Not IsMissing(testComment) And Not (testComment = "") Then
50 testMsg = testMsg + " (" + testComment + ")"
51 End If
53 result = result & Chr$(10) & " Failed: " & testMsg
54 failCount = failCount + 1
55 End If
57 End Sub