Changeset 40074 in vbox for trunk/src/VBox/Runtime/testcase
- Timestamp:
- Feb 10, 2012 10:08:41 PM (13 years ago)
- svn:sync-xref-src-repo-rev:
- 76208
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/testcase/tstUtf8.cpp
r40071 r40074 896 896 const char *pcszIn; 897 897 const char *pcszOut; 898 size_t cwc; /* Zero means the strings are Utf-8. */ 898 899 PCRTUNICP pcCpSet; 899 900 char chReplacement; … … 902 903 aTests[] = 903 904 { 904 { "1234werttrew4321", "1234werttrew4321", aCpSet, '_', 0 },905 { "1234werttrew4321", "1234werttrew4321", 0, aCpSet, '_', 0 }, 905 906 { "123654wert\xc2\xa2trew\xe2\x82\xac""4321", 906 "123_54wert_trew_4321", aCpSet, '_', 3 }, 907 { "hjhj8766", "????????", aCpSet, '?', 8 }, 908 { "123\xf0\xa4\xad\xa2""4", "123__4", aCpSet, '_', 1 } 909 /* No test for invalid encoding. */ 907 "123_54wert_trew_4321", 0, aCpSet, '_', 3 }, 908 { "hjhj8766", "????????", 0, aCpSet, '?', 8 }, 909 { "123\xf0\xa4\xad\xa2""4", "123__4", 0, aCpSet, '_', 1 }, 910 { "\xff\xff\0", "\xff\xff\0", 2, aCpSet, '_', -1 }, 911 { "\xff\xff\0", "\xff\xff\0", 2, aCpSet, '_', -1 } 910 912 }; 911 913 enum { MAX_IN_STRING = 256 }; … … 916 918 RTUTF16 wszOutCopy[MAX_IN_STRING], *pwszOutCopy = wszOutCopy; 917 919 ssize_t cReplacements; 918 AssertRC(RTStrToUtf16Ex(aTests[i].pcszIn, RTSTR_MAX, &pwszInCopy, 919 RT_ELEMENTS(wszInCopy), NULL)); 920 AssertRC(RTStrToUtf16Ex(aTests[i].pcszOut, RTSTR_MAX, &pwszOutCopy, 921 RT_ELEMENTS(wszOutCopy), NULL)); 920 if (!aTests[i].cwc) 921 { 922 AssertRC(RTStrToUtf16Ex(aTests[i].pcszIn, RTSTR_MAX, &pwszInCopy, 923 RT_ELEMENTS(wszInCopy), NULL)); 924 AssertRC(RTStrToUtf16Ex(aTests[i].pcszOut, RTSTR_MAX, &pwszOutCopy, 925 RT_ELEMENTS(wszOutCopy), NULL)); 926 } 927 else 928 { 929 Assert(aTests[i].cwc <= RT_ELEMENTS(wszInCopy)); 930 memcpy(wszInCopy, aTests[i].pcszIn, aTests[i].cwc * 2); 931 memcpy(wszOutCopy, aTests[i].pcszOut, aTests[i].cwc * 2); 932 } 922 933 cReplacements = RTUtf16PurgeComplementSet(wszInCopy, aTests[i].pcCpSet, 923 934 aTests[i].chReplacement);
Note:
See TracChangeset
for help on using the changeset viewer.