mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-10 07:39:16 +00:00
ICU-6955 Update test converter and add test cases.
X-SVN-Rev: 26170
This commit is contained in:
parent
abf1b1983f
commit
ad93f8cd75
5 changed files with 40 additions and 5 deletions
7
icu4c/source/test/testdata/conversion.txt
vendored
7
icu4c/source/test/testdata/conversion.txt
vendored
|
@ -908,6 +908,13 @@ conversion:table(nofallback) {
|
|||
:intvector{},
|
||||
:int{1}, :int{0}, "invalid", ".", :bin{ 07 }
|
||||
}
|
||||
{
|
||||
"*test5",
|
||||
:bin{ 010304 },
|
||||
"\u0034\ufffd",
|
||||
:intvector{},
|
||||
:int{1}, :int{0}, "", "?", :bin{""}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
5
icu4c/source/test/testdata/test5.ucm
vendored
5
icu4c/source/test/testdata/test5.ucm
vendored
|
@ -14,12 +14,13 @@
|
|||
<uconv_class> "MBCS"
|
||||
<subchar> \xff
|
||||
<icu:state> 0, 1:1, 5-9, ff
|
||||
<icu:state> 2:2
|
||||
<icu:state> 2:2, 3, 7, 4.p, a-d.u
|
||||
<icu:state> a-f.p
|
||||
|
||||
CHARMAP
|
||||
|
||||
<U0006> \x06 |0
|
||||
<U0034> \x01\x03 |3
|
||||
<U0074> \x01\x07 |1
|
||||
|
||||
# extensions
|
||||
<U00c0> \x05+\x01\x02\x0d |0
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:455b138da0a338b0e6225b96552b9cf2284d73322acc596dfe9905da5f58c3f5
|
||||
size 773320
|
||||
oid sha256:6a166739d612e8a89c80dcaa4053d56e9b653dab2f2f886a6b4dd0592db772ca
|
||||
size 773389
|
||||
|
|
|
@ -5531,6 +5531,31 @@ public class TestCharset extends TestFmwk {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
// Test malformed
|
||||
CoderResult malformedResult = CoderResult.UNDERFLOW;
|
||||
byte[] malformedBytes = {
|
||||
(byte)0x61, (byte)0x01, (byte)0x29, (byte)0x81, (byte)0xa0, (byte)0x0f
|
||||
};
|
||||
ByteBuffer malformedSrc = ByteBuffer.wrap(malformedBytes);
|
||||
CharBuffer malformedTrgt = CharBuffer.allocate(10);
|
||||
int[] malformedLimits = {
|
||||
2, 6
|
||||
};
|
||||
CharsetDecoder malformedDecoderTest = provider.charsetForName("LMBCS-1").newDecoder();
|
||||
for (int n = 0; n < malformedLimits.length; n++) {
|
||||
malformedDecoderTest.reset();
|
||||
|
||||
malformedSrc.position(0);
|
||||
malformedSrc.limit(malformedLimits[n]);
|
||||
|
||||
malformedTrgt.clear();
|
||||
|
||||
malformedResult = malformedDecoderTest.decode(malformedSrc,malformedTrgt, true);
|
||||
if (!malformedResult.isMalformed()) {
|
||||
errln("Malformed error should have resulted.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -409,7 +409,9 @@ public class TestConversion extends ModuleTest {
|
|||
private void TestToUnicode(DataMap testcase, int caseNr) {
|
||||
// create Conversion case to store the test case data
|
||||
ConversionCase cc = new ConversionCase();
|
||||
|
||||
if (caseNr == 138) {
|
||||
caseNr = 138;
|
||||
}
|
||||
try {
|
||||
// retrieve test case data
|
||||
cc.caseNr = caseNr;
|
||||
|
|
Loading…
Add table
Reference in a new issue