ICU-6955 Update charset test for better code coverage for MBCS.

X-SVN-Rev: 26156
This commit is contained in:
Michael Ow 2009-06-24 18:54:36 +00:00
parent 77015374a6
commit 9e39b57bf1
3 changed files with 44 additions and 2 deletions

View File

@ -887,6 +887,13 @@ conversion:table(nofallback) {
:intvector{ 0, 2, 4, 4, 6, 9, 10, 11 },
:int{1}, :int{0}, "", "?", :bin{""}
}
{
"ISO-2022-CN-EXT",
:bin{ 1b242b4d1b4f66791b242b4d1b4f216a },
"\u3667",
:intvector{ 14 },
:int{1}, :int{0}, "", "0", :bin{""}
}
}
}

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e0a6d624943d618593296da8962fe2e8a258a7bb431d452f99714189bf81a6f6
size 773180
oid sha256:a7ce8b58d416e6eae38a86180bcf591949db964a24e6016b5e393713bb42355a
size 773227

View File

@ -5532,4 +5532,39 @@ public class TestCharset extends TestFmwk {
}
}
/*
* This is a port of ICU4C TestAmbiguousConverter in cintltst.
* Since there is no concept of ambiguous converters in ICU4J
* this test is merely for code coverage reasons.
*/
public void TestAmbiguousConverter() {
byte [] inBytes = {
0x61, 0x5b, 0x5c
};
ByteBuffer src = ByteBuffer.wrap(inBytes);
CharBuffer trgt = CharBuffer.allocate(20);
CoderResult result = CoderResult.UNDERFLOW;
CharsetProviderICU provider = new CharsetProviderICU();
String[] names = CharsetProviderICU.getAllNames();
for (int i = 0; i < names.length; i++) {
Charset charset = provider.charsetForName(names[i]);
if (charset == null) {
/* We don't care about any failures because not all converters are available. */
continue;
}
CharsetDecoder decoder = charset.newDecoder();
src.position(0);
trgt.clear();
result = decoder.decode(src, trgt, true);
if (result.isError()) {
/* We don't care about any failures. */
continue;
}
}
}
}