}
public void TestBasicTypes(){
UResourceBundle bundle = null;
try {
bundle = (UResourceBundle)UResourceBundle.getBundleInstance("com/ibm/icu/dev/data/testdata", "testtypes", testLoader);
}
catch (MissingResourceException e) {
warnln("could not load test data: " + e.getMessage());
return;
}
{
String expected = "abc\u0000def";
UResourceBundle sub = bundle.get("zerotest");
if(!expected.equals(sub.getString())){
errln("Did not get the expected string for key zerotest in bundle testtypes");
}
sub = bundle.get("emptyexplicitstring");
expected ="";
if(!expected.equals(sub.getString())){
errln("Did not get the expected string for key emptyexplicitstring in bundle testtypes");
}
sub = bundle.get("emptystring");
expected ="";
if(!expected.equals(sub.getString())){
errln("Did not get the expected string for key emptystring in bundle testtypes");
}
}
{
int expected = 123;
UResourceBundle sub = bundle.get("onehundredtwentythree");
if(expected!=sub.getInt()){
errln("Did not get the expected int value for key onehundredtwentythree in bundle testtypes");
}
sub = bundle.get("emptyint");
expected=0;
if(expected!=sub.getInt()){
errln("Did not get the expected int value for key emptyint in bundle testtypes");
}
}
{
int expected = 1;
UResourceBundle sub = bundle.get("one");
if(expected!=sub.getInt()){
errln("Did not get the expected int value for key one in bundle testtypes");
}
}
{
int expected = -1;
UResourceBundle sub = bundle.get("minusone");
int got = sub.getInt();
if(expected!=got){
errln("Did not get the expected int value for key minusone in bundle testtypes");
}
expected = 0xFFFFFFF;
got = sub.getUInt();
if(expected!=got){
errln("Did not get the expected int value for key minusone in bundle testtypes");
}
}
{
int expected = 1;
UResourceBundle sub = bundle.get("plusone");
if(expected!=sub.getInt()){
errln("Did not get the expected int value for key minusone in bundle testtypes");
}
}
{
int[] expected = new int[]{ 1, 2, 3, -3, 4, 5, 6, 7 } ;
UResourceBundle sub = bundle.get("integerarray");
if(!Utility.arrayEquals(expected,sub.getIntVector())){
errln("Did not get the expected int vector value for key integerarray in bundle testtypes");
}
sub = bundle.get("emptyintv");
expected = new int[0];
if(!Utility.arrayEquals(expected,sub.getIntVector())){
errln("Did not get the expected int vector value for key emptyintv in bundle testtypes");
}
}
{
UResourceBundle sub = bundle.get("binarytest");
ByteBuffer got = sub.getBinary();
if(got.remaining()!=15){
errln("Did not get the expected length for the binary ByteBuffer");
}
for(int i=0; i< got.remaining(); i++){
byte b = got.get();
if(b!=i){
errln("Did not get the expected value for binary buffer at index: "+i);
}
}
sub = bundle.get("emptybin");
got = sub.getBinary();
if(got.remaining()!=0){
errln("Did not get the expected length for the emptybin ByteBuffer");
}
}
{
UResourceBundle sub = bundle.get("emptyarray");
String key = sub.getKey();
if(!key.equals("emptyarray")){
errln("Did not get the expected key for emptytable item");
}
if(sub.getSize()!=0){
errln("Did not get the expected length for emptytable item");
}
}
{
UResourceBundle sub = bundle.get("menu");
String key = sub.getKey();
if(!key.equals("menu")){
errln("Did not get the expected key for menu item");
}
UResourceBundle sub1 = sub.get("file");
key = sub1.getKey();
if(!key.equals("file")){
errln("Did not get the expected key for file item");
}
UResourceBundle sub2 = sub1.get("open");
key = sub2.getKey();
if(!key.equals("open")){
errln("Did not get the expected key for file item");
}
String value = sub2.getString();
if(!value.equals("Open")){
errln("Did not get the expected value for key for oen item");
}
sub = bundle.get("emptytable");