2017-03-17 15:56:32 +01:00
|
|
|
Option VBASupport 1
|
|
|
|
Option Explicit
|
|
|
|
|
|
|
|
Function doUnitTest() As String
|
2020-12-16 22:28:02 +00:00
|
|
|
verify_testCSng
|
|
|
|
doUnitTest = TestUtilModule.GetResult()
|
2017-03-17 15:56:32 +01:00
|
|
|
End Function
|
|
|
|
|
2020-12-16 22:28:02 +00:00
|
|
|
Sub verify_testCSng()
|
2017-03-17 15:56:32 +01:00
|
|
|
|
2020-12-16 22:28:02 +00:00
|
|
|
TestUtilModule.TestInit
|
2017-03-17 15:56:32 +01:00
|
|
|
|
|
|
|
Dim testName As String
|
|
|
|
Dim nr1, nr2 As Single 'variables for test
|
|
|
|
Dim nr3 As Double
|
|
|
|
|
|
|
|
testName = "Test CSng function"
|
|
|
|
On Error GoTo errorHandler
|
|
|
|
|
|
|
|
nr2 = 8.534535408
|
|
|
|
nr1 = CSng(8.534535408)
|
2020-12-16 22:28:02 +00:00
|
|
|
TestUtilModule.AssertTrue(nr1 = nr2, "the return CSng is: " & nr1)
|
2017-03-17 15:56:32 +01:00
|
|
|
|
|
|
|
nr3 = 100.1234
|
|
|
|
nr2 = 100.1234
|
|
|
|
nr1 = CSng(nr3)
|
2020-12-16 22:28:02 +00:00
|
|
|
TestUtilModule.AssertTrue(nr1 = nr2, "the return CSng is: " & nr1)
|
2017-03-17 15:56:32 +01:00
|
|
|
|
|
|
|
nr2 = 0
|
|
|
|
nr1 = CSng(0)
|
2020-12-16 22:28:02 +00:00
|
|
|
TestUtilModule.AssertTrue(nr1 = nr2, "the return CSng is: " & nr1)
|
2017-03-17 15:56:32 +01:00
|
|
|
|
2020-12-16 22:28:02 +00:00
|
|
|
TestUtilModule.TestEnd
|
2017-03-17 15:56:32 +01:00
|
|
|
|
2020-12-16 22:28:02 +00:00
|
|
|
Exit Sub
|
2017-03-17 15:56:32 +01:00
|
|
|
errorHandler:
|
2020-12-16 22:28:02 +00:00
|
|
|
TestUtilModule.AssertTrue(False, testName & ": hit error handler")
|
2017-03-17 15:56:32 +01:00
|
|
|
End Sub
|
|
|
|
|