Bump version to 6.4.7.2.M8
[LibreOffice.git] / basic / qa / vba_tests / timevalue.vb
bloba27feb35aca73197c578ed3cc459e7ddd1c6ec1f
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_testTimeValue()
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_testTimeValue() As String
18 passCount = 0
19 failCount = 0
21 result = "Test Results" & Chr$(10) & "============" & Chr$(10)
23 Dim testName As String
25 Dim date1, date2 As Date 'variables for test
26 testName = "Test TimeValue function"
27 On Error GoTo errorHandler
29 date2 = "16:35:17"
30 date1 = TimeValue("4:35:17 PM")
31 TestLog_ASSERT date1 = date2, "the return TimeValue is: " & date1
33 result = result & Chr$(10) & "Tests passed: " & passCount & Chr$(10) & "Tests failed: " & failCount & Chr$(10)
34 verify_testTimeValue = result
36 Exit Function
37 errorHandler:
38 TestLog_ASSERT (False), testName & ": hit error handler"
39 End Function
41 Sub TestLog_ASSERT(assertion As Boolean, Optional testId As String, Optional testComment As String)
43 If assertion = True Then
44 passCount = passCount + 1
45 Else
46 Dim testMsg As String
47 If Not IsMissing(testId) Then
48 testMsg = testMsg + " : " + testId
49 End If
50 If Not IsMissing(testComment) And Not (testComment = "") Then
51 testMsg = testMsg + " (" + testComment + ")"
52 End If
54 result = result & Chr$(10) & " Failed: " & testMsg
55 failCount = failCount + 1
56 End If
58 End Sub