'-------------------------------------------------------------------- ' Test case of AcitveBasic.Strings Namespace '-------------------------------------------------------------------- Imports ActiveBasic.Strings Namespace ActiveBasic_StringsTest Sub TestMain() Dim w[3] = [3, 2, 1, 0] As WCHAR Dim m[3] = [3, 2, 1, 0] As CHAR Dim tw[1] = [2, 1] As WCHAR Dim tm[1] = [1, 0] As CHAR UnitTest("ChrCmp WC =", ChrCmp(VarPtr(w[1]), tw, 2 As SIZE_T) = 0) UnitTest("ChrCmp MB =", ChrCmp(VarPtr(m[2]), tm, 2 As SIZE_T) = 0) UnitTest("ChrCmp WC >", ChrCmp(VarPtr(w[0]), tw, 2 As SIZE_T) > 0) UnitTest("ChrCmp MB >", ChrCmp(VarPtr(m[0]), tm, 2 As SIZE_T) > 0) UnitTest("ChrCmp WC <", ChrCmp(VarPtr(w[2]), tw, 2 As SIZE_T) < 0) UnitTest("ChrCmp MB <", ChrCmp(VarPtr(m[3]), tm, 1 As SIZE_T) < 0) Dim w2[3] As WCHAR Dim m2[3] As CHAR ChrCopy(w2, w, 4 As SIZE_T) ChrCopy(m2, m, 4 As SIZE_T) UnitTest("ChrCopy WC", ChrCmp(w, w2, 4 As SIZE_T) = 0) UnitTest("ChrCopy MB", ChrCmp(m, m2, 4 As SIZE_T) = 0) Dim wf[3] = [10, 10, 10, 10] As WCHAR Dim mf[3] = [77, 77, 77, 77] As CHAR ChrFill(w2, 4 As SIZE_T, 10 As WCHAR) ChrFill(m2, 4 As SIZE_T, 77 As CHAR) UnitTest("ChrFill WC", ChrCmp(w2, wf, 4 As SIZE_T) = 0) UnitTest("ChrFill MB", ChrCmp(m2, mf, 4 As SIZE_T) = 0) UnitTest("ChrFind WC c", ChrFind(w, 4, 1 As WCHAR) = 2) UnitTest("ChrFind MB c", ChrFind(m, 4, 2 As CHAR) = 1) UnitTest("ChrFind WC s", ChrFind(w, 4 As SIZE_T, tw, 2 As SIZE_T) = 1) UnitTest("ChrFind MB s", ChrFind(m, 4 As SIZE_T, tm, 2 As SIZE_T) = 2) UnitTest("ChrPBrk WC", ChrPBrk(ToWCStr("a1b2c3"), 6 As SIZE_T, ToWCStr("123"), 3 As SIZE_T) = 1) UnitTest("ChrPBrk MB", ChrPBrk(ToMBStr("a1b2c3"), 6 As SIZE_T, ToMBStr("abc"), 3 As SIZE_T) = 0) End Sub End Namespace 'ActiveBasic_StringsTest ActiveBasic_StringsTest.TestMain()