1 /*
2 * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /*
25 * @test
26 * @summary Unit test for sun.net.idn.Punycode
27 * @bug 4737170
28 * @modules java.base/sun.net.idn
29 * @compile -XDignore.symbol.file PunycodeTest.java
30 * @run main/othervm -ea PunycodeTest
31 * @author Edward Wang
32 */
33
34 import java.util.Scanner;
35 import java.text.ParseException;
36 import sun.net.idn.Punycode;
37
38 /**
39 * unit test for Punycode that is also originated from the sample code
40 * provided in rfc3492.txt
41 */
42 public class PunycodeTest {
43
44 /* For testing, we'll just set some compile-time limits rather than */
45 /* use malloc(), and set a compile-time option rather than using a */
46 /* command-line option. */
47
48 static final int unicode_max_length = 256;
49 static final int ace_max_length = 256;
50
51 static final String too_big =
52 "input or output is too large, recompile with larger limits\n";
53 static final String invalid_input = "invalid input\n";
54 static final String overflow = "arithmetic overflow\n";
55 static final String io_error = "I/O error\n";
56
|
1 /*
2 * Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /*
25 * @test
26 * @summary Unit test for jdk.internal.icu.impl.Punycode
27 * @bug 4737170 8174270
28 * @modules java.base/jdk.internal.icu.impl
29 * @compile -XDignore.symbol.file PunycodeTest.java
30 * @run main/othervm -ea PunycodeTest
31 * @author Edward Wang
32 */
33
34 import java.util.Scanner;
35 import jdk.internal.icu.impl.Punycode;
36
37 /**
38 * unit test for Punycode that is also originated from the sample code
39 * provided in rfc3492.txt
40 */
41 public class PunycodeTest {
42
43 /* For testing, we'll just set some compile-time limits rather than */
44 /* use malloc(), and set a compile-time option rather than using a */
45 /* command-line option. */
46
47 static final int unicode_max_length = 256;
48 static final int ace_max_length = 256;
49
50 static final String too_big =
51 "input or output is too large, recompile with larger limits\n";
52 static final String invalid_input = "invalid input\n";
53 static final String overflow = "arithmetic overflow\n";
54 static final String io_error = "I/O error\n";
55
|