TestCp834_SBCS.java revision 395
/*
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/* @test
@bug 6379808
@summary Check all Cp933 SBCS characters are not supported in Cp834
*/
public class TestCp834_SBCS {
// The correctness of 1:1 mapping is Coverted by CoderTest.java
// and TestConv.java, we only need to verify that SBCS characters
// are not supported by this charset.
.newEncoder()
.newDecoder()
.newDecoder()
byte[] ba = new byte[1];
byte[] ba2 = new byte[2];
char[] ca = new char[1];
char c;
for (int i = 0; i <= 0xff; i++) {
ba[0] = (byte)i;
// OK, this is a SBCS character in Cp933
throw new Exception("SBCS is supported in IBM834 decoder");
throw new Exception("SBCS can be encoded in IBM834 encoder");
ca[0] = c;
throw new Exception("SBCS is supported in IBM834 encoder");
boolean isMalformed = false;
int ret = 0;
try {
// three scenarios (1)malformed (2)held as an incomplete
// input or (3)return replacement all mean "no sbcs"
throw new Exception("SBCS is supported in Cp834 b2c");
}
if (cb834.canConvert(c))
throw new Exception("SBCS can be converted in Cp834 c2b ");
ca[0] = c;
throw new Exception("SBCS is supported in Cp834 c2b");
}
}
}
}
}
}