source: trunk/TestCase/SimpleTestCase/ActiveBasic.StringsTest.ab@ 475

Last change on this file since 475 was 299, checked in by dai, 17 years ago

【32bitコンパイラ】
静的リンクライブラリを実装
ジェネリクスを実装
※64bitコンパイラは未実装

File size: 1.8 KB
Line 
1'--------------------------------------------------------------------
2' Test case of AcitveBasic.Strings Namespace
3'--------------------------------------------------------------------
4
5Imports ActiveBasic.Strings
6
7Namespace ActiveBasic_StringsTest
8
9Sub TestMain()
10 Dim w[3] = [3, 2, 1, 0] As WCHAR
11 Dim m[3] = [3, 2, 1, 0] As CHAR
12 Dim tw[1] = [2, 1] As WCHAR
13 Dim tm[1] = [1, 0] As CHAR
14
15 UnitTest("ChrCmp WC =", ChrCmp(VarPtr(w[1]), tw, 2 As SIZE_T) = 0)
16 UnitTest("ChrCmp MB =", ChrCmp(VarPtr(m[2]), tm, 2 As SIZE_T) = 0)
17 UnitTest("ChrCmp WC >", ChrCmp(VarPtr(w[0]), tw, 2 As SIZE_T) > 0)
18 UnitTest("ChrCmp MB >", ChrCmp(VarPtr(m[0]), tm, 2 As SIZE_T) > 0)
19 UnitTest("ChrCmp WC <", ChrCmp(VarPtr(w[2]), tw, 2 As SIZE_T) < 0)
20 UnitTest("ChrCmp MB <", ChrCmp(VarPtr(m[3]), tm, 1 As SIZE_T) < 0)
21
22 Dim w2[3] As WCHAR
23 Dim m2[3] As CHAR
24 ChrCopy(w2, w, 4 As SIZE_T)
25 ChrCopy(m2, m, 4 As SIZE_T)
26 UnitTest("ChrCopy WC", ChrCmp(w, w2, 4 As SIZE_T) = 0)
27 UnitTest("ChrCopy MB", ChrCmp(m, m2, 4 As SIZE_T) = 0)
28
29 Dim wf[3] = [10, 10, 10, 10] As WCHAR
30 Dim mf[3] = [77, 77, 77, 77] As CHAR
31 ChrFill(w2, 4 As SIZE_T, 10 As WCHAR)
32 ChrFill(m2, 4 As SIZE_T, 77 As CHAR)
33 UnitTest("ChrFill WC", ChrCmp(w2, wf, 4 As SIZE_T) = 0)
34 UnitTest("ChrFill MB", ChrCmp(m2, mf, 4 As SIZE_T) = 0)
35
36 UnitTest("ChrFind WC c", ChrFind(w, 4, 1 As WCHAR) = 2)
37 UnitTest("ChrFind MB c", ChrFind(m, 4, 2 As CHAR) = 1)
38 UnitTest("ChrFind WC s", ChrFind(w, 4 As SIZE_T, tw, 2 As SIZE_T) = 1)
39 UnitTest("ChrFind MB s", ChrFind(m, 4 As SIZE_T, tm, 2 As SIZE_T) = 2)
40 UnitTest("ChrPBrk WC", ChrPBrk(ToWCStr("a1b2c3"), 6 As SIZE_T, ToWCStr("123"), 3 As SIZE_T) = 1)
41 UnitTest("ChrPBrk MB", ChrPBrk(ToMBStr("a1b2c3"), 6 As SIZE_T, ToMBStr("abc"), 3 As SIZE_T) = 0)
42End Sub
43
44End Namespace 'ActiveBasic_StringsTest
45
46ActiveBasic_StringsTest.TestMain()
Note: See TracBrowser for help on using the repository browser.