mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-08 06:53:45 +00:00
ICU-4094 Add API/Method Coverage tests for ICU4J
X-SVN-Rev: 16657
This commit is contained in:
parent
2793573a1c
commit
0fe606aefb
3 changed files with 35 additions and 0 deletions
|
@ -311,6 +311,17 @@ public final class UCharacterCaseTest extends TestFmwk
|
|||
hex(UCharacter.toTitleCase(test,
|
||||
TITLE_BREAKITERATORS_[i])));
|
||||
}
|
||||
//cover toTitleCase(Locale, String, BreakIterator)
|
||||
Locale def = Locale.getDefault();
|
||||
String data = TITLE_DATA_[i << 1];
|
||||
if (!expected.equals(
|
||||
UCharacter.toTitleCase(def, data,
|
||||
TITLE_BREAKITERATORS_[i]))) {
|
||||
errln("error: titlecasing for " + hex(data) + " should be " +
|
||||
hex(expected) + " but got " +
|
||||
hex(UCharacter.toTitleCase(def, data,
|
||||
TITLE_BREAKITERATORS_[i])));
|
||||
}
|
||||
}
|
||||
}catch(Exception ex){
|
||||
warnln("Could not find data for BreakIterators");
|
||||
|
|
|
@ -136,6 +136,14 @@ public final class UCharacterSurrogateTest extends TestFmwk {
|
|||
if (UCharacter.codePointBefore(c, i+1) != bvalues[i]) errln("chars before: " + i);
|
||||
if (UCharacter.codePointBefore(b, i+1) != bvalues[i]) errln("stringbuffer before: " + i);
|
||||
}
|
||||
|
||||
//cover codePointAtBefore with limit
|
||||
logln("Testing codePointAtBefore with limit ...");
|
||||
for (int i = 0; i < avalues.length; ++i) {
|
||||
if (UCharacter.codePointAt(c, i, 4) != avalues[i]) errln("chars at: " + i);
|
||||
if (UCharacter.codePointBefore(c, i+1, 0) != bvalues[i]) errln("chars before: " + i);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void TestToChars() {
|
||||
|
|
|
@ -645,6 +645,14 @@ public final class UCharacterTest extends TestFmwk
|
|||
" expected wrong direction " + dir);
|
||||
break;
|
||||
}
|
||||
|
||||
byte bdir = (byte)dir;
|
||||
if (UCharacter.getDirectionality(ch) != bdir)
|
||||
{
|
||||
errln("FAIL \\u" + hex(ch) +
|
||||
" expected wrong directionality " + bdir);
|
||||
break;
|
||||
}
|
||||
|
||||
// testing iso comment
|
||||
try{
|
||||
|
@ -2225,4 +2233,12 @@ public final class UCharacterTest extends TestFmwk
|
|||
|
||||
}
|
||||
|
||||
public void TestCoverage() {
|
||||
//cover forDigit
|
||||
char ch1 = UCharacter.forDigit(7, 11);
|
||||
assertEquals("UCharacter.forDigit ", "7", String.valueOf(ch1));
|
||||
char ch2 = UCharacter.forDigit(17, 20);
|
||||
assertEquals("UCharacter.forDigit ", "h", String.valueOf(ch2));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue