summaryrefslogtreecommitdiff
path: root/basic/qa/vba_tests/month.vb
blob: faa074560b3d771a411562d3492434a3d235a551 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
Option VBASupport 1
Option Explicit

Function doUnitTest() As String
verify_testMonth
doUnitTest = TestUtilModule.GetResult()
End Function

Sub verify_testMonth()

    TestUtilModule.TestInit

    Dim testName As String
    Dim date1, date2
    Dim ldate As Date
    testName = "Test Month function"
    On Error GoTo errorHandler
    ldate = 32616

    date2 = 4
    date1 = Month(ldate)
    TestUtilModule.AssertTrue(date1 = date2, "the return Month is: " & date1)

    date2 = 2
    date1 = Month("01/02/2007")
    TestUtilModule.AssertTrue(date1 = date2, "the return Month is: " & date1)

    date2 = 12
    date1 = Month(1)
    TestUtilModule.AssertTrue(date1 = date2, "the return Month is: " & date1)

    date2 = 2
    date1 = Month(60)
    TestUtilModule.AssertTrue(date1 = date2, "the return Month is: " & date1)

    date2 = 6
    date1 = Month(2000)
    TestUtilModule.AssertTrue(date1 = date2, "the return Month is: " & date1)

    TestUtilModule.TestEnd

    Exit Sub
errorHandler:
        TestUtilModule.AssertTrue(False, testName & ": hit error handler")
End Sub