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