1 | '--------------------------------------------------------------------
|
---|
2 | ' Test case of SPrintF Function and etc...
|
---|
3 | '--------------------------------------------------------------------
|
---|
4 |
|
---|
5 | #require <Classes/ActiveBasic/Strings/SPrintF.ab>
|
---|
6 |
|
---|
7 | Imports ActiveBasic.Strings
|
---|
8 | Imports ActiveBasic.Strings.Detail
|
---|
9 |
|
---|
10 | Namespace SPrintFTest
|
---|
11 |
|
---|
12 | Sub TestMain()
|
---|
13 | Dim s = Nothing As String, e As Long, sign As Boolean
|
---|
14 |
|
---|
15 | s = FloatToChars(1., e, sign)
|
---|
16 | UnitTest("FloatToChars(1)", s = "10000000000000000" And e = 0 And sign = False)
|
---|
17 |
|
---|
18 | s = FloatToChars(-93.75e-3, e, sign)
|
---|
19 | UnitTest("FloatToChars(-93.75e-3)", s = "93750000000000000" And e = 1 - 3 And sign = True)
|
---|
20 |
|
---|
21 | s = FloatToChars(.0, e, sign)
|
---|
22 | UnitTest("FloatToChars(0)", s = "00000000000000000" And e = 0 And sign = False)
|
---|
23 |
|
---|
24 | s = FormatFloatE(9.876543e021, 6, 0, None)
|
---|
25 | UnitTest("FormatFloatE(9876543e021)", s = "9.876543e021")
|
---|
26 |
|
---|
27 | s = FormatFloatE(7.81250000E-003, 8, 0, Cap)
|
---|
28 | UnitTest("FormatFloatE(7.81250000E-003)", s = "7.81250000E-003")
|
---|
29 | /*
|
---|
30 | 上は、現在s = 7.81250000E-03となり失敗する。
|
---|
31 | FormatIntegerDを作成していないことが要因。
|
---|
32 | */
|
---|
33 |
|
---|
34 | s = FormatIntegerU(777, 0, 0, None)
|
---|
35 | UnitTest("FormatIntegerU(777)", s = "777")
|
---|
36 |
|
---|
37 | s = FormatIntegerU(513, 0, 5, None)
|
---|
38 | UnitTest("FormatIntegerU(513, Field size = 5)", s = " 513")
|
---|
39 |
|
---|
40 | End Sub
|
---|
41 |
|
---|
42 | End Namespace 'SPrintFTest
|
---|
43 |
|
---|
44 | SPrintFTest.TestMain()
|
---|