Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
1da0c806
Kaydet (Commit)
1da0c806
authored
Mar 23, 2015
tarafından
Eike Rathke
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
remove trailing blanks rubbish
Change-Id: I97cee7ea1d63375b73f0d4003022e9f09ad38e5f
üst
68495ab3
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
188 additions
and
188 deletions
+188
-188
bytearraystring.vb
basic/qa/vba_tests/bytearraystring.vb
+7
-7
dateserial.vb
basic/qa/vba_tests/dateserial.vb
+4
-4
format.vb
basic/qa/vba_tests/format.vb
+99
-99
ole_ObjAssignNoDflt.vb
basic/qa/vba_tests/ole_ObjAssignNoDflt.vb
+2
-2
partition.vb
basic/qa/vba_tests/partition.vb
+6
-6
replace.vb
basic/qa/vba_tests/replace.vb
+2
-2
strconv.vb
basic/qa/vba_tests/strconv.vb
+11
-11
stringplusdouble.vb
basic/qa/vba_tests/stringplusdouble.vb
+57
-57
No files found.
basic/qa/vba_tests/bytearraystring.vb
Dosyayı görüntüle @
1da0c806
...
...
@@ -30,24 +30,24 @@ Function verify_ByteArrayString() As String
Dim
x
()
As
Byte
Dim
count
As
Integer
testName
=
"Test the conversion between bytearray and string"
On
Error
GoTo
errorHandler
MyString
=
"abc"
x
=
MyString
' string -> byte array
result
=
"Test Results"
&
Chr
$
(
10
)
&
"============"
&
Chr
$
(
10
)
count
=
UBound
(
x
)
' 6 byte
' test bytes in string
result
=
result
+
updateResultString
(
"test1 numbytes "
,
(
count
),
5
)
MyString
=
x
'byte array -> string
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
)
verify_ByteArrayString
=
result
Exit
Function
...
...
basic/qa/vba_tests/dateserial.vb
Dosyayı görüntüle @
1da0c806
...
...
@@ -26,9 +26,9 @@ Function verify_testDateSerial() as String
testName
=
"Test DateSerial function"
date2
=
36326
On
Error
GoTo
errorHandler
date1
=
DateSerial
(
1999
,
6
,
15
)
'6/15/1999
TestLog_ASSERT
date1
=
date2
,
"the return date is: "
&
date1
date1
=
DateSerial
(
2000
,
1
-
7
,
15
)
'6/15/1999
...
...
@@ -36,7 +36,7 @@ Function verify_testDateSerial() as String
date1
=
DateSerial
(
1999
,
1
,
166
)
'6/15/1999
TestLog_ASSERT
date1
=
date2
,
"the return date is: "
&
date1
result
=
result
&
Chr
$
(
10
)
&
"Tests passed: "
&
passCount
&
Chr
$
(
10
)
&
"Tests failed: "
&
failCount
&
Chr
$
(
10
)
verify_testDateSerial
=
result
Exit
Function
...
...
@@ -60,6 +60,6 @@ Sub TestLog_ASSERT(assertion As Boolean, Optional testId As String, Optional tes
result
=
result
&
Chr
$
(
10
)
&
" Failed: "
&
testMsg
failCount
=
failCount
+
1
End
If
End
Sub
basic/qa/vba_tests/format.vb
Dosyayı görüntüle @
1da0c806
...
...
@@ -19,7 +19,7 @@ Function verify_format() as String
failCount
=
0
result
=
"Test Results"
&
Chr
$
(
10
)
&
"============"
&
Chr
$
(
10
)
'Predefined_Datetime_Format_Sample
Predefined_Number_Format_Sample
'Custom_Datetime_Format_Sample
...
...
@@ -27,7 +27,7 @@ Function verify_format() as String
Custom_Text_Format_Sample
result
=
result
&
Chr
$
(
10
)
&
"Tests passed: "
&
passCount
&
Chr
$
(
10
)
&
"Tests failed: "
&
failCount
&
Chr
$
(
10
)
verify_format
=
result
End
Sub
...
...
@@ -37,38 +37,38 @@ Sub Predefined_Datetime_Format_Sample()
myDate
=
"01/06/98"
MyTime
=
"17:08:06"
testName
=
"Test Predefined_Datetime_Format_Sample function"
On
Error
GoTo
errorHandler
' 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
TestLog_ASSERT
IsDate
(
TestStr
),
"General Date: "
&
TestStr
&
" (Test only applies to en_US locale)"
'TestLog_ASSERT TestStr = "1/6/98", "General Date: " & TestStr
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 IsDate(TestStr), "Long Date: " & TestStr
TestStr
=
Format
(
myDate
,
"Medium Date"
)
' 06-Jan-98
'TestLog_ASSERT TestStr = "06-Jan-98", "Medium Date: " & TestStr
TestLog_ASSERT
IsDate
(
TestStr
),
"Medium Date: "
&
TestStr
&
" (Test only applies to en_US locale)"
TestStr
=
Format
(
myDate
,
"Short Date"
)
' 1/6/98
'TestLog_ASSERT TestStr = "1/6/98", "Short Date: " & TestStr
TestLog_ASSERT
IsDate
(
TestStr
),
"Short Date: "
&
TestStr
&
" (Test only applies to en_US locale)"
TestStr
=
Format
(
MyTime
,
"Long Time"
)
' 5:08:06 PM
'TestLog_ASSERT TestStr = "5:08:06 PM", "Long Time: " & TestStr
TestLog_ASSERT
IsDate
(
TestStr
),
"Long Time: "
&
TestStr
&
" (Test only applies to en_US locale)"
TestStr
=
Format
(
MyTime
,
"Medium Time"
)
' 05:08 PM
'TestLog_ASSERT TestStr = "05:08 PM", "Medium Time: " & TestStr
TestLog_ASSERT
IsDate
(
TestStr
),
"Medium Time: "
&
TestStr
&
" (Test only applies to en_US locale)"
TestStr
=
Format
(
MyTime
,
"Short Time"
)
' 17:08
'TestLog_ASSERT TestStr = "17:08", "Short Time: " & TestStr
TestLog_ASSERT
IsDate
(
TestStr
),
"Short Time: "
&
TestStr
&
" (Test only applies to en_US locale)"
...
...
@@ -82,172 +82,172 @@ Sub Predefined_Number_Format_Sample()
Dim
testName
As
String
testName
=
"Test Predefined_Number_Format_Sample function"
myNumber
=
562486.2356
On
Error
GoTo
errorHandler
TestStr
=
Format
(
myNumber
,
"General Number"
)
'562486.2356
TestLog_ASSERT
TestStr
=
"562486.2356"
,
"General Number: "
&
TestStr
'MsgBox TestStr
TestStr
=
Format
(
0.2
,
"Fixed"
)
'0.20
TestLog_ASSERT
TestStr
=
"0.20"
,
"Fixed: "
&
TestStr
'MsgBox TestStr
TestStr
=
Format
(
myNumber
,
"Standard"
)
'562,486.24
TestLog_ASSERT
TestStr
=
"562,486.24"
,
"Standard: "
&
TestStr
'MsgBox TestStr
TestStr
=
Format
(
0.7521
,
"Percent"
)
'75.21%
TestLog_ASSERT
TestStr
=
"75.21%"
,
"Percent: "
&
TestStr
'MsgBox TestStr
TestStr
=
Format
(
myNumber
,
"Scientific"
)
'5.62E+05
TestLog_ASSERT
TestStr
=
"5.62E+05"
,
"Scientific: "
&
TestStr
'MsgBox TestStr
TestStr
=
Format
(
-
3456.789
,
"Scientific"
)
'-3.46E+03
TestLog_ASSERT
TestStr
=
"-3.46E+03"
,
"Scientific: "
&
TestStr
'MsgBox TestStr
TestStr
=
Format
(
0
,
"Yes/No"
)
'No
TestLog_ASSERT
TestStr
=
"No"
,
"Yes/No: "
&
TestStr
'MsgBox TestStr
TestStr
=
Format
(
23
,
"Yes/No"
)
'Yes
TestLog_ASSERT
TestStr
=
"Yes"
,
"Yes/No: "
&
TestStr
'MsgBox TestStr
TestStr
=
Format
(
0
,
"True/False"
)
'False
TestLog_ASSERT
TestStr
=
"False"
,
"True/False: "
&
TestStr
'MsgBox TestStr
TestStr
=
Format
(
23
,
"True/False"
)
'True
TestLog_ASSERT
TestStr
=
"True"
,
"True/False: "
&
TestStr
'MsgBox TestStr
TestStr
=
Format
(
0
,
"On/Off"
)
'Off
TestLog_ASSERT
TestStr
=
"Off"
,
"On/Off: "
&
TestStr
'MsgBox TestStr
TestStr
=
Format
(
23
,
"On/Off"
)
'On
TestLog_ASSERT
TestStr
=
"On"
,
"On/Off: "
&
TestStr
'MsgBox TestStr
Exit
Sub
errorHandler
:
TestLog_ASSERT
(
false
),
testName
&
": hit error handler"
End
Sub
Sub
Custom_Datetime_Format_Sample
()
Dim
myDate
,
MyTime
,
TestStr
As
String
Dim
testName
As
String
myDate
=
"01/06/98"
MyTime
=
"05:08:06"
testName
=
"Test Custom_Datetime_Format_Sample function"
On
Error
GoTo
errorHandler
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)"
'MsgBox TestStr
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)"
'MsgBox TestStr
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)"
'MsgBox TestStr
TestStr
=
Format
(
myDate
,
"d"
)
' 6
TestLog_ASSERT
TestStr
=
"6"
,
"d: "
&
TestStr
&
" (Test only applies to en_US locale)"
'MsgBox TestStr
TestStr
=
Format
(
myDate
,
"dd"
)
' 06
TestLog_ASSERT
TestStr
=
"06"
,
"dd: "
&
TestStr
&
" (Test only applies to en_US locale)"
'MsgBox TestStr
TestStr
=
Format
(
myDate
,
"ddd"
)
' Tue
TestLog_ASSERT
TestStr
=
"Tue"
,
"ddd: "
&
TestStr
&
" (Test only applies to en_US locale)"
'MsgBox TestStr
TestStr
=
Format
(
myDate
,
"dddd"
)
' Tuesday
TestLog_ASSERT
TestStr
=
"Tuesday"
,
"dddd: "
&
TestStr
&
" (Test only applies to en_US locale)"
'MsgBox TestStr
TestStr
=
Format
(
MyTime
,
"h"
)
' 5
TestLog_ASSERT
TestStr
=
"5"
,
"h: "
&
TestStr
&
" (Test only applies to en_US locale)"
'MsgBox TestStr
TestStr
=
Format
(
MyTime
,
"hh"
)
' 05
TestLog_ASSERT
TestStr
=
"05"
,
"hh: "
&
TestStr
&
" (Test only applies to en_US locale)"
'MsgBox TestStr
TestStr
=
Format
(
MyTime
,
"n"
)
' 8
TestLog_ASSERT
TestStr
=
"8"
,
"n: "
&
TestStr
&
" (Test only applies to en_US locale)"
'MsgBox TestStr
TestStr
=
Format
(
MyTime
,
"nn"
)
' 08
TestLog_ASSERT
TestStr
=
"08"
,
"nn: "
&
TestStr
&
" (Test only applies to en_US locale)"
'MsgBox TestStr
TestStr
=
Format
(
myDate
,
"m"
)
' 1
TestLog_ASSERT
TestStr
=
"1"
,
"m: "
&
TestStr
&
" (Test only applies to en_US locale)"
'MsgBox TestStr
TestStr
=
Format
(
myDate
,
"mm"
)
' 01
TestLog_ASSERT
TestStr
=
"01"
,
"mm: "
&
TestStr
&
" (Test only applies to en_US locale)"
'MsgBox TestStr
TestStr
=
Format
(
myDate
,
"mmm"
)
' Jan
TestLog_ASSERT
TestStr
=
"Jan"
,
"mmm: "
&
TestStr
&
" (Test only applies to en_US locale)"
'MsgBox TestStr
TestStr
=
Format
(
myDate
,
"mmmm"
)
' January
TestLog_ASSERT
TestStr
=
"January"
,
"mmmm: "
&
TestStr
&
" (Test only applies to en_US locale)"
'MsgBox TestStr
TestStr
=
Format
(
MyTime
,
"s"
)
' 6
TestLog_ASSERT
TestStr
=
"6"
,
"s: "
&
TestStr
&
" (Test only applies to en_US locale)"
'MsgBox TestStr
TestStr
=
Format
(
MyTime
,
"ss"
)
' 06
TestLog_ASSERT
TestStr
=
"06"
,
"ss: "
&
TestStr
&
" (Test only applies to en_US locale)"
'MsgBox TestStr
MyTime
=
"17:08:06"
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)"
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)"
'MsgBox TestStr
TestStr
=
Format
(
myDate
,
"ww"
)
' 2
TestLog_ASSERT
TestStr
=
"2"
,
"ww: "
&
TestStr
&
" (Test only applies to en_US locale)"
'MsgBox TestStr
TestStr
=
Format
(
myDate
,
"w"
)
' 3
TestLog_ASSERT
TestStr
=
"3"
,
"w: "
&
TestStr
&
" (Test only applies to en_US locale)"
'MsgBox TestStr
TestStr
=
Format
(
myDate
,
"y"
)
' 6
TestLog_ASSERT
TestStr
=
"6"
,
"y: "
&
TestStr
&
" (Test only applies to en_US locale)"
'MsgBox TestStr
TestStr
=
Format
(
myDate
,
"yy"
)
' 98
TestLog_ASSERT
TestStr
=
"98"
,
"yy: "
&
TestStr
&
" (Test only applies to en_US locale)"
'MsgBox TestStr
TestStr
=
Format
(
myDate
,
"yyyy"
)
' 1998
TestLog_ASSERT
TestStr
=
"1998"
,
"yyyy: "
&
TestStr
&
" (Test only applies to en_US locale)"
'MsgBox TestStr
Exit
Sub
errorHandler
:
TestLog_ASSERT
(
false
),
testName
&
": hit error handler"
...
...
@@ -256,98 +256,98 @@ End Sub
Sub
Custom_Number_Format_Sample
()
Dim
TestStr
As
String
Dim
testName
As
String
testName
=
"Test Custom_Number_Format_Sample function"
On
Error
GoTo
errorHandler
TestStr
=
Format
(
23.675
,
"00.0000"
)
' 23.6750
TestLog_ASSERT
TestStr
=
"23.6750"
,
"00.0000: "
&
TestStr
'MsgBox TestStr
TestStr
=
Format
(
23.675
,
"00.00"
)
' 23.68
TestLog_ASSERT
TestStr
=
"23.68"
,
"00.00: "
&
TestStr
'MsgBox TestStr
TestStr
=
Format
(
2658
,
"00000"
)
' 02658
TestLog_ASSERT
TestStr
=
"02658"
,
"00000: "
&
TestStr
'MsgBox TestStr
TestStr
=
Format
(
2658
,
"00.00"
)
' 2658.00
TestLog_ASSERT
TestStr
=
"2658.00"
,
"00.00: "
&
TestStr
'MsgBox TestStr
TestStr
=
Format
(
23.675
,
"##.####"
)
' 23.675
TestLog_ASSERT
TestStr
=
"23.675"
,
"##.####: "
&
TestStr
'MsgBox TestStr
TestStr
=
Format
(
23.675
,
"##.##"
)
' 23.68
TestLog_ASSERT
TestStr
=
"23.68"
,
"##.##: "
&
TestStr
'MsgBox TestStr
TestStr
=
Format
(
12345.25
,
"#,###.##"
)
'12,345.25
TestLog_ASSERT
TestStr
=
"12,345.25"
,
"#,###.##: "
&
TestStr
'MsgBox TestStr
TestStr
=
Format
(
0.25
,
"##.00%"
)
'25.00%
TestLog_ASSERT
TestStr
=
"25.00%"
,
"##.00%: "
&
TestStr
'MsgBox TestStr
TestStr
=
Format
(
1000000
,
"#,###"
)
'1,000,000
TestLog_ASSERT
TestStr
=
"1,000,000"
,
"#,###: "
&
TestStr
'MsgBox TestStr
TestStr
=
Format
(
1.09837555
,
"#.#####E+###"
)
'1.09838E+000
TestLog_ASSERT
TestStr
=
"1.09838E+000"
,
"#.#####E+###: "
&
TestStr
'MsgBox TestStr
TestStr
=
Format
(
1.09837555
,
"###.####E#"
)
'1.0984E0 with engineering notation
TestLog_ASSERT
TestStr
=
"1.0984E0"
,
"###.####E#: "
&
TestStr
'MsgBox TestStr
TestStr
=
Format
(
1098.37555
,
"###.####E#"
)
'1.0984E3 with engineering notation
TestLog_ASSERT
TestStr
=
"1.0984E3"
,
"###.####E#: "
&
TestStr
'MsgBox TestStr
TestStr
=
Format
(
1098375.55
,
"###.####E#"
)
'1.0984E6 with engineering notation
TestLog_ASSERT
TestStr
=
"1.0984E6"
,
"###.####E#: "
&
TestStr
'MsgBox TestStr
TestStr
=
Format
(
1.09837555
,
"######E#"
)
'1E0 with engineering notation
TestLog_ASSERT
TestStr
=
"1E0"
,
"######E#: "
&
TestStr
'MsgBox TestStr
TestStr
=
Format
(
123456.789
,
"###E0"
)
'123E3 with engineering notation
TestLog_ASSERT
TestStr
=
"123E3"
,
"###E0: "
&
TestStr
'MsgBox TestStr
TestStr
=
Format
(
123567.89
,
"###E0"
)
'124E3 with engineering notation
TestLog_ASSERT
TestStr
=
"124E3"
,
"###E0: "
&
TestStr
'MsgBox TestStr
TestStr
=
Format
(
12
,
"###E0"
)
'12E0 with engineering notation
TestLog_ASSERT
TestStr
=
"12E0"
,
"###E0: "
&
TestStr
'MsgBox TestStr
TestStr
=
Format
(
12
,
"000E0"
)
'012E0 with engineering notation
TestLog_ASSERT
TestStr
=
"012E0"
,
"000E0: "
&
TestStr
'MsgBox TestStr
TestStr
=
Format
(
0.12345
,
"###E0"
)
'123E-3 with engineering notation
TestLog_ASSERT
TestStr
=
"123E-3"
,
"###E0: "
&
TestStr
'MsgBox TestStr
TestStr
=
Format
(
123456
,
"####E0"
)
'12E4 with interval-4 notation
TestLog_ASSERT
TestStr
=
"12E4"
,
"####E0: "
&
TestStr
'MsgBox TestStr
TestStr
=
Format
(
2345.25
,
"$#,###.##"
)
'$2.345.25
TestLog_ASSERT
TestStr
=
"$2,345.25"
,
"$#,###.##: "
&
TestStr
'MsgBox TestStr
TestStr
=
Format
(
0.25
,
"##.###\%"
)
'.25%
TestLog_ASSERT
TestStr
=
".25%"
,
"##.###\%: "
&
TestStr
'MsgBox TestStr
Exit
Sub
errorHandler
:
TestLog_ASSERT
(
false
),
testName
&
": hit error handler"
...
...
@@ -356,20 +356,20 @@ End Sub
Sub
Custom_Text_Format_Sample
()
Dim
myText
,
TestStr
As
String
myText
=
"VBA"
Dim
testName
As
String
testName
=
"Test Custom_Text_Format_Sample function"
On
Error
GoTo
errorHandler
TestStr
=
Format
(
myText
,
"<"
)
'vba
TestLog_ASSERT
TestStr
=
"vba"
,
"<: "
&
TestStr
'MsgBox TestStr
TestStr
=
Format
(
"vba"
,
">"
)
'VBA
TestLog_ASSERT
TestStr
=
"VBA"
,
">: "
&
TestStr
'MsgBox TestStr
Exit
Sub
errorHandler
:
TestLog_ASSERT
(
false
),
testName
&
"hit error handler"
...
...
@@ -382,41 +382,41 @@ Sub testFormat()
Dim
TestDateTime
As
Date
Dim
TestStr
As
String
testName
=
"Test Format function"
On
Error
GoTo
errorHandler
TestDateTime
=
"1/27/2001 5:04:23 PM"
' Returns the value of TestDateTime in user-defined date/time formats.
' Returns "17:4:23".
TestStr
=
Format
(
TestDateTime
,
"h:m:s"
)
TestLog_ASSERT
TestStr
=
"17:4:23"
,
"the format of h:m:s: "
&
TestStr
' Returns "05:04:23 PM".
TestStr
=
Format
(
TestDateTime
,
"ttttt"
)
TestLog_ASSERT
TestStr
=
"5:04:23 PM"
,
"the format of ttttt: "
&
TestStr
' Returns "Saturday, Jan 27 2001".
TestStr
=
Format
(
TestDateTime
,
"dddd, MMM d yyyy"
)
TestLog_ASSERT
TestStr
=
"Saturday, Jan 27 2001"
,
"the format of dddd, MMM d yyyy: "
&
TestStr
' Returns "17:04:23".
TestStr
=
Format
(
TestDateTime
,
"HH:mm:ss"
)
TestLog_ASSERT
TestStr
=
"17:04:23"
,
"the format of HH:mm:ss: "
&
TestStr
' Returns "23".
TestStr
=
Format
(
23
)
TestLog_ASSERT
TestStr
=
"23"
,
"no format:"
&
TestStr
' User-defined numeric formats.
' Returns "5,459.40".
TestStr
=
Format
(
5459.4
,
"##,##0.00"
)
TestLog_ASSERT
TestStr
=
"5,459.40"
,
"the format of ##,##0.00: "
&
TestStr
' Returns "334.90".
TestStr
=
Format
(
334.9
,
"###0.00"
)
TestLog_ASSERT
TestStr
=
"334.90"
,
"the format of ###0.00: "
&
TestStr
' Returns "500.00%".
TestStr
=
Format
(
5
,
"0.00%"
)
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
result
=
result
&
Chr
$
(
10
)
&
" Failed: "
&
testMsg
failCount
=
failCount
+
1
End
If
End
Sub
basic/qa/vba_tests/ole_ObjAssignNoDflt.vb
Dosyayı görüntüle @
1da0c806
...
...
@@ -17,13 +17,13 @@ objCmd.ActiveConnection = cn
If
objCmd
.
ActiveConnection
.
CommandTimeout
<>
modifiedTimeout
Then
Rem if we copied the object by reference then we should have the
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
End
If
cn
.
CommandTimeout
=
origTimeout
' restore timeout
Rem Double check objCmd.ActiveConnection is pointing to objCmd.ActiveConnection
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
End
If
doUnitTest
=
"OK"
' no error
...
...
basic/qa/vba_tests/partition.vb
Dosyayı görüntüle @
1da0c806
...
...
@@ -24,23 +24,23 @@ Function verify_testPartition() as String
Dim
retStr
As
String
testName
=
"Test Partition function"
On
Error
GoTo
errorHandler
retStr
=
Partition
(
20
,
0
,
98
,
5
)
'MsgBox retStr
TestLog_ASSERT
retStr
=
"20:24"
,
"the number 20 occurs in the range:"
&
retStr
retStr
=
Partition
(
20
,
0
,
99
,
1
)
'MsgBox retStr
TestLog_ASSERT
retStr
=
" 20: 20"
,
"the number 20 occurs in the range:"
&
retStr
retStr
=
Partition
(
120
,
0
,
99
,
5
)
'MsgBox retStr
TestLog_ASSERT
retStr
=
"100: "
,
"the number 120 occurs in the range:"
&
retStr
retStr
=
Partition
(
-
5
,
0
,
99
,
5
)
'MsgBox retStr
TestLog_ASSERT
retStr
=
" : -1"
,
"the number -5 occurs in the range:"
&
retStr
retStr
=
Partition
(
2
,
0
,
5
,
2
)
'MsgBox 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
result
=
result
&
Chr
$
(
10
)
&
" Failed: "
&
testMsg
failCount
=
failCount
+
1
End
If
End
Sub
basic/qa/vba_tests/replace.vb
Dosyayı görüntüle @
1da0c806
...
...
@@ -44,7 +44,7 @@ Function verify_testReplace() as String
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
)
verify_testReplace
=
result
Exit
Function
errorHandler
:
TestLog_ASSERT
(
False
),
testName
&
": hit error handler"
...
...
@@ -66,5 +66,5 @@ Sub TestLog_ASSERT(assertion As Boolean, Optional testId As String, Optional tes
result
=
result
&
Chr
$
(
10
)
&
" Failed: "
&
testMsg
failCount
=
failCount
+
1
End
If
End
Sub
basic/qa/vba_tests/strconv.vb
Dosyayı görüntüle @
1da0c806
...
...
@@ -25,43 +25,43 @@ Function verify_testStrConv() as String
srcStr
=
"abc EFG hij"
testName
=
"Test StrConv function"
On
Error
GoTo
errorHandler
retStr
=
StrConv
(
srcStr
,
vbUpperCase
)
'MsgBox retStr
TestLog_ASSERT
retStr
=
"ABC EFG HIJ"
,
"Converts the string to uppercase characters:"
&
retStr
retStr
=
StrConv
(
srcStr
,
vbLowerCase
)
'MsgBox retStr
TestLog_ASSERT
retStr
=
"abc efg hij"
,
"Converts the string to lowercase characters:"
&
retStr
retStr
=
StrConv
(
srcStr
,
vbProperCase
)
'MsgBox retStr
TestLog_ASSERT
retStr
=
"Abc Efg Hij"
,
"Converts the first letter of every word in string to uppercase:"
&
retStr
'retStr = StrConv("ABCDEVB¥ì¥¹¥¥å©`", vbWide)
'MsgBox retStr
'TestLog_ASSERT retStr = "£Á£Â£Ã£Ä£ÅVB¥ì¥¹¥¥å©`", "Converts narrow (single-byte) characters in string to wide"
'retStr = StrConv("£Á£Â£Ã£Ä£ÅVB¥ì¥¹¥¥å©`", vbNarrow)
'MsgBox retStr
'TestLog_ASSERT retStr = "ABCDEVB¥ì¥¹¥¥å©`", "Converts wide (double-byte) characters in string to narrow (single-byte) characters." & retStr
'retStr = StrConv("¤Ï¤Ê¤Á¤ã¤ó", vbKatakana)
'MsgBox retStr
'TestLog_ASSERT retStr = "¥Ï¥Ê¥Á¥ã¥ó", "Converts Hiragana characters in string to Katakana characters.." & retStr
' retStr = StrConv("¥Ï¥Ê¥Á¥ã¥ó", vbHiragana)
'MsgBox retStr
' TestLog_ASSERT retStr = "¤Ï¤Ê¤Á¤ã¤ó", "Converts Katakana characters in string to Hiragana characters.." & retStr
'x = StrConv("ÉϺ£ÊÐABC", vbFromUnicode)
'MsgBox retStr
'TestLog_ASSERT UBound(x) = 8, "Converts the string from Unicode, the length is : " & UBound(x) + 1
' retStr = StrConv(x, vbUnicode)
'MsgBox 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
)
verify_testStrConv
=
result
...
...
@@ -86,5 +86,5 @@ Sub TestLog_ASSERT(assertion As Boolean, Optional testId As String, Optional tes
result
=
result
&
Chr
$
(
10
)
&
" Failed: "
&
testMsg
failCount
=
failCount
+
1
End
If
End
Sub
basic/qa/vba_tests/stringplusdouble.vb
Dosyayı görüntüle @
1da0c806
...
...
@@ -30,76 +30,76 @@ Sub DSD()
Dim
testName
As
String
testName
=
"double = string + double"
Dim
testCompute
As
String
Dim
s
As
String
Dim
d
As
Double
Dim
r
As
Double
On
Error
GoTo
ErrorHandler
testCompute
=
"s = null, d = null, r = s + d"
r
=
s
+
d
TestLog_ASSERT
r
=
-
1
,
testCompute
&
" .The result is: "
&
r
testCompute
=
"s = null, d = null, r = s & d"
r
=
s
&
d
TestLog_ASSERT
r
=
0
,
testCompute
&
" .The result is: "
&
r
testCompute
=
"s = null, d = 20, r = s + d"
d
=
20
r
=
s
+
d
TestLog_ASSERT
r
=
-
1
,
testCompute
&
" .The result is: "
&
r
testCompute
=
"s = null, d = 20, r = s & d"
d
=
20
r
=
s
&
d
TestLog_ASSERT
r
=
20
,
testCompute
&
" .The result is: "
&
r
''''''''''''''
s
=
"10"
Dim
d2
As
Double
testCompute
=
"s = '10', d = null, r = s + d"
r
=
s
+
d2
TestLog_ASSERT
r
=
10
,
testCompute
&
" .The result is: "
&
r
testCompute
=
"s = '10', d = null, r = s & d"
r
=
s
&
d2
TestLog_ASSERT
r
=
100
,
testCompute
&
" .The result is: "
&
r
testCompute
=
"s = '10', d = 20, r = s + d"
d2
=
20
r
=
s
+
d2
TestLog_ASSERT
r
=
30
,
testCompute
&
" .The result is: "
&
r
testCompute
=
"s = '10', d = 20, r = s & d"
d2
=
20
r
=
s
&
d2
TestLog_ASSERT
r
=
1020
,
testCompute
&
" .The result is: "
&
r
''''''''''''''
s
=
"abc"
Dim
d3
As
Double
testCompute
=
"s = 'abc', d = null, r = s + d"
r
=
s
+
d3
TestLog_ASSERT
r
=
-
1
,
testCompute
&
" .The result is: "
&
r
testCompute
=
"s = 'abc', d = null, r = s & d"
r
=
s
&
d3
TestLog_ASSERT
r
=
-
1
,
testCompute
&
" .The result is: "
&
r
testCompute
=
"s = 'abc', d = 20, r = s + d"
d3
=
20
r
=
s
+
d3
TestLog_ASSERT
r
=
-
1
,
testCompute
&
" .The result is: "
&
r
testCompute
=
"s = 'abc', d = 20, r = s & d"
d3
=
20
r
=
s
&
d3
TestLog_ASSERT
r
=
-
1
,
testCompute
&
" .The result is: "
&
r
Exit
Sub
ErrorHandler
:
r
=
-
1
' TestLog_Comment "The next compute raises error: " & testCompute
...
...
@@ -111,75 +111,75 @@ Sub SSD()
Dim
testName
As
String
testName
=
"string = string + double"
Dim
testCompute
As
String
Dim
s
As
String
Dim
d
As
Double
Dim
r
As
String
On
Error
GoTo
ErrorHandler
testCompute
=
"s = null, d = null, r = s + d"
r
=
s
+
d
TestLog_ASSERT
r
=
"-1"
,
testCompute
&
" .The result is: "
&
r
testCompute
=
"s = null, d = null, r = s & d"
r
=
s
&
d
TestLog_ASSERT
r
=
"0"
,
testCompute
&
" .The result is: "
&
r
testCompute
=
"s = null, d = 20, r = s + d"
d
=
20
r
=
s
+
d
TestLog_ASSERT
r
=
"-1"
,
testCompute
&
" .The result is: "
&
r
testCompute
=
"s = null, d = 20, r = s & d"
d
=
20
r
=
s
&
d
TestLog_ASSERT
r
=
"20"
,
testCompute
&
" .The result is: "
&
r
''''''''''''''
s
=
"10"
Dim
d2
As
Double
testCompute
=
"s = '10', d = null, r = s + d"
r
=
s
+
d2
TestLog_ASSERT
r
=
"10"
,
testCompute
&
" .The result is: "
&
r
testCompute
=
"s = '10', d = null, r = s & d"
r
=
s
&
d2
TestLog_ASSERT
r
=
"100"
,
testCompute
&
" .The result is: "
&
r
testCompute
=
"s = '10', d = 20, r = s + d"
d2
=
20
r
=
s
+
d2
TestLog_ASSERT
r
=
"30"
,
testCompute
&
" .The result is: "
&
r
testCompute
=
"s = '10', d = 20, r = s & d"
d2
=
20
r
=
s
&
d2
TestLog_ASSERT
r
=
"1020"
,
testCompute
&
" .The result is: "
&
r
''''''''''''''
s
=
"abc"
Dim
d3
As
Double
testCompute
=
"s = 'abc', d = null, r = s + d"
r
=
s
+
d3
TestLog_ASSERT
r
=
"-1"
,
testCompute
&
" .The result is: "
&
r
testCompute
=
"s = 'abc', d = null, r = s & d"
r
=
s
&
d3
TestLog_ASSERT
r
=
"abc0"
,
testCompute
&
" .The result is: "
&
r
testCompute
=
"s = 'abc', d = 20, r = s + d"
d3
=
20
r
=
s
+
d3
TestLog_ASSERT
r
=
"-1"
,
testCompute
&
" .The result is: "
&
r
testCompute
=
"s = 'abc', d = 20, r = s & d"
d3
=
20
r
=
s
&
d3
TestLog_ASSERT
r
=
"abc20"
,
testCompute
&
" .The result is: "
&
r
Exit
Sub
ErrorHandler
:
r
=
"-1"
' TestLog_Comment "The next compute raises error: " & testCompute
...
...
@@ -190,75 +190,75 @@ Sub DSS()
Dim
testName
As
String
testName
=
"double = string + string"
Dim
testCompute
As
String
Dim
s
As
String
Dim
d
As
String
Dim
r
As
Double
On
Error
GoTo
ErrorHandler
testCompute
=
"s = null, d = null, r = s + d"
r
=
s
+
d
TestLog_ASSERT
r
=
-
1
,
testCompute
&
" .The result is: "
&
r
testCompute
=
"s = null, d = null, r = s & d"
r
=
s
&
d
TestLog_ASSERT
r
=
-
1
,
testCompute
&
" .The result is: "
&
r
testCompute
=
"s = null, d = 20, r = s + d"
d
=
"20"
r
=
s
+
d
TestLog_ASSERT
r
=
20
,
testCompute
&
" .The result is: "
&
r
testCompute
=
"s = null, d = 20, r = s & d"
d
=
"20"
r
=
s
&
d
TestLog_ASSERT
r
=
20
,
testCompute
&
" .The result is: "
&
r
''''''''''''''
s
=
"10"
Dim
d2
As
String
testCompute
=
"s = '10', d = null, r = s + d"
r
=
s
+
d2
TestLog_ASSERT
r
=
10
,
testCompute
&
" .The result is: "
&
r
testCompute
=
"s = '10', d = null, r = s & d"
r
=
s
&
d2
TestLog_ASSERT
r
=
10
,
testCompute
&
" .The result is: "
&
r
testCompute
=
"s = '10', d = 20, r = s + d"
d2
=
"20"
r
=
s
+
d2
TestLog_ASSERT
r
=
1020
,
testCompute
&
" .The result is: "
&
r
testCompute
=
"s = '10', d = 20, r = s & d"
d2
=
"20"
r
=
s
&
d2
TestLog_ASSERT
r
=
1020
,
testCompute
&
" .The result is: "
&
r
''''''''''''''
s
=
"abc"
Dim
d3
As
String
testCompute
=
"s = 'abc', d = null, r = s + d"
r
=
s
+
d3
TestLog_ASSERT
r
=
-
1
,
testCompute
&
" .The result is: "
&
r
testCompute
=
"s = 'abc', d = null, r = s & d"
r
=
s
&
d3
TestLog_ASSERT
r
=
-
1
,
testCompute
&
" .The result is: "
&
r
testCompute
=
"s = 'abc', d = 20, r = s + d"
d3
=
"20"
r
=
s
+
d3
TestLog_ASSERT
r
=
-
1
,
testCompute
&
" .The result is: "
&
r
testCompute
=
"s = 'abc', d = 20, r = s & d"
d3
=
"20"
r
=
s
&
d3
TestLog_ASSERT
r
=
-
1
,
testCompute
&
" .The result is: "
&
r
Exit
Sub
ErrorHandler
:
r
=
-
1
' TestLog_Comment "The next compute raises error: " & testCompute
...
...
@@ -280,13 +280,13 @@ Sub testBolean()
Dim
b
As
Boolean
Dim
c
As
Boolean
Dim
d
As
String
b
=
True
a
=
"1"
c
=
a
+
b
' c = false
MsgBox
c
d
=
a
+
b
'd = 0
MsgBox
d
End
Sub
...
...
@@ -296,16 +296,16 @@ Sub testCurrency()
Dim
b
As
Currency
Dim
c
As
Currency
Dim
d
As
String
a
=
"10"
b
=
30.3
c
=
a
+
b
' c = 40.3
MsgBox
c
d
=
a
+
b
' c =40.3
MsgBox
d
End
Sub
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
result
=
result
&
Chr
$
(
10
)
&
" Failed: "
&
testMsg
failCount
=
failCount
+
1
End
If
End
Sub
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment