test/jdk/java/util/Currency/Bug8154295.java
author phh
Sat, 30 Nov 2019 14:33:05 -0800 (2019-11-30)
changeset 59330 5b96c12f909d
parent 47216 71c04702a3d5
permissions -rw-r--r--
8234541: C1 emits an empty message when it inlines successfully Summary: Use "inline" as the message when successfull Reviewed-by: thartmann, mdoerr Contributed-by: navy.xliu@gmail.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
37815
0ecfe8f6500e 8154295: Currency iso code is int and hence looses the preceeding zero.
peytoia
parents:
diff changeset
     1
/*
0ecfe8f6500e 8154295: Currency iso code is int and hence looses the preceeding zero.
peytoia
parents:
diff changeset
     2
 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
0ecfe8f6500e 8154295: Currency iso code is int and hence looses the preceeding zero.
peytoia
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0ecfe8f6500e 8154295: Currency iso code is int and hence looses the preceeding zero.
peytoia
parents:
diff changeset
     4
 *
0ecfe8f6500e 8154295: Currency iso code is int and hence looses the preceeding zero.
peytoia
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
0ecfe8f6500e 8154295: Currency iso code is int and hence looses the preceeding zero.
peytoia
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
0ecfe8f6500e 8154295: Currency iso code is int and hence looses the preceeding zero.
peytoia
parents:
diff changeset
     7
 * published by the Free Software Foundation.
0ecfe8f6500e 8154295: Currency iso code is int and hence looses the preceeding zero.
peytoia
parents:
diff changeset
     8
 *
0ecfe8f6500e 8154295: Currency iso code is int and hence looses the preceeding zero.
peytoia
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
0ecfe8f6500e 8154295: Currency iso code is int and hence looses the preceeding zero.
peytoia
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0ecfe8f6500e 8154295: Currency iso code is int and hence looses the preceeding zero.
peytoia
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
0ecfe8f6500e 8154295: Currency iso code is int and hence looses the preceeding zero.
peytoia
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
0ecfe8f6500e 8154295: Currency iso code is int and hence looses the preceeding zero.
peytoia
parents:
diff changeset
    13
 * accompanied this code).
0ecfe8f6500e 8154295: Currency iso code is int and hence looses the preceeding zero.
peytoia
parents:
diff changeset
    14
 *
0ecfe8f6500e 8154295: Currency iso code is int and hence looses the preceeding zero.
peytoia
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
0ecfe8f6500e 8154295: Currency iso code is int and hence looses the preceeding zero.
peytoia
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
0ecfe8f6500e 8154295: Currency iso code is int and hence looses the preceeding zero.
peytoia
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0ecfe8f6500e 8154295: Currency iso code is int and hence looses the preceeding zero.
peytoia
parents:
diff changeset
    18
 *
0ecfe8f6500e 8154295: Currency iso code is int and hence looses the preceeding zero.
peytoia
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
0ecfe8f6500e 8154295: Currency iso code is int and hence looses the preceeding zero.
peytoia
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
0ecfe8f6500e 8154295: Currency iso code is int and hence looses the preceeding zero.
peytoia
parents:
diff changeset
    21
 * questions.
0ecfe8f6500e 8154295: Currency iso code is int and hence looses the preceeding zero.
peytoia
parents:
diff changeset
    22
 */
0ecfe8f6500e 8154295: Currency iso code is int and hence looses the preceeding zero.
peytoia
parents:
diff changeset
    23
/*
0ecfe8f6500e 8154295: Currency iso code is int and hence looses the preceeding zero.
peytoia
parents:
diff changeset
    24
 * @test
0ecfe8f6500e 8154295: Currency iso code is int and hence looses the preceeding zero.
peytoia
parents:
diff changeset
    25
 * @bug 8154295
0ecfe8f6500e 8154295: Currency iso code is int and hence looses the preceeding zero.
peytoia
parents:
diff changeset
    26
 * @summary Check getNumericCodeAsString() method which returns numeric code as a 3 digit String.
0ecfe8f6500e 8154295: Currency iso code is int and hence looses the preceeding zero.
peytoia
parents:
diff changeset
    27
 */
0ecfe8f6500e 8154295: Currency iso code is int and hence looses the preceeding zero.
peytoia
parents:
diff changeset
    28
0ecfe8f6500e 8154295: Currency iso code is int and hence looses the preceeding zero.
peytoia
parents:
diff changeset
    29
import java.util.Currency;
0ecfe8f6500e 8154295: Currency iso code is int and hence looses the preceeding zero.
peytoia
parents:
diff changeset
    30
0ecfe8f6500e 8154295: Currency iso code is int and hence looses the preceeding zero.
peytoia
parents:
diff changeset
    31
public class Bug8154295 {
0ecfe8f6500e 8154295: Currency iso code is int and hence looses the preceeding zero.
peytoia
parents:
diff changeset
    32
0ecfe8f6500e 8154295: Currency iso code is int and hence looses the preceeding zero.
peytoia
parents:
diff changeset
    33
    public static void main(String[] args) {
0ecfe8f6500e 8154295: Currency iso code is int and hence looses the preceeding zero.
peytoia
parents:
diff changeset
    34
0ecfe8f6500e 8154295: Currency iso code is int and hence looses the preceeding zero.
peytoia
parents:
diff changeset
    35
        String numericCode = Currency.getInstance("AFA").getNumericCodeAsString();
0ecfe8f6500e 8154295: Currency iso code is int and hence looses the preceeding zero.
peytoia
parents:
diff changeset
    36
        if (!numericCode.equals("004")) { //should return "004" (a 3 digit string)
0ecfe8f6500e 8154295: Currency iso code is int and hence looses the preceeding zero.
peytoia
parents:
diff changeset
    37
           throw new RuntimeException("[Expected 004, "
0ecfe8f6500e 8154295: Currency iso code is int and hence looses the preceeding zero.
peytoia
parents:
diff changeset
    38
                + "found "+numericCode+" for AFA]");
0ecfe8f6500e 8154295: Currency iso code is int and hence looses the preceeding zero.
peytoia
parents:
diff changeset
    39
        }
0ecfe8f6500e 8154295: Currency iso code is int and hence looses the preceeding zero.
peytoia
parents:
diff changeset
    40
0ecfe8f6500e 8154295: Currency iso code is int and hence looses the preceeding zero.
peytoia
parents:
diff changeset
    41
        numericCode = Currency.getInstance("AUD").getNumericCodeAsString();
0ecfe8f6500e 8154295: Currency iso code is int and hence looses the preceeding zero.
peytoia
parents:
diff changeset
    42
        if (!numericCode.equals("036")) { //should return "036" (a 3 digit string)
0ecfe8f6500e 8154295: Currency iso code is int and hence looses the preceeding zero.
peytoia
parents:
diff changeset
    43
            throw new RuntimeException("[Expected 036, "
0ecfe8f6500e 8154295: Currency iso code is int and hence looses the preceeding zero.
peytoia
parents:
diff changeset
    44
                + "found "+numericCode+" for AUD]");
0ecfe8f6500e 8154295: Currency iso code is int and hence looses the preceeding zero.
peytoia
parents:
diff changeset
    45
        }
0ecfe8f6500e 8154295: Currency iso code is int and hence looses the preceeding zero.
peytoia
parents:
diff changeset
    46
0ecfe8f6500e 8154295: Currency iso code is int and hence looses the preceeding zero.
peytoia
parents:
diff changeset
    47
        numericCode = Currency.getInstance("USD").getNumericCodeAsString();
0ecfe8f6500e 8154295: Currency iso code is int and hence looses the preceeding zero.
peytoia
parents:
diff changeset
    48
        if (!numericCode.equals("840")) {// should return "840" (a 3 digit string)
0ecfe8f6500e 8154295: Currency iso code is int and hence looses the preceeding zero.
peytoia
parents:
diff changeset
    49
            throw new RuntimeException("[Expected 840, "
0ecfe8f6500e 8154295: Currency iso code is int and hence looses the preceeding zero.
peytoia
parents:
diff changeset
    50
                + "found "+numericCode+" for USD]");
0ecfe8f6500e 8154295: Currency iso code is int and hence looses the preceeding zero.
peytoia
parents:
diff changeset
    51
        }
0ecfe8f6500e 8154295: Currency iso code is int and hence looses the preceeding zero.
peytoia
parents:
diff changeset
    52
0ecfe8f6500e 8154295: Currency iso code is int and hence looses the preceeding zero.
peytoia
parents:
diff changeset
    53
    }
0ecfe8f6500e 8154295: Currency iso code is int and hence looses the preceeding zero.
peytoia
parents:
diff changeset
    54
0ecfe8f6500e 8154295: Currency iso code is int and hence looses the preceeding zero.
peytoia
parents:
diff changeset
    55
}