Changeset 682 for trunk/ab5.0/ablib/TestCase/SimpleTestCase/EncodingTest.ab
- Timestamp:
- Feb 16, 2009, 4:26:24 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ab5.0/ablib/TestCase/SimpleTestCase/EncodingTest.ab
r653 r682 1 1 Imports System.Text 2 2 Imports System.Text.Detail 3 /* 3 4 4 Namespace EncodingTest 5 5 … … 27 27 28 28 Dim utf8 = New UTF8Encoding 29 Dim e = utf8.GetEncoder 30 Dim d = utf8.GetDecoder 29 Dim e = utf8.GetEncoder() 30 Dim d = utf8.GetDecoder() 31 31 Dim b[256] As Byte 32 32 Dim u16[256] As WCHAR 33 e.GetBytes(chars, Len(chars) \ SizeOf (WCHAR), b, Len(b), False) 34 UnitTest("UTF8 Encode", memcmp(b, utf8bytes, Len(utf8bytes)) = 0) 35 d.GetChars(utf8bytes, Len(utf8bytes), u16, Len(u16) \ SizeOf (WCHAR), False) 36 UnitTest("UTF8 Decode", memcmp(u16, chars, Len(chars)) = 0) 33 Dim len As Long 34 35 len = utf8.GetBytesCount(chars, Len(chars) \ SizeOf(WCHAR)) 36 UnitTest("UTF-8 GetByteCount", len = Len(utf8bytes)) 37 utf8.GetBytes(chars, Len(chars) \ SizeOf (WCHAR), b, Len(b)) 38 UnitTest("UTF-8 Encode", memcmp(b, utf8bytes, Len(utf8bytes)) = 0) 39 40 len = utf8.GetCharsCount(utf8bytes, Len(utf8bytes)) 41 UnitTest("UTF-8 GetCharCount", len = Len(chars) \ SizeOf(WCHAR)) 42 utf8.GetChars(utf8bytes, Len(utf8bytes), u16, Len(u16) \ SizeOf (WCHAR)) 43 UnitTest("UTF-8 Decode", memcmp(u16, chars, Len(chars)) = 0) 37 44 End Sub 38 45 … … 40 47 41 48 EncodingTest.TestMain() 42 */ 49
Note:
See TracChangeset
for help on using the changeset viewer.