Kaydet (Commit) 1da0c806 authored tarafından Eike Rathke's avatar Eike Rathke

remove trailing blanks rubbish

Change-Id: I97cee7ea1d63375b73f0d4003022e9f09ad38e5f
üst 68495ab3
...@@ -30,24 +30,24 @@ Function verify_ByteArrayString() As String ...@@ -30,24 +30,24 @@ Function verify_ByteArrayString() As String
Dim x() As Byte Dim x() As Byte
Dim count As Integer Dim count As Integer
testName = "Test the conversion between bytearray and string" testName = "Test the conversion between bytearray and string"
On Error GoTo errorHandler On Error GoTo errorHandler
MyString = "abc" MyString = "abc"
x = MyString ' string -> byte array x = MyString ' string -> byte array
result = "Test Results" & Chr$(10) & "============" & Chr$(10) result = "Test Results" & Chr$(10) & "============" & Chr$(10)
count = UBound(x) ' 6 byte count = UBound(x) ' 6 byte
' test bytes in string ' test bytes in string
result = result + updateResultString("test1 numbytes ", (count), 5) result = result + updateResultString("test1 numbytes ", (count), 5)
MyString = x 'byte array -> string MyString = x 'byte array -> string
result = result + updateResultString("test assign byte array to string", MyString, "abc") result = result + updateResultString("test assign byte array to string", MyString, "abc")
result = result & Chr$(10) & "Tests passed: " & passCount & Chr$(10) & "Tests failed: " & failCount & Chr$(10) result = result & Chr$(10) & "Tests passed: " & passCount & Chr$(10) & "Tests failed: " & failCount & Chr$(10)
verify_ByteArrayString = result verify_ByteArrayString = result
Exit Function Exit Function
......
...@@ -26,9 +26,9 @@ Function verify_testDateSerial() as String ...@@ -26,9 +26,9 @@ Function verify_testDateSerial() as String
testName = "Test DateSerial function" testName = "Test DateSerial function"
date2 = 36326 date2 = 36326
On Error GoTo errorHandler On Error GoTo errorHandler
date1 = DateSerial(1999, 6, 15) '6/15/1999 date1 = DateSerial(1999, 6, 15) '6/15/1999
TestLog_ASSERT date1 = date2, "the return date is: " & date1 TestLog_ASSERT date1 = date2, "the return date is: " & date1
date1 = DateSerial(2000, 1 - 7, 15) '6/15/1999 date1 = DateSerial(2000, 1 - 7, 15) '6/15/1999
...@@ -36,7 +36,7 @@ Function verify_testDateSerial() as String ...@@ -36,7 +36,7 @@ Function verify_testDateSerial() as String
date1 = DateSerial(1999, 1, 166) '6/15/1999 date1 = DateSerial(1999, 1, 166) '6/15/1999
TestLog_ASSERT date1 = date2, "the return date is: " & date1 TestLog_ASSERT date1 = date2, "the return date is: " & date1
result = result & Chr$(10) & "Tests passed: " & passCount & Chr$(10) & "Tests failed: " & failCount & Chr$(10) result = result & Chr$(10) & "Tests passed: " & passCount & Chr$(10) & "Tests failed: " & failCount & Chr$(10)
verify_testDateSerial = result verify_testDateSerial = result
Exit Function Exit Function
...@@ -60,6 +60,6 @@ Sub TestLog_ASSERT(assertion As Boolean, Optional testId As String, Optional tes ...@@ -60,6 +60,6 @@ Sub TestLog_ASSERT(assertion As Boolean, Optional testId As String, Optional tes
result = result & Chr$(10) & " Failed: " & testMsg result = result & Chr$(10) & " Failed: " & testMsg
failCount = failCount + 1 failCount = failCount + 1
End If End If
End Sub End Sub
...@@ -19,7 +19,7 @@ Function verify_format() as String ...@@ -19,7 +19,7 @@ Function verify_format() as String
failCount = 0 failCount = 0
result = "Test Results" & Chr$(10) & "============" & Chr$(10) result = "Test Results" & Chr$(10) & "============" & Chr$(10)
'Predefined_Datetime_Format_Sample 'Predefined_Datetime_Format_Sample
Predefined_Number_Format_Sample Predefined_Number_Format_Sample
'Custom_Datetime_Format_Sample 'Custom_Datetime_Format_Sample
...@@ -27,7 +27,7 @@ Function verify_format() as String ...@@ -27,7 +27,7 @@ Function verify_format() as String
Custom_Text_Format_Sample Custom_Text_Format_Sample
result = result & Chr$(10) & "Tests passed: " & passCount & Chr$(10) & "Tests failed: " & failCount & Chr$(10) result = result & Chr$(10) & "Tests passed: " & passCount & Chr$(10) & "Tests failed: " & failCount & Chr$(10)
verify_format = result verify_format = result
End Sub End Sub
...@@ -37,38 +37,38 @@ Sub Predefined_Datetime_Format_Sample() ...@@ -37,38 +37,38 @@ Sub Predefined_Datetime_Format_Sample()
myDate = "01/06/98" myDate = "01/06/98"
MyTime = "17:08:06" MyTime = "17:08:06"
testName = "Test Predefined_Datetime_Format_Sample function" testName = "Test Predefined_Datetime_Format_Sample function"
On Error GoTo errorHandler On Error GoTo errorHandler
' The date/time format have a little different between ms office and OOo due to different locale and system... ' The date/time format have a little different between ms office and OOo due to different locale and system...
TestStr = Format(myDate, "General Date") ' 1/6/98 TestStr = Format(myDate, "General Date") ' 1/6/98
TestLog_ASSERT IsDate(TestStr), "General Date: " & TestStr & " (Test only applies to en_US locale)" TestLog_ASSERT IsDate(TestStr), "General Date: " & TestStr & " (Test only applies to en_US locale)"
'TestLog_ASSERT TestStr = "1/6/98", "General Date: " & TestStr 'TestLog_ASSERT TestStr = "1/6/98", "General Date: " & TestStr
TestStr = Format(myDate, "Long Date") ' Tuesday, January 06, 1998 TestStr = Format(myDate, "Long Date") ' Tuesday, January 06, 1998
TestLog_ASSERT TestStr = "Tuesday, January 06, 1998", "Long Date: " & TestStr & " (Test only applies to en_US locale)" TestLog_ASSERT TestStr = "Tuesday, January 06, 1998", "Long Date: " & TestStr & " (Test only applies to en_US locale)"
'TestLog_ASSERT IsDate(TestStr), "Long Date: " & TestStr 'TestLog_ASSERT IsDate(TestStr), "Long Date: " & TestStr
TestStr = Format(myDate, "Medium Date") ' 06-Jan-98 TestStr = Format(myDate, "Medium Date") ' 06-Jan-98
'TestLog_ASSERT TestStr = "06-Jan-98", "Medium Date: " & TestStr 'TestLog_ASSERT TestStr = "06-Jan-98", "Medium Date: " & TestStr
TestLog_ASSERT IsDate(TestStr), "Medium Date: " & TestStr & " (Test only applies to en_US locale)" TestLog_ASSERT IsDate(TestStr), "Medium Date: " & TestStr & " (Test only applies to en_US locale)"
TestStr = Format(myDate, "Short Date") ' 1/6/98 TestStr = Format(myDate, "Short Date") ' 1/6/98
'TestLog_ASSERT TestStr = "1/6/98", "Short Date: " & TestStr 'TestLog_ASSERT TestStr = "1/6/98", "Short Date: " & TestStr
TestLog_ASSERT IsDate(TestStr), "Short Date: " & TestStr & " (Test only applies to en_US locale)" TestLog_ASSERT IsDate(TestStr), "Short Date: " & TestStr & " (Test only applies to en_US locale)"
TestStr = Format(MyTime, "Long Time") ' 5:08:06 PM TestStr = Format(MyTime, "Long Time") ' 5:08:06 PM
'TestLog_ASSERT TestStr = "5:08:06 PM", "Long Time: " & TestStr 'TestLog_ASSERT TestStr = "5:08:06 PM", "Long Time: " & TestStr
TestLog_ASSERT IsDate(TestStr), "Long Time: " & TestStr & " (Test only applies to en_US locale)" TestLog_ASSERT IsDate(TestStr), "Long Time: " & TestStr & " (Test only applies to en_US locale)"
TestStr = Format(MyTime, "Medium Time") ' 05:08 PM TestStr = Format(MyTime, "Medium Time") ' 05:08 PM
'TestLog_ASSERT TestStr = "05:08 PM", "Medium Time: " & TestStr 'TestLog_ASSERT TestStr = "05:08 PM", "Medium Time: " & TestStr
TestLog_ASSERT IsDate(TestStr), "Medium Time: " & TestStr & " (Test only applies to en_US locale)" TestLog_ASSERT IsDate(TestStr), "Medium Time: " & TestStr & " (Test only applies to en_US locale)"
TestStr = Format(MyTime, "Short Time") ' 17:08 TestStr = Format(MyTime, "Short Time") ' 17:08
'TestLog_ASSERT TestStr = "17:08", "Short Time: " & TestStr 'TestLog_ASSERT TestStr = "17:08", "Short Time: " & TestStr
TestLog_ASSERT IsDate(TestStr), "Short Time: " & TestStr & " (Test only applies to en_US locale)" TestLog_ASSERT IsDate(TestStr), "Short Time: " & TestStr & " (Test only applies to en_US locale)"
...@@ -82,172 +82,172 @@ Sub Predefined_Number_Format_Sample() ...@@ -82,172 +82,172 @@ Sub Predefined_Number_Format_Sample()
Dim testName As String Dim testName As String
testName = "Test Predefined_Number_Format_Sample function" testName = "Test Predefined_Number_Format_Sample function"
myNumber = 562486.2356 myNumber = 562486.2356
On Error GoTo errorHandler On Error GoTo errorHandler
TestStr = Format(myNumber, "General Number") '562486.2356 TestStr = Format(myNumber, "General Number") '562486.2356
TestLog_ASSERT TestStr = "562486.2356", "General Number: " & TestStr TestLog_ASSERT TestStr = "562486.2356", "General Number: " & TestStr
'MsgBox TestStr 'MsgBox TestStr
TestStr = Format(0.2, "Fixed") '0.20 TestStr = Format(0.2, "Fixed") '0.20
TestLog_ASSERT TestStr = "0.20", "Fixed: " & TestStr TestLog_ASSERT TestStr = "0.20", "Fixed: " & TestStr
'MsgBox TestStr 'MsgBox TestStr
TestStr = Format(myNumber, "Standard") '562,486.24 TestStr = Format(myNumber, "Standard") '562,486.24
TestLog_ASSERT TestStr = "562,486.24", "Standard: " & TestStr TestLog_ASSERT TestStr = "562,486.24", "Standard: " & TestStr
'MsgBox TestStr 'MsgBox TestStr
TestStr = Format(0.7521, "Percent") '75.21% TestStr = Format(0.7521, "Percent") '75.21%
TestLog_ASSERT TestStr = "75.21%", "Percent: " & TestStr TestLog_ASSERT TestStr = "75.21%", "Percent: " & TestStr
'MsgBox TestStr 'MsgBox TestStr
TestStr = Format(myNumber, "Scientific") '5.62E+05 TestStr = Format(myNumber, "Scientific") '5.62E+05
TestLog_ASSERT TestStr = "5.62E+05", "Scientific: " & TestStr TestLog_ASSERT TestStr = "5.62E+05", "Scientific: " & TestStr
'MsgBox TestStr 'MsgBox TestStr
TestStr = Format(-3456.789, "Scientific") '-3.46E+03 TestStr = Format(-3456.789, "Scientific") '-3.46E+03
TestLog_ASSERT TestStr = "-3.46E+03", "Scientific: " & TestStr TestLog_ASSERT TestStr = "-3.46E+03", "Scientific: " & TestStr
'MsgBox TestStr 'MsgBox TestStr
TestStr = Format(0, "Yes/No") 'No TestStr = Format(0, "Yes/No") 'No
TestLog_ASSERT TestStr = "No", "Yes/No: " & TestStr TestLog_ASSERT TestStr = "No", "Yes/No: " & TestStr
'MsgBox TestStr 'MsgBox TestStr
TestStr = Format(23, "Yes/No") 'Yes TestStr = Format(23, "Yes/No") 'Yes
TestLog_ASSERT TestStr = "Yes", "Yes/No: " & TestStr TestLog_ASSERT TestStr = "Yes", "Yes/No: " & TestStr
'MsgBox TestStr 'MsgBox TestStr
TestStr = Format(0, "True/False") 'False TestStr = Format(0, "True/False") 'False
TestLog_ASSERT TestStr = "False", "True/False: " & TestStr TestLog_ASSERT TestStr = "False", "True/False: " & TestStr
'MsgBox TestStr 'MsgBox TestStr
TestStr = Format(23, "True/False") 'True TestStr = Format(23, "True/False") 'True
TestLog_ASSERT TestStr = "True", "True/False: " & TestStr TestLog_ASSERT TestStr = "True", "True/False: " & TestStr
'MsgBox TestStr 'MsgBox TestStr
TestStr = Format(0, "On/Off") 'Off TestStr = Format(0, "On/Off") 'Off
TestLog_ASSERT TestStr = "Off", "On/Off: " & TestStr TestLog_ASSERT TestStr = "Off", "On/Off: " & TestStr
'MsgBox TestStr 'MsgBox TestStr
TestStr = Format(23, "On/Off") 'On TestStr = Format(23, "On/Off") 'On
TestLog_ASSERT TestStr = "On", "On/Off: " & TestStr TestLog_ASSERT TestStr = "On", "On/Off: " & TestStr
'MsgBox TestStr 'MsgBox TestStr
Exit Sub Exit Sub
errorHandler: errorHandler:
TestLog_ASSERT (false), testName & ": hit error handler" TestLog_ASSERT (false), testName & ": hit error handler"
End Sub End Sub
Sub Custom_Datetime_Format_Sample() Sub Custom_Datetime_Format_Sample()
Dim myDate, MyTime, TestStr As String Dim myDate, MyTime, TestStr As String
Dim testName As String Dim testName As String
myDate = "01/06/98" myDate = "01/06/98"
MyTime = "05:08:06" MyTime = "05:08:06"
testName = "Test Custom_Datetime_Format_Sample function" testName = "Test Custom_Datetime_Format_Sample function"
On Error GoTo errorHandler On Error GoTo errorHandler
TestStr = Format("01/06/98 17:08:06", "c") ' 1/6/98 5:08:06 PM TestStr = Format("01/06/98 17:08:06", "c") ' 1/6/98 5:08:06 PM
TestLog_ASSERT TestStr = "1/6/98 5:08:06 PM", "c: " & TestStr & " (Test only applies to en_US locale)" TestLog_ASSERT TestStr = "1/6/98 5:08:06 PM", "c: " & TestStr & " (Test only applies to en_US locale)"
'MsgBox TestStr 'MsgBox TestStr
TestStr = Format(myDate, "dddddd") ' (Long Date), Tuesday, January 06, 1998 TestStr = Format(myDate, "dddddd") ' (Long Date), Tuesday, January 06, 1998
TestLog_ASSERT TestStr = "Tuesday, January 06, 1998", "dddddd: " & TestStr & " (Test only applies to en_US locale)" TestLog_ASSERT TestStr = "Tuesday, January 06, 1998", "dddddd: " & TestStr & " (Test only applies to en_US locale)"
'MsgBox TestStr 'MsgBox TestStr
TestStr = Format(myDate, "mm-dd-yyyy") ' 01-06-19s98 TestStr = Format(myDate, "mm-dd-yyyy") ' 01-06-19s98
TestLog_ASSERT TestStr = "01-06-1998", "mm-dd-yyyy: " & TestStr & " (Test only applies to en_US locale)" TestLog_ASSERT TestStr = "01-06-1998", "mm-dd-yyyy: " & TestStr & " (Test only applies to en_US locale)"
'MsgBox TestStr 'MsgBox TestStr
TestStr = Format(myDate, "d") ' 6 TestStr = Format(myDate, "d") ' 6
TestLog_ASSERT TestStr = "6", "d: " & TestStr & " (Test only applies to en_US locale)" TestLog_ASSERT TestStr = "6", "d: " & TestStr & " (Test only applies to en_US locale)"
'MsgBox TestStr 'MsgBox TestStr
TestStr = Format(myDate, "dd") ' 06 TestStr = Format(myDate, "dd") ' 06
TestLog_ASSERT TestStr = "06", "dd: " & TestStr & " (Test only applies to en_US locale)" TestLog_ASSERT TestStr = "06", "dd: " & TestStr & " (Test only applies to en_US locale)"
'MsgBox TestStr 'MsgBox TestStr
TestStr = Format(myDate, "ddd") ' Tue TestStr = Format(myDate, "ddd") ' Tue
TestLog_ASSERT TestStr = "Tue", "ddd: " & TestStr & " (Test only applies to en_US locale)" TestLog_ASSERT TestStr = "Tue", "ddd: " & TestStr & " (Test only applies to en_US locale)"
'MsgBox TestStr 'MsgBox TestStr
TestStr = Format(myDate, "dddd") ' Tuesday TestStr = Format(myDate, "dddd") ' Tuesday
TestLog_ASSERT TestStr = "Tuesday", "dddd: " & TestStr & " (Test only applies to en_US locale)" TestLog_ASSERT TestStr = "Tuesday", "dddd: " & TestStr & " (Test only applies to en_US locale)"
'MsgBox TestStr 'MsgBox TestStr
TestStr = Format(MyTime, "h") ' 5 TestStr = Format(MyTime, "h") ' 5
TestLog_ASSERT TestStr = "5", "h: " & TestStr & " (Test only applies to en_US locale)" TestLog_ASSERT TestStr = "5", "h: " & TestStr & " (Test only applies to en_US locale)"
'MsgBox TestStr 'MsgBox TestStr
TestStr = Format(MyTime, "hh") ' 05 TestStr = Format(MyTime, "hh") ' 05
TestLog_ASSERT TestStr = "05", "hh: " & TestStr & " (Test only applies to en_US locale)" TestLog_ASSERT TestStr = "05", "hh: " & TestStr & " (Test only applies to en_US locale)"
'MsgBox TestStr 'MsgBox TestStr
TestStr = Format(MyTime, "n") ' 8 TestStr = Format(MyTime, "n") ' 8
TestLog_ASSERT TestStr = "8", "n: " & TestStr & " (Test only applies to en_US locale)" TestLog_ASSERT TestStr = "8", "n: " & TestStr & " (Test only applies to en_US locale)"
'MsgBox TestStr 'MsgBox TestStr
TestStr = Format(MyTime, "nn") ' 08 TestStr = Format(MyTime, "nn") ' 08
TestLog_ASSERT TestStr = "08", "nn: " & TestStr & " (Test only applies to en_US locale)" TestLog_ASSERT TestStr = "08", "nn: " & TestStr & " (Test only applies to en_US locale)"
'MsgBox TestStr 'MsgBox TestStr
TestStr = Format(myDate, "m") ' 1 TestStr = Format(myDate, "m") ' 1
TestLog_ASSERT TestStr = "1", "m: " & TestStr & " (Test only applies to en_US locale)" TestLog_ASSERT TestStr = "1", "m: " & TestStr & " (Test only applies to en_US locale)"
'MsgBox TestStr 'MsgBox TestStr
TestStr = Format(myDate, "mm") ' 01 TestStr = Format(myDate, "mm") ' 01
TestLog_ASSERT TestStr = "01", "mm: " & TestStr & " (Test only applies to en_US locale)" TestLog_ASSERT TestStr = "01", "mm: " & TestStr & " (Test only applies to en_US locale)"
'MsgBox TestStr 'MsgBox TestStr
TestStr = Format(myDate, "mmm") ' Jan TestStr = Format(myDate, "mmm") ' Jan
TestLog_ASSERT TestStr = "Jan", "mmm: " & TestStr & " (Test only applies to en_US locale)" TestLog_ASSERT TestStr = "Jan", "mmm: " & TestStr & " (Test only applies to en_US locale)"
'MsgBox TestStr 'MsgBox TestStr
TestStr = Format(myDate, "mmmm") ' January TestStr = Format(myDate, "mmmm") ' January
TestLog_ASSERT TestStr = "January", "mmmm: " & TestStr & " (Test only applies to en_US locale)" TestLog_ASSERT TestStr = "January", "mmmm: " & TestStr & " (Test only applies to en_US locale)"
'MsgBox TestStr 'MsgBox TestStr
TestStr = Format(MyTime, "s") ' 6 TestStr = Format(MyTime, "s") ' 6
TestLog_ASSERT TestStr = "6", "s: " & TestStr & " (Test only applies to en_US locale)" TestLog_ASSERT TestStr = "6", "s: " & TestStr & " (Test only applies to en_US locale)"
'MsgBox TestStr 'MsgBox TestStr
TestStr = Format(MyTime, "ss") ' 06 TestStr = Format(MyTime, "ss") ' 06
TestLog_ASSERT TestStr = "06", "ss: " & TestStr & " (Test only applies to en_US locale)" TestLog_ASSERT TestStr = "06", "ss: " & TestStr & " (Test only applies to en_US locale)"
'MsgBox TestStr 'MsgBox TestStr
MyTime = "17:08:06" MyTime = "17:08:06"
TestStr = Format(MyTime, "hh:mm:ss AM/PM") ' 05:08:06 PM TestStr = Format(MyTime, "hh:mm:ss AM/PM") ' 05:08:06 PM
TestLog_ASSERT TestStr = "05:08:06 PM", "hh:mm:ss AM/PM: " & TestStr & " (Test only applies to en_US locale)" TestLog_ASSERT TestStr = "05:08:06 PM", "hh:mm:ss AM/PM: " & TestStr & " (Test only applies to en_US locale)"
TestStr = Format(MyTime, "hh:mm:ss") ' 17:08:06 TestStr = Format(MyTime, "hh:mm:ss") ' 17:08:06
TestLog_ASSERT TestStr = "17:08:06", "hh:mm:ss: " & TestStr & " (Test only applies to en_US locale)" TestLog_ASSERT TestStr = "17:08:06", "hh:mm:ss: " & TestStr & " (Test only applies to en_US locale)"
'MsgBox TestStr 'MsgBox TestStr
TestStr = Format(myDate, "ww") ' 2 TestStr = Format(myDate, "ww") ' 2
TestLog_ASSERT TestStr = "2", "ww: " & TestStr & " (Test only applies to en_US locale)" TestLog_ASSERT TestStr = "2", "ww: " & TestStr & " (Test only applies to en_US locale)"
'MsgBox TestStr 'MsgBox TestStr
TestStr = Format(myDate, "w") ' 3 TestStr = Format(myDate, "w") ' 3
TestLog_ASSERT TestStr = "3", "w: " & TestStr & " (Test only applies to en_US locale)" TestLog_ASSERT TestStr = "3", "w: " & TestStr & " (Test only applies to en_US locale)"
'MsgBox TestStr 'MsgBox TestStr
TestStr = Format(myDate, "y") ' 6 TestStr = Format(myDate, "y") ' 6
TestLog_ASSERT TestStr = "6", "y: " & TestStr & " (Test only applies to en_US locale)" TestLog_ASSERT TestStr = "6", "y: " & TestStr & " (Test only applies to en_US locale)"
'MsgBox TestStr 'MsgBox TestStr
TestStr = Format(myDate, "yy") ' 98 TestStr = Format(myDate, "yy") ' 98
TestLog_ASSERT TestStr = "98", "yy: " & TestStr & " (Test only applies to en_US locale)" TestLog_ASSERT TestStr = "98", "yy: " & TestStr & " (Test only applies to en_US locale)"
'MsgBox TestStr 'MsgBox TestStr
TestStr = Format(myDate, "yyyy") ' 1998 TestStr = Format(myDate, "yyyy") ' 1998
TestLog_ASSERT TestStr = "1998", "yyyy: " & TestStr & " (Test only applies to en_US locale)" TestLog_ASSERT TestStr = "1998", "yyyy: " & TestStr & " (Test only applies to en_US locale)"
'MsgBox TestStr 'MsgBox TestStr
Exit Sub Exit Sub
errorHandler: errorHandler:
TestLog_ASSERT (false), testName & ": hit error handler" TestLog_ASSERT (false), testName & ": hit error handler"
...@@ -256,98 +256,98 @@ End Sub ...@@ -256,98 +256,98 @@ End Sub
Sub Custom_Number_Format_Sample() Sub Custom_Number_Format_Sample()
Dim TestStr As String Dim TestStr As String
Dim testName As String Dim testName As String
testName = "Test Custom_Number_Format_Sample function" testName = "Test Custom_Number_Format_Sample function"
On Error GoTo errorHandler On Error GoTo errorHandler
TestStr = Format(23.675, "00.0000") ' 23.6750 TestStr = Format(23.675, "00.0000") ' 23.6750
TestLog_ASSERT TestStr = "23.6750", "00.0000: " & TestStr TestLog_ASSERT TestStr = "23.6750", "00.0000: " & TestStr
'MsgBox TestStr 'MsgBox TestStr
TestStr = Format(23.675, "00.00") ' 23.68 TestStr = Format(23.675, "00.00") ' 23.68
TestLog_ASSERT TestStr = "23.68", "00.00: " & TestStr TestLog_ASSERT TestStr = "23.68", "00.00: " & TestStr
'MsgBox TestStr 'MsgBox TestStr
TestStr = Format(2658, "00000") ' 02658 TestStr = Format(2658, "00000") ' 02658
TestLog_ASSERT TestStr = "02658", "00000: " & TestStr TestLog_ASSERT TestStr = "02658", "00000: " & TestStr
'MsgBox TestStr 'MsgBox TestStr
TestStr = Format(2658, "00.00") ' 2658.00 TestStr = Format(2658, "00.00") ' 2658.00
TestLog_ASSERT TestStr = "2658.00", "00.00: " & TestStr TestLog_ASSERT TestStr = "2658.00", "00.00: " & TestStr
'MsgBox TestStr 'MsgBox TestStr
TestStr = Format(23.675, "##.####") ' 23.675 TestStr = Format(23.675, "##.####") ' 23.675
TestLog_ASSERT TestStr = "23.675", "##.####: " & TestStr TestLog_ASSERT TestStr = "23.675", "##.####: " & TestStr
'MsgBox TestStr 'MsgBox TestStr
TestStr = Format(23.675, "##.##") ' 23.68 TestStr = Format(23.675, "##.##") ' 23.68
TestLog_ASSERT TestStr = "23.68", "##.##: " & TestStr TestLog_ASSERT TestStr = "23.68", "##.##: " & TestStr
'MsgBox TestStr 'MsgBox TestStr
TestStr = Format(12345.25, "#,###.##") '12,345.25 TestStr = Format(12345.25, "#,###.##") '12,345.25
TestLog_ASSERT TestStr = "12,345.25", "#,###.##: " & TestStr TestLog_ASSERT TestStr = "12,345.25", "#,###.##: " & TestStr
'MsgBox TestStr 'MsgBox TestStr
TestStr = Format(0.25, "##.00%") '25.00% TestStr = Format(0.25, "##.00%") '25.00%
TestLog_ASSERT TestStr = "25.00%", "##.00%: " & TestStr TestLog_ASSERT TestStr = "25.00%", "##.00%: " & TestStr
'MsgBox TestStr 'MsgBox TestStr
TestStr = Format(1000000, "#,###") '1,000,000 TestStr = Format(1000000, "#,###") '1,000,000
TestLog_ASSERT TestStr = "1,000,000", "#,###: " & TestStr TestLog_ASSERT TestStr = "1,000,000", "#,###: " & TestStr
'MsgBox TestStr 'MsgBox TestStr
TestStr = Format(1.09837555, "#.#####E+###") '1.09838E+000 TestStr = Format(1.09837555, "#.#####E+###") '1.09838E+000
TestLog_ASSERT TestStr = "1.09838E+000", "#.#####E+###: " & TestStr TestLog_ASSERT TestStr = "1.09838E+000", "#.#####E+###: " & TestStr
'MsgBox TestStr 'MsgBox TestStr
TestStr = Format(1.09837555, "###.####E#") '1.0984E0 with engineering notation TestStr = Format(1.09837555, "###.####E#") '1.0984E0 with engineering notation
TestLog_ASSERT TestStr = "1.0984E0", "###.####E#: " & TestStr TestLog_ASSERT TestStr = "1.0984E0", "###.####E#: " & TestStr
'MsgBox TestStr 'MsgBox TestStr
TestStr = Format(1098.37555, "###.####E#") '1.0984E3 with engineering notation TestStr = Format(1098.37555, "###.####E#") '1.0984E3 with engineering notation
TestLog_ASSERT TestStr = "1.0984E3", "###.####E#: " & TestStr TestLog_ASSERT TestStr = "1.0984E3", "###.####E#: " & TestStr
'MsgBox TestStr 'MsgBox TestStr
TestStr = Format(1098375.55, "###.####E#") '1.0984E6 with engineering notation TestStr = Format(1098375.55, "###.####E#") '1.0984E6 with engineering notation
TestLog_ASSERT TestStr = "1.0984E6", "###.####E#: " & TestStr TestLog_ASSERT TestStr = "1.0984E6", "###.####E#: " & TestStr
'MsgBox TestStr 'MsgBox TestStr
TestStr = Format(1.09837555, "######E#") '1E0 with engineering notation TestStr = Format(1.09837555, "######E#") '1E0 with engineering notation
TestLog_ASSERT TestStr = "1E0", "######E#: " & TestStr TestLog_ASSERT TestStr = "1E0", "######E#: " & TestStr
'MsgBox TestStr 'MsgBox TestStr
TestStr = Format(123456.789, "###E0") '123E3 with engineering notation TestStr = Format(123456.789, "###E0") '123E3 with engineering notation
TestLog_ASSERT TestStr = "123E3", "###E0: " & TestStr TestLog_ASSERT TestStr = "123E3", "###E0: " & TestStr
'MsgBox TestStr 'MsgBox TestStr
TestStr = Format(123567.89, "###E0") '124E3 with engineering notation TestStr = Format(123567.89, "###E0") '124E3 with engineering notation
TestLog_ASSERT TestStr = "124E3", "###E0: " & TestStr TestLog_ASSERT TestStr = "124E3", "###E0: " & TestStr
'MsgBox TestStr 'MsgBox TestStr
TestStr = Format(12, "###E0") '12E0 with engineering notation TestStr = Format(12, "###E0") '12E0 with engineering notation
TestLog_ASSERT TestStr = "12E0", "###E0: " & TestStr TestLog_ASSERT TestStr = "12E0", "###E0: " & TestStr
'MsgBox TestStr 'MsgBox TestStr
TestStr = Format(12, "000E0") '012E0 with engineering notation TestStr = Format(12, "000E0") '012E0 with engineering notation
TestLog_ASSERT TestStr = "012E0", "000E0: " & TestStr TestLog_ASSERT TestStr = "012E0", "000E0: " & TestStr
'MsgBox TestStr 'MsgBox TestStr
TestStr = Format(0.12345, "###E0") '123E-3 with engineering notation TestStr = Format(0.12345, "###E0") '123E-3 with engineering notation
TestLog_ASSERT TestStr = "123E-3", "###E0: " & TestStr TestLog_ASSERT TestStr = "123E-3", "###E0: " & TestStr
'MsgBox TestStr 'MsgBox TestStr
TestStr = Format(123456, "####E0") '12E4 with interval-4 notation TestStr = Format(123456, "####E0") '12E4 with interval-4 notation
TestLog_ASSERT TestStr = "12E4", "####E0: " & TestStr TestLog_ASSERT TestStr = "12E4", "####E0: " & TestStr
'MsgBox TestStr 'MsgBox TestStr
TestStr = Format(2345.25, "$#,###.##") '$2.345.25 TestStr = Format(2345.25, "$#,###.##") '$2.345.25
TestLog_ASSERT TestStr = "$2,345.25", "$#,###.##: " & TestStr TestLog_ASSERT TestStr = "$2,345.25", "$#,###.##: " & TestStr
'MsgBox TestStr 'MsgBox TestStr
TestStr = Format(0.25, "##.###\%") '.25% TestStr = Format(0.25, "##.###\%") '.25%
TestLog_ASSERT TestStr = ".25%", "##.###\%: " & TestStr TestLog_ASSERT TestStr = ".25%", "##.###\%: " & TestStr
'MsgBox TestStr 'MsgBox TestStr
Exit Sub Exit Sub
errorHandler: errorHandler:
TestLog_ASSERT (false), testName & ": hit error handler" TestLog_ASSERT (false), testName & ": hit error handler"
...@@ -356,20 +356,20 @@ End Sub ...@@ -356,20 +356,20 @@ End Sub
Sub Custom_Text_Format_Sample() Sub Custom_Text_Format_Sample()
Dim myText, TestStr As String Dim myText, TestStr As String
myText = "VBA" myText = "VBA"
Dim testName As String Dim testName As String
testName = "Test Custom_Text_Format_Sample function" testName = "Test Custom_Text_Format_Sample function"
On Error GoTo errorHandler On Error GoTo errorHandler
TestStr = Format(myText, "<") 'vba TestStr = Format(myText, "<") 'vba
TestLog_ASSERT TestStr = "vba", "<: " & TestStr TestLog_ASSERT TestStr = "vba", "<: " & TestStr
'MsgBox TestStr 'MsgBox TestStr
TestStr = Format("vba", ">") 'VBA TestStr = Format("vba", ">") 'VBA
TestLog_ASSERT TestStr = "VBA", ">: " & TestStr TestLog_ASSERT TestStr = "VBA", ">: " & TestStr
'MsgBox TestStr 'MsgBox TestStr
Exit Sub Exit Sub
errorHandler: errorHandler:
TestLog_ASSERT (false), testName & "hit error handler" TestLog_ASSERT (false), testName & "hit error handler"
...@@ -382,41 +382,41 @@ Sub testFormat() ...@@ -382,41 +382,41 @@ Sub testFormat()
Dim TestDateTime As Date Dim TestDateTime As Date
Dim TestStr As String Dim TestStr As String
testName = "Test Format function" testName = "Test Format function"
On Error GoTo errorHandler On Error GoTo errorHandler
TestDateTime = "1/27/2001 5:04:23 PM" TestDateTime = "1/27/2001 5:04:23 PM"
' Returns the value of TestDateTime in user-defined date/time formats. ' Returns the value of TestDateTime in user-defined date/time formats.
' Returns "17:4:23". ' Returns "17:4:23".
TestStr = Format(TestDateTime, "h:m:s") TestStr = Format(TestDateTime, "h:m:s")
TestLog_ASSERT TestStr = "17:4:23", "the format of h:m:s: " & TestStr TestLog_ASSERT TestStr = "17:4:23", "the format of h:m:s: " & TestStr
' Returns "05:04:23 PM". ' Returns "05:04:23 PM".
TestStr = Format(TestDateTime, "ttttt") TestStr = Format(TestDateTime, "ttttt")
TestLog_ASSERT TestStr = "5:04:23 PM", "the format of ttttt: " & TestStr TestLog_ASSERT TestStr = "5:04:23 PM", "the format of ttttt: " & TestStr
' Returns "Saturday, Jan 27 2001". ' Returns "Saturday, Jan 27 2001".
TestStr = Format(TestDateTime, "dddd, MMM d yyyy") TestStr = Format(TestDateTime, "dddd, MMM d yyyy")
TestLog_ASSERT TestStr = "Saturday, Jan 27 2001", "the format of dddd, MMM d yyyy: " & TestStr TestLog_ASSERT TestStr = "Saturday, Jan 27 2001", "the format of dddd, MMM d yyyy: " & TestStr
' Returns "17:04:23". ' Returns "17:04:23".
TestStr = Format(TestDateTime, "HH:mm:ss") TestStr = Format(TestDateTime, "HH:mm:ss")
TestLog_ASSERT TestStr = "17:04:23", "the format of HH:mm:ss: " & TestStr TestLog_ASSERT TestStr = "17:04:23", "the format of HH:mm:ss: " & TestStr
' Returns "23". ' Returns "23".
TestStr = Format(23) TestStr = Format(23)
TestLog_ASSERT TestStr = "23", "no format:" & TestStr TestLog_ASSERT TestStr = "23", "no format:" & TestStr
' User-defined numeric formats. ' User-defined numeric formats.
' Returns "5,459.40". ' Returns "5,459.40".
TestStr = Format(5459.4, "##,##0.00") TestStr = Format(5459.4, "##,##0.00")
TestLog_ASSERT TestStr = "5,459.40", "the format of ##,##0.00: " & TestStr TestLog_ASSERT TestStr = "5,459.40", "the format of ##,##0.00: " & TestStr
' Returns "334.90". ' Returns "334.90".
TestStr = Format(334.9, "###0.00") TestStr = Format(334.9, "###0.00")
TestLog_ASSERT TestStr = "334.90", "the format of ###0.00: " & TestStr TestLog_ASSERT TestStr = "334.90", "the format of ###0.00: " & TestStr
' Returns "500.00%". ' Returns "500.00%".
TestStr = Format(5, "0.00%") TestStr = Format(5, "0.00%")
TestLog_ASSERT TestStr = "500.00%", "the format of 0.00%: " & TestStr TestLog_ASSERT TestStr = "500.00%", "the format of 0.00%: " & TestStr
...@@ -441,6 +441,6 @@ Sub TestLog_ASSERT(assertion As Boolean, Optional testId As String, Optional tes ...@@ -441,6 +441,6 @@ Sub TestLog_ASSERT(assertion As Boolean, Optional testId As String, Optional tes
result = result & Chr$(10) & " Failed: " & testMsg result = result & Chr$(10) & " Failed: " & testMsg
failCount = failCount + 1 failCount = failCount + 1
End If End If
End Sub End Sub
...@@ -17,13 +17,13 @@ objCmd.ActiveConnection = cn ...@@ -17,13 +17,13 @@ objCmd.ActiveConnection = cn
If objCmd.ActiveConnection.CommandTimeout <> modifiedTimeout Then If objCmd.ActiveConnection.CommandTimeout <> modifiedTimeout Then
Rem if we copied the object by reference then we should have the Rem if we copied the object by reference then we should have the
Rem modified timeout ( because we should be just pointing as cn ) Rem modified timeout ( because we should be just pointing as cn )
doUnitTest = "FAIL expected modified timeout " & modifiedTimeout & " but got " & objCmd.ActiveConnection.CommandTimeout doUnitTest = "FAIL expected modified timeout " & modifiedTimeout & " but got " & objCmd.ActiveConnection.CommandTimeout
Exit Function Exit Function
End If End If
cn.CommandTimeout = origTimeout ' restore timeout cn.CommandTimeout = origTimeout ' restore timeout
Rem Double check objCmd.ActiveConnection is pointing to objCmd.ActiveConnection Rem Double check objCmd.ActiveConnection is pointing to objCmd.ActiveConnection
If objCmd.ActiveConnection.CommandTimeout <> origTimeout Then If objCmd.ActiveConnection.CommandTimeout <> origTimeout Then
doUnitTest = "FAIL expected orignal timeout " & origTimeout & " but got " & objCmd.ActiveConnection.CommandTimeout doUnitTest = "FAIL expected orignal timeout " & origTimeout & " but got " & objCmd.ActiveConnection.CommandTimeout
Exit Function Exit Function
End If End If
doUnitTest = "OK" ' no error doUnitTest = "OK" ' no error
......
...@@ -24,23 +24,23 @@ Function verify_testPartition() as String ...@@ -24,23 +24,23 @@ Function verify_testPartition() as String
Dim retStr As String Dim retStr As String
testName = "Test Partition function" testName = "Test Partition function"
On Error GoTo errorHandler On Error GoTo errorHandler
retStr = Partition(20, 0, 98, 5) retStr = Partition(20, 0, 98, 5)
'MsgBox retStr 'MsgBox retStr
TestLog_ASSERT retStr = "20:24", "the number 20 occurs in the range:" & retStr TestLog_ASSERT retStr = "20:24", "the number 20 occurs in the range:" & retStr
retStr = Partition(20, 0, 99, 1) retStr = Partition(20, 0, 99, 1)
'MsgBox retStr 'MsgBox retStr
TestLog_ASSERT retStr = " 20: 20", "the number 20 occurs in the range:" & retStr TestLog_ASSERT retStr = " 20: 20", "the number 20 occurs in the range:" & retStr
retStr = Partition(120, 0, 99, 5) retStr = Partition(120, 0, 99, 5)
'MsgBox retStr 'MsgBox retStr
TestLog_ASSERT retStr = "100: ", "the number 120 occurs in the range:" & retStr TestLog_ASSERT retStr = "100: ", "the number 120 occurs in the range:" & retStr
retStr = Partition(-5, 0, 99, 5) retStr = Partition(-5, 0, 99, 5)
'MsgBox retStr 'MsgBox retStr
TestLog_ASSERT retStr = " : -1", "the number -5 occurs in the range:" & retStr TestLog_ASSERT retStr = " : -1", "the number -5 occurs in the range:" & retStr
retStr = Partition(2, 0, 5, 2) retStr = Partition(2, 0, 5, 2)
'MsgBox retStr 'MsgBox retStr
TestLog_ASSERT retStr = " 2: 3", "the number 2 occurs in the range:" & retStr TestLog_ASSERT retStr = " 2: 3", "the number 2 occurs in the range:" & retStr
...@@ -67,5 +67,5 @@ Sub TestLog_ASSERT(assertion As Boolean, Optional testId As String, Optional tes ...@@ -67,5 +67,5 @@ Sub TestLog_ASSERT(assertion As Boolean, Optional testId As String, Optional tes
result = result & Chr$(10) & " Failed: " & testMsg result = result & Chr$(10) & " Failed: " & testMsg
failCount = failCount + 1 failCount = failCount + 1
End If End If
End Sub End Sub
...@@ -44,7 +44,7 @@ Function verify_testReplace() as String ...@@ -44,7 +44,7 @@ Function verify_testReplace() as String
TestLog_ASSERT retStr = "abcbcdBc", "start = 1, count = 0, not support in Unix: " & retStr TestLog_ASSERT retStr = "abcbcdBc", "start = 1, count = 0, not support in Unix: " & retStr
result = result & Chr$(10) & "Tests passed: " & passCount & Chr$(10) & "Tests failed: " & failCount & Chr$(10) result = result & Chr$(10) & "Tests passed: " & passCount & Chr$(10) & "Tests failed: " & failCount & Chr$(10)
verify_testReplace = result verify_testReplace = result
Exit Function Exit Function
errorHandler: errorHandler:
TestLog_ASSERT (False), testName & ": hit error handler" TestLog_ASSERT (False), testName & ": hit error handler"
...@@ -66,5 +66,5 @@ Sub TestLog_ASSERT(assertion As Boolean, Optional testId As String, Optional tes ...@@ -66,5 +66,5 @@ Sub TestLog_ASSERT(assertion As Boolean, Optional testId As String, Optional tes
result = result & Chr$(10) & " Failed: " & testMsg result = result & Chr$(10) & " Failed: " & testMsg
failCount = failCount + 1 failCount = failCount + 1
End If End If
End Sub End Sub
...@@ -25,43 +25,43 @@ Function verify_testStrConv() as String ...@@ -25,43 +25,43 @@ Function verify_testStrConv() as String
srcStr = "abc EFG hij" srcStr = "abc EFG hij"
testName = "Test StrConv function" testName = "Test StrConv function"
On Error GoTo errorHandler On Error GoTo errorHandler
retStr = StrConv(srcStr, vbUpperCase) retStr = StrConv(srcStr, vbUpperCase)
'MsgBox retStr 'MsgBox retStr
TestLog_ASSERT retStr = "ABC EFG HIJ", "Converts the string to uppercase characters:" & retStr TestLog_ASSERT retStr = "ABC EFG HIJ", "Converts the string to uppercase characters:" & retStr
retStr = StrConv(srcStr, vbLowerCase) retStr = StrConv(srcStr, vbLowerCase)
'MsgBox retStr 'MsgBox retStr
TestLog_ASSERT retStr = "abc efg hij", "Converts the string to lowercase characters:" & retStr TestLog_ASSERT retStr = "abc efg hij", "Converts the string to lowercase characters:" & retStr
retStr = StrConv(srcStr, vbProperCase) retStr = StrConv(srcStr, vbProperCase)
'MsgBox retStr 'MsgBox retStr
TestLog_ASSERT retStr = "Abc Efg Hij", "Converts the first letter of every word in string to uppercase:" & retStr TestLog_ASSERT retStr = "Abc Efg Hij", "Converts the first letter of every word in string to uppercase:" & retStr
'retStr = StrConv("ABCDEVB¥ì¥¹¥­¥å©`", vbWide) 'retStr = StrConv("ABCDEVB¥ì¥¹¥­¥å©`", vbWide)
'MsgBox retStr 'MsgBox retStr
'TestLog_ASSERT retStr = "£Á£Â£Ã£Ä£ÅVB¥ì¥¹¥­¥å©`", "Converts narrow (single-byte) characters in string to wide" 'TestLog_ASSERT retStr = "£Á£Â£Ã£Ä£ÅVB¥ì¥¹¥­¥å©`", "Converts narrow (single-byte) characters in string to wide"
'retStr = StrConv("£Á£Â£Ã£Ä£ÅVB¥ì¥¹¥­¥å©`", vbNarrow) 'retStr = StrConv("£Á£Â£Ã£Ä£ÅVB¥ì¥¹¥­¥å©`", vbNarrow)
'MsgBox retStr 'MsgBox retStr
'TestLog_ASSERT retStr = "ABCDEVB¥ì¥¹¥­¥å©`", "Converts wide (double-byte) characters in string to narrow (single-byte) characters." & retStr 'TestLog_ASSERT retStr = "ABCDEVB¥ì¥¹¥­¥å©`", "Converts wide (double-byte) characters in string to narrow (single-byte) characters." & retStr
'retStr = StrConv("¤Ï¤Ê¤Á¤ã¤ó", vbKatakana) 'retStr = StrConv("¤Ï¤Ê¤Á¤ã¤ó", vbKatakana)
'MsgBox retStr 'MsgBox retStr
'TestLog_ASSERT retStr = "¥Ï¥Ê¥Á¥ã¥ó", "Converts Hiragana characters in string to Katakana characters.." & retStr 'TestLog_ASSERT retStr = "¥Ï¥Ê¥Á¥ã¥ó", "Converts Hiragana characters in string to Katakana characters.." & retStr
' retStr = StrConv("¥Ï¥Ê¥Á¥ã¥ó", vbHiragana) ' retStr = StrConv("¥Ï¥Ê¥Á¥ã¥ó", vbHiragana)
'MsgBox retStr 'MsgBox retStr
' TestLog_ASSERT retStr = "¤Ï¤Ê¤Á¤ã¤ó", "Converts Katakana characters in string to Hiragana characters.." & retStr ' TestLog_ASSERT retStr = "¤Ï¤Ê¤Á¤ã¤ó", "Converts Katakana characters in string to Hiragana characters.." & retStr
'x = StrConv("ÉϺ£ÊÐABC", vbFromUnicode) 'x = StrConv("ÉϺ£ÊÐABC", vbFromUnicode)
'MsgBox retStr 'MsgBox retStr
'TestLog_ASSERT UBound(x) = 8, "Converts the string from Unicode, the length is : " & UBound(x) + 1 'TestLog_ASSERT UBound(x) = 8, "Converts the string from Unicode, the length is : " & UBound(x) + 1
' retStr = StrConv(x, vbUnicode) ' retStr = StrConv(x, vbUnicode)
'MsgBox retStr 'MsgBox retStr
' TestLog_ASSERT retStr = "ÉϺ£ÊÐABC", "Converts the string to Unicode: " & retStr ' TestLog_ASSERT retStr = "ÉϺ£ÊÐABC", "Converts the string to Unicode: " & retStr
result = result & Chr$(10) & "Tests passed: " & passCount & Chr$(10) & "Tests failed: " & failCount & Chr$(10) result = result & Chr$(10) & "Tests passed: " & passCount & Chr$(10) & "Tests failed: " & failCount & Chr$(10)
verify_testStrConv = result verify_testStrConv = result
...@@ -86,5 +86,5 @@ Sub TestLog_ASSERT(assertion As Boolean, Optional testId As String, Optional tes ...@@ -86,5 +86,5 @@ Sub TestLog_ASSERT(assertion As Boolean, Optional testId As String, Optional tes
result = result & Chr$(10) & " Failed: " & testMsg result = result & Chr$(10) & " Failed: " & testMsg
failCount = failCount + 1 failCount = failCount + 1
End If End If
End Sub End Sub
...@@ -30,76 +30,76 @@ Sub DSD() ...@@ -30,76 +30,76 @@ Sub DSD()
Dim testName As String Dim testName As String
testName = "double = string + double" testName = "double = string + double"
Dim testCompute As String Dim testCompute As String
Dim s As String Dim s As String
Dim d As Double Dim d As Double
Dim r As Double Dim r As Double
On Error GoTo ErrorHandler On Error GoTo ErrorHandler
testCompute = "s = null, d = null, r = s + d" testCompute = "s = null, d = null, r = s + d"
r = s + d r = s + d
TestLog_ASSERT r = -1, testCompute & " .The result is: " & r TestLog_ASSERT r = -1, testCompute & " .The result is: " & r
testCompute = "s = null, d = null, r = s & d" testCompute = "s = null, d = null, r = s & d"
r = s & d r = s & d
TestLog_ASSERT r = 0, testCompute & " .The result is: " & r TestLog_ASSERT r = 0, testCompute & " .The result is: " & r
testCompute = "s = null, d = 20, r = s + d" testCompute = "s = null, d = 20, r = s + d"
d = 20 d = 20
r = s + d r = s + d
TestLog_ASSERT r = -1, testCompute & " .The result is: " & r TestLog_ASSERT r = -1, testCompute & " .The result is: " & r
testCompute = "s = null, d = 20, r = s & d" testCompute = "s = null, d = 20, r = s & d"
d = 20 d = 20
r = s & d r = s & d
TestLog_ASSERT r = 20, testCompute & " .The result is: " & r TestLog_ASSERT r = 20, testCompute & " .The result is: " & r
'''''''''''''' ''''''''''''''
s = "10" s = "10"
Dim d2 As Double Dim d2 As Double
testCompute = "s = '10', d = null, r = s + d" testCompute = "s = '10', d = null, r = s + d"
r = s + d2 r = s + d2
TestLog_ASSERT r = 10, testCompute & " .The result is: " & r TestLog_ASSERT r = 10, testCompute & " .The result is: " & r
testCompute = "s = '10', d = null, r = s & d" testCompute = "s = '10', d = null, r = s & d"
r = s & d2 r = s & d2
TestLog_ASSERT r = 100, testCompute & " .The result is: " & r TestLog_ASSERT r = 100, testCompute & " .The result is: " & r
testCompute = "s = '10', d = 20, r = s + d" testCompute = "s = '10', d = 20, r = s + d"
d2 = 20 d2 = 20
r = s + d2 r = s + d2
TestLog_ASSERT r = 30, testCompute & " .The result is: " & r TestLog_ASSERT r = 30, testCompute & " .The result is: " & r
testCompute = "s = '10', d = 20, r = s & d" testCompute = "s = '10', d = 20, r = s & d"
d2 = 20 d2 = 20
r = s & d2 r = s & d2
TestLog_ASSERT r = 1020, testCompute & " .The result is: " & r TestLog_ASSERT r = 1020, testCompute & " .The result is: " & r
'''''''''''''' ''''''''''''''
s = "abc" s = "abc"
Dim d3 As Double Dim d3 As Double
testCompute = "s = 'abc', d = null, r = s + d" testCompute = "s = 'abc', d = null, r = s + d"
r = s + d3 r = s + d3
TestLog_ASSERT r = -1, testCompute & " .The result is: " & r TestLog_ASSERT r = -1, testCompute & " .The result is: " & r
testCompute = "s = 'abc', d = null, r = s & d" testCompute = "s = 'abc', d = null, r = s & d"
r = s & d3 r = s & d3
TestLog_ASSERT r = -1, testCompute & " .The result is: " & r TestLog_ASSERT r = -1, testCompute & " .The result is: " & r
testCompute = "s = 'abc', d = 20, r = s + d" testCompute = "s = 'abc', d = 20, r = s + d"
d3 = 20 d3 = 20
r = s + d3 r = s + d3
TestLog_ASSERT r = -1, testCompute & " .The result is: " & r TestLog_ASSERT r = -1, testCompute & " .The result is: " & r
testCompute = "s = 'abc', d = 20, r = s & d" testCompute = "s = 'abc', d = 20, r = s & d"
d3 = 20 d3 = 20
r = s & d3 r = s & d3
TestLog_ASSERT r = -1, testCompute & " .The result is: " & r TestLog_ASSERT r = -1, testCompute & " .The result is: " & r
Exit Sub Exit Sub
ErrorHandler: ErrorHandler:
r = -1 r = -1
' TestLog_Comment "The next compute raises error: " & testCompute ' TestLog_Comment "The next compute raises error: " & testCompute
...@@ -111,75 +111,75 @@ Sub SSD() ...@@ -111,75 +111,75 @@ Sub SSD()
Dim testName As String Dim testName As String
testName = "string = string + double" testName = "string = string + double"
Dim testCompute As String Dim testCompute As String
Dim s As String Dim s As String
Dim d As Double Dim d As Double
Dim r As String Dim r As String
On Error GoTo ErrorHandler On Error GoTo ErrorHandler
testCompute = "s = null, d = null, r = s + d" testCompute = "s = null, d = null, r = s + d"
r = s + d r = s + d
TestLog_ASSERT r = "-1", testCompute & " .The result is: " & r TestLog_ASSERT r = "-1", testCompute & " .The result is: " & r
testCompute = "s = null, d = null, r = s & d" testCompute = "s = null, d = null, r = s & d"
r = s & d r = s & d
TestLog_ASSERT r = "0", testCompute & " .The result is: " & r TestLog_ASSERT r = "0", testCompute & " .The result is: " & r
testCompute = "s = null, d = 20, r = s + d" testCompute = "s = null, d = 20, r = s + d"
d = 20 d = 20
r = s + d r = s + d
TestLog_ASSERT r = "-1", testCompute & " .The result is: " & r TestLog_ASSERT r = "-1", testCompute & " .The result is: " & r
testCompute = "s = null, d = 20, r = s & d" testCompute = "s = null, d = 20, r = s & d"
d = 20 d = 20
r = s & d r = s & d
TestLog_ASSERT r = "20", testCompute & " .The result is: " & r TestLog_ASSERT r = "20", testCompute & " .The result is: " & r
'''''''''''''' ''''''''''''''
s = "10" s = "10"
Dim d2 As Double Dim d2 As Double
testCompute = "s = '10', d = null, r = s + d" testCompute = "s = '10', d = null, r = s + d"
r = s + d2 r = s + d2
TestLog_ASSERT r = "10", testCompute & " .The result is: " & r TestLog_ASSERT r = "10", testCompute & " .The result is: " & r
testCompute = "s = '10', d = null, r = s & d" testCompute = "s = '10', d = null, r = s & d"
r = s & d2 r = s & d2
TestLog_ASSERT r = "100", testCompute & " .The result is: " & r TestLog_ASSERT r = "100", testCompute & " .The result is: " & r
testCompute = "s = '10', d = 20, r = s + d" testCompute = "s = '10', d = 20, r = s + d"
d2 = 20 d2 = 20
r = s + d2 r = s + d2
TestLog_ASSERT r = "30", testCompute & " .The result is: " & r TestLog_ASSERT r = "30", testCompute & " .The result is: " & r
testCompute = "s = '10', d = 20, r = s & d" testCompute = "s = '10', d = 20, r = s & d"
d2 = 20 d2 = 20
r = s & d2 r = s & d2
TestLog_ASSERT r = "1020", testCompute & " .The result is: " & r TestLog_ASSERT r = "1020", testCompute & " .The result is: " & r
'''''''''''''' ''''''''''''''
s = "abc" s = "abc"
Dim d3 As Double Dim d3 As Double
testCompute = "s = 'abc', d = null, r = s + d" testCompute = "s = 'abc', d = null, r = s + d"
r = s + d3 r = s + d3
TestLog_ASSERT r = "-1", testCompute & " .The result is: " & r TestLog_ASSERT r = "-1", testCompute & " .The result is: " & r
testCompute = "s = 'abc', d = null, r = s & d" testCompute = "s = 'abc', d = null, r = s & d"
r = s & d3 r = s & d3
TestLog_ASSERT r = "abc0", testCompute & " .The result is: " & r TestLog_ASSERT r = "abc0", testCompute & " .The result is: " & r
testCompute = "s = 'abc', d = 20, r = s + d" testCompute = "s = 'abc', d = 20, r = s + d"
d3 = 20 d3 = 20
r = s + d3 r = s + d3
TestLog_ASSERT r = "-1", testCompute & " .The result is: " & r TestLog_ASSERT r = "-1", testCompute & " .The result is: " & r
testCompute = "s = 'abc', d = 20, r = s & d" testCompute = "s = 'abc', d = 20, r = s & d"
d3 = 20 d3 = 20
r = s & d3 r = s & d3
TestLog_ASSERT r = "abc20", testCompute & " .The result is: " & r TestLog_ASSERT r = "abc20", testCompute & " .The result is: " & r
Exit Sub Exit Sub
ErrorHandler: ErrorHandler:
r = "-1" r = "-1"
' TestLog_Comment "The next compute raises error: " & testCompute ' TestLog_Comment "The next compute raises error: " & testCompute
...@@ -190,75 +190,75 @@ Sub DSS() ...@@ -190,75 +190,75 @@ Sub DSS()
Dim testName As String Dim testName As String
testName = "double = string + string" testName = "double = string + string"
Dim testCompute As String Dim testCompute As String
Dim s As String Dim s As String
Dim d As String Dim d As String
Dim r As Double Dim r As Double
On Error GoTo ErrorHandler On Error GoTo ErrorHandler
testCompute = "s = null, d = null, r = s + d" testCompute = "s = null, d = null, r = s + d"
r = s + d r = s + d
TestLog_ASSERT r = -1, testCompute & " .The result is: " & r TestLog_ASSERT r = -1, testCompute & " .The result is: " & r
testCompute = "s = null, d = null, r = s & d" testCompute = "s = null, d = null, r = s & d"
r = s & d r = s & d
TestLog_ASSERT r = -1, testCompute & " .The result is: " & r TestLog_ASSERT r = -1, testCompute & " .The result is: " & r
testCompute = "s = null, d = 20, r = s + d" testCompute = "s = null, d = 20, r = s + d"
d = "20" d = "20"
r = s + d r = s + d
TestLog_ASSERT r = 20, testCompute & " .The result is: " & r TestLog_ASSERT r = 20, testCompute & " .The result is: " & r
testCompute = "s = null, d = 20, r = s & d" testCompute = "s = null, d = 20, r = s & d"
d = "20" d = "20"
r = s & d r = s & d
TestLog_ASSERT r = 20, testCompute & " .The result is: " & r TestLog_ASSERT r = 20, testCompute & " .The result is: " & r
'''''''''''''' ''''''''''''''
s = "10" s = "10"
Dim d2 As String Dim d2 As String
testCompute = "s = '10', d = null, r = s + d" testCompute = "s = '10', d = null, r = s + d"
r = s + d2 r = s + d2
TestLog_ASSERT r = 10, testCompute & " .The result is: " & r TestLog_ASSERT r = 10, testCompute & " .The result is: " & r
testCompute = "s = '10', d = null, r = s & d" testCompute = "s = '10', d = null, r = s & d"
r = s & d2 r = s & d2
TestLog_ASSERT r = 10, testCompute & " .The result is: " & r TestLog_ASSERT r = 10, testCompute & " .The result is: " & r
testCompute = "s = '10', d = 20, r = s + d" testCompute = "s = '10', d = 20, r = s + d"
d2 = "20" d2 = "20"
r = s + d2 r = s + d2
TestLog_ASSERT r = 1020, testCompute & " .The result is: " & r TestLog_ASSERT r = 1020, testCompute & " .The result is: " & r
testCompute = "s = '10', d = 20, r = s & d" testCompute = "s = '10', d = 20, r = s & d"
d2 = "20" d2 = "20"
r = s & d2 r = s & d2
TestLog_ASSERT r = 1020, testCompute & " .The result is: " & r TestLog_ASSERT r = 1020, testCompute & " .The result is: " & r
'''''''''''''' ''''''''''''''
s = "abc" s = "abc"
Dim d3 As String Dim d3 As String
testCompute = "s = 'abc', d = null, r = s + d" testCompute = "s = 'abc', d = null, r = s + d"
r = s + d3 r = s + d3
TestLog_ASSERT r = -1, testCompute & " .The result is: " & r TestLog_ASSERT r = -1, testCompute & " .The result is: " & r
testCompute = "s = 'abc', d = null, r = s & d" testCompute = "s = 'abc', d = null, r = s & d"
r = s & d3 r = s & d3
TestLog_ASSERT r = -1, testCompute & " .The result is: " & r TestLog_ASSERT r = -1, testCompute & " .The result is: " & r
testCompute = "s = 'abc', d = 20, r = s + d" testCompute = "s = 'abc', d = 20, r = s + d"
d3 = "20" d3 = "20"
r = s + d3 r = s + d3
TestLog_ASSERT r = -1, testCompute & " .The result is: " & r TestLog_ASSERT r = -1, testCompute & " .The result is: " & r
testCompute = "s = 'abc', d = 20, r = s & d" testCompute = "s = 'abc', d = 20, r = s & d"
d3 = "20" d3 = "20"
r = s & d3 r = s & d3
TestLog_ASSERT r = -1, testCompute & " .The result is: " & r TestLog_ASSERT r = -1, testCompute & " .The result is: " & r
Exit Sub Exit Sub
ErrorHandler: ErrorHandler:
r = -1 r = -1
' TestLog_Comment "The next compute raises error: " & testCompute ' TestLog_Comment "The next compute raises error: " & testCompute
...@@ -280,13 +280,13 @@ Sub testBolean() ...@@ -280,13 +280,13 @@ Sub testBolean()
Dim b As Boolean Dim b As Boolean
Dim c As Boolean Dim c As Boolean
Dim d As String Dim d As String
b = True b = True
a = "1" a = "1"
c = a + b ' c = false c = a + b ' c = false
MsgBox c MsgBox c
d = a + b 'd = 0 d = a + b 'd = 0
MsgBox d MsgBox d
End Sub End Sub
...@@ -296,16 +296,16 @@ Sub testCurrency() ...@@ -296,16 +296,16 @@ Sub testCurrency()
Dim b As Currency Dim b As Currency
Dim c As Currency Dim c As Currency
Dim d As String Dim d As String
a = "10" a = "10"
b = 30.3 b = 30.3
c = a + b ' c = 40.3 c = a + b ' c = 40.3
MsgBox c MsgBox c
d = a + b ' c =40.3 d = a + b ' c =40.3
MsgBox d MsgBox d
End Sub End Sub
Sub TestLog_ASSERT(assertion As Boolean, Optional testId As String, Optional testComment As String) Sub TestLog_ASSERT(assertion As Boolean, Optional testId As String, Optional testComment As String)
...@@ -324,5 +324,5 @@ Sub TestLog_ASSERT(assertion As Boolean, Optional testId As String, Optional tes ...@@ -324,5 +324,5 @@ Sub TestLog_ASSERT(assertion As Boolean, Optional testId As String, Optional tes
result = result & Chr$(10) & " Failed: " & testMsg result = result & Chr$(10) & " Failed: " & testMsg
failCount = failCount + 1 failCount = failCount + 1
End If End If
End Sub End Sub
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment