summaryrefslogtreecommitdiffstats
path: root/basic/qa/cppunit/_test_asserts.vb
diff options
context:
space:
mode:
Diffstat (limited to 'basic/qa/cppunit/_test_asserts.vb')
-rw-r--r--basic/qa/cppunit/_test_asserts.vb10
1 files changed, 8 insertions, 2 deletions
diff --git a/basic/qa/cppunit/_test_asserts.vb b/basic/qa/cppunit/_test_asserts.vb
index 0f1d0d88610f..2130ce02f454 100644
--- a/basic/qa/cppunit/_test_asserts.vb
+++ b/basic/qa/cppunit/_test_asserts.vb
@@ -35,8 +35,8 @@ Sub Assert(Assertion As Boolean, Optional testId As String, Optional testComment
If Not IsMissing(testId) Then
testMsg = " " + testId
End If
- If Not IsMissing(testComment) And Not (testComment = "") Then
- testMsg = testMsg + " (" + testComment + ")"
+ If Not IsMissing(testComment) Then
+ If Not (testComment = "") Then testMsg = testMsg + " (" + testComment + ")"
End If
result = result & Chr$(10) & " Failed:" & testMsg
@@ -53,6 +53,12 @@ Sub AssertEqual(actual As Variant, expected As Variant, testName As String)
End If
End Sub
+' Same as AssertEqual, but also checks actual and expected types
+Sub AssertEqualStrict(actual As Variant, expected As Variant, testName As String)
+ AssertEqual actual, expected, testName
+ AssertEqual TypeName(actual), TypeName(expected), testName & " type mismatch:"
+End Sub
+
Sub AssertEqualApprox(actual, expected, epsilon, testName As String)
If Abs(expected - actual) <= epsilon Then
passCount = passCount + 1