1 /* Licensed to the Apache Software Foundation (ASF) under one or more 2 * contributor license agreements. See the NOTICE file distributed with 3 * this work for additional information regarding copyright ownership. 4 * The ASF licenses this file to You under the Apache License, Version 2.0 5 * (the "License"); you may not use this file except in compliance with 6 * the License. You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package tests.api.java.nio.charset; 18 19 /** 20 * Test charset US-ASCII. 21 */ 22 public class ASCCharsetTest extends AbstractCharsetTestCase { 23 24 /** 25 * Constructor. 26 * 27 */ 28 public ASCCharsetTest(String arg0) { 29 super(arg0, "US-ASCII", new String[] { "ISO646-US", "ASCII", "cp367", 30 "ascii7", "ANSI_X3.4-1986", "iso-ir-6", "us", "646", 31 "iso_646.irv:1983", "csASCII", "ANSI_X3.4-1968", 32 "ISO_646.irv:1991" }, true, true); // "ibm-367" 33 } 34 35 /* 36 * (non-Javadoc) 37 * 38 * @see tests.api.java.nio.charset.ConcreteCharsetTest#testEncode_Normal() 39 */ 40 public void testEncode_Normal() { 41 String input = "ab\u5D14\u654F"; 42 byte[] output = new byte[] { 97, 98, 43 this.testingCharset.newEncoder().replacement()[0], 44 this.testingCharset.newEncoder().replacement()[0] }; 45 internalTestEncode(input, output); 46 } 47 48 /* 49 * (non-Javadoc) 50 * 51 * @see tests.api.java.nio.charset.ConcreteCharsetTest#testDecode_Normal() 52 */ 53 public void testDecode_Normal() { 54 byte[] input = new byte[] { 97, 98, 63, 63 }; 55 char[] output = "ab??".toCharArray(); 56 internalTestDecode(input, output); 57 } 58 59 } 60