3 Dim passCount
As Integer
4 Dim failCount
As Integer
7 Function doUnitTest() As String
8 result
= verify_testATN()
9 If failCount
<> 0 or passCount
= 0 Then
18 Function verify_testATN() As String
23 result
= "Test Results" & Chr
$(10) & "============" & Chr
$(10)
25 Dim testName
As String
26 Dim nr1
, nr2
As Double
27 testName
= "Test ATN function"
28 On Error GoTo errorHandler
30 nr2
= 1.10714871779409
32 TestLog_ASSERT
Round(nr1
, 14) = Round(nr2
, 14), "the return ATN is: " & nr1
34 nr2
= 1.19166451926354
36 TestLog_ASSERT
Round(nr1
, 14) = Round(nr2
, 14), "the return ATN is: " & nr1
38 nr2
= -1.27229739520872
40 TestLog_ASSERT
Round(nr1
, 14) = Round(nr2
, 14), "the return ATN is: " & nr1
42 nr2
= 1.56603445802574
44 TestLog_ASSERT
Round(nr1
, 14) = Round(nr2
, 14), "the return ATN is: " & nr1
48 TestLog_ASSERT nr1
= nr2
, "the return ATN is: " & nr1
50 result
= result
& Chr
$(10) & "Tests passed: " & passCount
& Chr
$(10) & "Tests failed: " & failCount
& Chr
$(10)
51 verify_testATN
= result
55 TestLog_ASSERT (False), testName
& ": hit error handler"
58 Sub TestLog_ASSERT(assertion
As Boolean, Optional testId
As String, Optional testComment
As String)
60 If assertion
= True Then
61 passCount
= passCount
+ 1
64 If Not IsMissing(testId
) Then
65 testMsg
= testMsg
+ " : " + testId
67 If Not IsMissing(testComment
) And Not (testComment
= "") Then
68 testMsg
= testMsg
+ " (" + testComment
+ ")"
71 result
= result
& Chr
$(10) & " Failed: " & testMsg
72 failCount
= failCount
+ 1