test/jdk/java/util/Formatter/BasicBigDecimal.java
author erikj
Tue, 12 Sep 2017 19:03:39 +0200
changeset 47216 71c04702a3d5
parent 35998 jdk/test/java/util/Formatter/BasicBigDecimal.java@4d6b098a501d
child 50475 0e25d6367884
permissions -rw-r--r--
8187443: Forest Consolidation: Move files to unified layout Reviewed-by: darcy, ihse
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
35998
4d6b098a501d 8149981: java/util/Formatter/Basic.java fails after JDK-8149896
darcy
parents: 28302
diff changeset
     2
 * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3416
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3416
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3416
diff changeset
    21
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
/* Type-specific source code for unit test
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
 * Regenerate the BasicX classes via genBasic.sh whenever this file changes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
 * We check in the generated source files so that the test tree can be used
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
 * independently of the rest of the source tree.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
// -- This file was mechanically generated: Do not edit! -- //
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
import java.io.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
import java.math.BigDecimal;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
import java.math.BigInteger;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
import java.text.DateFormatSymbols;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
import java.util.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
import static java.util.Calendar.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
public class BasicBigDecimal extends Basic {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
    private static void test(String fs, String exp, Object ... args) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
        Formatter f = new Formatter(new StringBuilder(), Locale.US);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
        f.format(fs, args);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
        ck(fs, exp, f.toString());
27725
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
    51
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
    52
        f = new Formatter(new StringBuilder(), Locale.US);
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
    53
        f.format("foo " + fs + " bar", args);
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
    54
        ck(fs, "foo " + exp + " bar", f.toString());
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
    private static void test(Locale l, String fs, String exp, Object ... args)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
        Formatter f = new Formatter(new StringBuilder(), l);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
        f.format(fs, args);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
        ck(fs, exp, f.toString());
27725
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
    62
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
    63
        f = new Formatter(new StringBuilder(), l);
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
    64
        f.format("foo " + fs + " bar", args);
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
    65
        ck(fs, "foo " + exp + " bar", f.toString());
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
    private static void test(String fs, Object ... args) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
        Formatter f = new Formatter(new StringBuilder(), Locale.US);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
        f.format(fs, args);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
        ck(fs, "fail", f.toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
    private static void test(String fs) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
        Formatter f = new Formatter(new StringBuilder(), Locale.US);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
        f.format(fs, "fail");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
        ck(fs, "fail", f.toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
    private static void testSysOut(String fs, String exp, Object ... args) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
        FileOutputStream fos = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
        FileInputStream fis = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
            PrintStream saveOut = System.out;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
            fos = new FileOutputStream("testSysOut");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
            System.setOut(new PrintStream(fos));
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
            System.out.format(Locale.US, fs, args);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
            fos.close();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
            fis = new FileInputStream("testSysOut");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
            byte [] ba = new byte[exp.length()];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
            int len = fis.read(ba);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
            String got = new String(ba);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
            if (len != ba.length)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
                fail(fs, exp, got);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
            ck(fs, exp, got);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
            System.setOut(saveOut);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
        } catch (FileNotFoundException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
            fail(fs, ex.getClass());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
        } catch (IOException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
            fail(fs, ex.getClass());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
        } finally {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
            try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
                if (fos != null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
                    fos.close();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
                if (fis != null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
                    fis.close();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
            } catch (IOException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
                fail(fs, ex.getClass());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
    private static void tryCatch(String fs, Class<?> ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
        boolean caught = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
            test(fs);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
        } catch (Throwable x) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
            if (ex.isAssignableFrom(x.getClass()))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
                caught = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
        if (!caught)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
            fail(fs, ex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
        else
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
            pass();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
    private static void tryCatch(String fs, Class<?> ex, Object ... args) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
        boolean caught = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
            test(fs, args);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
        } catch (Throwable x) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
            if (ex.isAssignableFrom(x.getClass()))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
                caught = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
        if (!caught)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
            fail(fs, ex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
        else
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
            pass();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
    private static BigDecimal create(double v) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
        return new BigDecimal(v);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
    private static BigDecimal negate(BigDecimal v) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
        return v.negate();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
    private static BigDecimal mult(BigDecimal v, double mul) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
        return v.multiply(new BigDecimal(mul));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
    private static BigDecimal recip(BigDecimal v) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
        return BigDecimal.ONE.divide(v);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
    public static void test() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
        TimeZone.setDefault(TimeZone.getTimeZone("GMT-0800"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
        // Any characters not explicitly defined as conversions, date/time
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
        // conversion suffixes, or flags are illegal and are reserved for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
        // future extensions.  Use of such a character in a format string will
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
        // cause an UnknownFormatConversionException or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
        // UnknownFormatFlagsException to be thrown.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
        tryCatch("%q", UnknownFormatConversionException.class);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
        tryCatch("%t&", UnknownFormatConversionException.class);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
        tryCatch("%&d", UnknownFormatConversionException.class);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
        tryCatch("%^b", UnknownFormatConversionException.class);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
        //---------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
        // Formatter.java class javadoc examples
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
        //---------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
        test(Locale.FRANCE, "e = %+10.4f", "e =    +2,7183", Math.E);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
        test("%4$2s %3$2s %2$2s %1$2s", " d  c  b  a", "a", "b", "c", "d");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
        test("Amount gained or lost since last statement: $ %,(.2f",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
             "Amount gained or lost since last statement: $ (6,217.58)",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
             (new BigDecimal("-6217.58")));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
        Calendar c = new GregorianCalendar(1969, JULY, 20, 16, 17, 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
        testSysOut("Local time: %tT", "Local time: 16:17:00", c);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
        test("Unable to open file '%1$s': %2$s",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
             "Unable to open file 'food': No such file or directory",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
             "food", "No such file or directory");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
        Calendar duke = new GregorianCalendar(1995, MAY, 23, 19, 48, 34);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
        duke.set(Calendar.MILLISECOND, 584);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
        test("Duke's Birthday: %1$tB %1$te, %1$tY",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
             "Duke's Birthday: May 23, 1995",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
             duke);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
        test("Duke's Birthday: %1$tB %1$te, %1$tY",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
             "Duke's Birthday: May 23, 1995",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
             duke.getTime());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
        test("Duke's Birthday: %1$tB %1$te, %1$tY",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
             "Duke's Birthday: May 23, 1995",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
             duke.getTimeInMillis());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
        test("%4$s %3$s %2$s %1$s %4$s %3$s %2$s %1$s",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
             "d c b a d c b a", "a", "b", "c", "d");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
        test("%s %s %<s %<s", "a b b b", "a", "b", "c", "d");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
        test("%s %s %s %s", "a b c d", "a", "b", "c", "d");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
        test("%2$s %s %<s %s", "b a a b", "a", "b", "c", "d");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
        //---------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
        // %b
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
        //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
        // General conversion applicable to any argument.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
        //---------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
        test("%b", "true", true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
        test("%b", "false", false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
        test("%B", "TRUE", true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
        test("%B", "FALSE", false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
        test("%b", "true", Boolean.TRUE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
        test("%b", "false", Boolean.FALSE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
        test("%B", "TRUE", Boolean.TRUE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
        test("%B", "FALSE", Boolean.FALSE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
        test("%14b", "          true", true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
        test("%-14b", "true          ", true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
        test("%5.1b", "    f", false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
        test("%-5.1b", "f    ", false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
        test("%b", "true", "foo");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
        test("%b", "false", (Object)null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
        // Boolean.java hardcodes the Strings for "true" and "false", so no
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
        // localization is possible.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
        test(Locale.FRANCE, "%b", "true", true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
        test(Locale.FRANCE, "%b", "false", false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
        // If you pass in a single array to a varargs method, the compiler
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
        // uses it as the array of arguments rather than treating it as a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
        // single array-type argument.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
        test("%b", "false", (Object[])new String[2]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
        test("%b", "true", new String[2], new String[2]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
        int [] ia = { 1, 2, 3 };
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
        test("%b", "true", ia);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
        //---------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
        // %b - errors
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
        //---------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
        tryCatch("%#b", FormatFlagsConversionMismatchException.class);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
        tryCatch("%-b", MissingFormatWidthException.class);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
        // correct or side-effect of implementation?
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
        tryCatch("%.b", UnknownFormatConversionException.class);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
        tryCatch("%,b", FormatFlagsConversionMismatchException.class);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
        //---------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
        // %c
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
        //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
        // General conversion applicable to any argument.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
        //---------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
        test("%c", "i", 'i');
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
        test("%C", "I", 'i');
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
        test("%4c",  "   i", 'i');
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
        test("%-4c", "i   ", 'i');
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
        test("%4C",  "   I", 'i');
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
        test("%-4C", "I   ", 'i');
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
        test("%c", "i", new Character('i'));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
        test("%c", "H", (byte) 72);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
        test("%c", "i", (short) 105);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
        test("%c", "!", (int) 33);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
        test("%c", "\u007F", Byte.MAX_VALUE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
        test("%c", new String(Character.toChars(Short.MAX_VALUE)),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
             Short.MAX_VALUE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
        test("%c", "null", (Object) null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
        //---------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
        // %c - errors
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
        //---------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
        tryCatch("%c", IllegalFormatConversionException.class,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
                 Boolean.TRUE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
        tryCatch("%c", IllegalFormatConversionException.class,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
                 (float) 0.1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
        tryCatch("%c", IllegalFormatConversionException.class,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
                 new Object());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
        tryCatch("%c", IllegalFormatCodePointException.class,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
                 Byte.MIN_VALUE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
        tryCatch("%c", IllegalFormatCodePointException.class,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
                 Short.MIN_VALUE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
        tryCatch("%c", IllegalFormatCodePointException.class,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
                 Integer.MIN_VALUE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
        tryCatch("%c", IllegalFormatCodePointException.class,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
                 Integer.MAX_VALUE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
        tryCatch("%#c", FormatFlagsConversionMismatchException.class);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
        tryCatch("%,c", FormatFlagsConversionMismatchException.class);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
        tryCatch("%(c", FormatFlagsConversionMismatchException.class);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
        tryCatch("%$c", UnknownFormatConversionException.class);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
        tryCatch("%.2c", IllegalFormatPrecisionException.class);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
        //---------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
        // %s
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
        //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
        // General conversion applicable to any argument.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
        //---------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
        test("%s", "Hello, Duke", "Hello, Duke");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
        test("%S", "HELLO, DUKE", "Hello, Duke");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
        test("%20S", "         HELLO, DUKE", "Hello, Duke");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
        test("%20s", "         Hello, Duke", "Hello, Duke");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
        test("%-20s", "Hello, Duke         ", "Hello, Duke");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   481
        test("%-20.5s", "Hello               ", "Hello, Duke");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   482
        test("%s", "null", (Object)null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   483
90ce3da70b43 Initial load
duke
parents:
diff changeset
   484
        StringBuffer sb = new StringBuffer("foo bar");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   485
        test("%s", sb.toString(), sb);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
        test("%S", sb.toString().toUpperCase(), sb);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
90ce3da70b43 Initial load
duke
parents:
diff changeset
   488
        //---------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
        // %s - errors
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
        //---------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
   491
        tryCatch("%-s", MissingFormatWidthException.class);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   492
        tryCatch("%--s", DuplicateFormatFlagsException.class);
3416
0dd4f82becda 5063507: (fmt) missing exception for "%#s" format specifier
sherman
parents: 1823
diff changeset
   493
        tryCatch("%#s", FormatFlagsConversionMismatchException.class, 0);
0dd4f82becda 5063507: (fmt) missing exception for "%#s" format specifier
sherman
parents: 1823
diff changeset
   494
        tryCatch("%#s", FormatFlagsConversionMismatchException.class, 0.5f);
0dd4f82becda 5063507: (fmt) missing exception for "%#s" format specifier
sherman
parents: 1823
diff changeset
   495
        tryCatch("%#s", FormatFlagsConversionMismatchException.class, "hello");
0dd4f82becda 5063507: (fmt) missing exception for "%#s" format specifier
sherman
parents: 1823
diff changeset
   496
        tryCatch("%#s", FormatFlagsConversionMismatchException.class, null);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   497
90ce3da70b43 Initial load
duke
parents:
diff changeset
   498
        //---------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
   499
        // %h
90ce3da70b43 Initial load
duke
parents:
diff changeset
   500
        //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
        // General conversion applicable to any argument.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   502
        //---------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
   503
        test("%h", Integer.toHexString("Hello, Duke".hashCode()),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   504
             "Hello, Duke");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   505
        test("%10h", "  ddf63471", "Hello, Duke");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   506
        test("%-10h", "ddf63471  ", "Hello, Duke");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   507
        test("%-10H", "DDF63471  ", "Hello, Duke");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   508
        test("%10h", "  402e0000", 15.0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   509
        test("%10H", "  402E0000", 15.0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   510
90ce3da70b43 Initial load
duke
parents:
diff changeset
   511
        //---------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
   512
        // %h - errors
90ce3da70b43 Initial load
duke
parents:
diff changeset
   513
        //---------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
   514
        tryCatch("%#h", FormatFlagsConversionMismatchException.class);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   515
90ce3da70b43 Initial load
duke
parents:
diff changeset
   516
        //---------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
   517
        // flag/conversion errors
90ce3da70b43 Initial load
duke
parents:
diff changeset
   518
        //---------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
   519
        tryCatch("%F", UnknownFormatConversionException.class);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   520
90ce3da70b43 Initial load
duke
parents:
diff changeset
   521
        tryCatch("%#g", FormatFlagsConversionMismatchException.class);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   522
90ce3da70b43 Initial load
duke
parents:
diff changeset
   523
90ce3da70b43 Initial load
duke
parents:
diff changeset
   524
90ce3da70b43 Initial load
duke
parents:
diff changeset
   525
90ce3da70b43 Initial load
duke
parents:
diff changeset
   526
90ce3da70b43 Initial load
duke
parents:
diff changeset
   527
90ce3da70b43 Initial load
duke
parents:
diff changeset
   528
90ce3da70b43 Initial load
duke
parents:
diff changeset
   529
90ce3da70b43 Initial load
duke
parents:
diff changeset
   530
90ce3da70b43 Initial load
duke
parents:
diff changeset
   531
90ce3da70b43 Initial load
duke
parents:
diff changeset
   532
90ce3da70b43 Initial load
duke
parents:
diff changeset
   533
90ce3da70b43 Initial load
duke
parents:
diff changeset
   534
90ce3da70b43 Initial load
duke
parents:
diff changeset
   535
90ce3da70b43 Initial load
duke
parents:
diff changeset
   536
90ce3da70b43 Initial load
duke
parents:
diff changeset
   537
90ce3da70b43 Initial load
duke
parents:
diff changeset
   538
90ce3da70b43 Initial load
duke
parents:
diff changeset
   539
90ce3da70b43 Initial load
duke
parents:
diff changeset
   540
90ce3da70b43 Initial load
duke
parents:
diff changeset
   541
90ce3da70b43 Initial load
duke
parents:
diff changeset
   542
90ce3da70b43 Initial load
duke
parents:
diff changeset
   543
90ce3da70b43 Initial load
duke
parents:
diff changeset
   544
90ce3da70b43 Initial load
duke
parents:
diff changeset
   545
90ce3da70b43 Initial load
duke
parents:
diff changeset
   546
90ce3da70b43 Initial load
duke
parents:
diff changeset
   547
90ce3da70b43 Initial load
duke
parents:
diff changeset
   548
90ce3da70b43 Initial load
duke
parents:
diff changeset
   549
90ce3da70b43 Initial load
duke
parents:
diff changeset
   550
90ce3da70b43 Initial load
duke
parents:
diff changeset
   551
90ce3da70b43 Initial load
duke
parents:
diff changeset
   552
90ce3da70b43 Initial load
duke
parents:
diff changeset
   553
90ce3da70b43 Initial load
duke
parents:
diff changeset
   554
90ce3da70b43 Initial load
duke
parents:
diff changeset
   555
90ce3da70b43 Initial load
duke
parents:
diff changeset
   556
90ce3da70b43 Initial load
duke
parents:
diff changeset
   557
90ce3da70b43 Initial load
duke
parents:
diff changeset
   558
90ce3da70b43 Initial load
duke
parents:
diff changeset
   559
90ce3da70b43 Initial load
duke
parents:
diff changeset
   560
90ce3da70b43 Initial load
duke
parents:
diff changeset
   561
90ce3da70b43 Initial load
duke
parents:
diff changeset
   562
90ce3da70b43 Initial load
duke
parents:
diff changeset
   563
90ce3da70b43 Initial load
duke
parents:
diff changeset
   564
90ce3da70b43 Initial load
duke
parents:
diff changeset
   565
90ce3da70b43 Initial load
duke
parents:
diff changeset
   566
90ce3da70b43 Initial load
duke
parents:
diff changeset
   567
90ce3da70b43 Initial load
duke
parents:
diff changeset
   568
90ce3da70b43 Initial load
duke
parents:
diff changeset
   569
90ce3da70b43 Initial load
duke
parents:
diff changeset
   570
90ce3da70b43 Initial load
duke
parents:
diff changeset
   571
90ce3da70b43 Initial load
duke
parents:
diff changeset
   572
90ce3da70b43 Initial load
duke
parents:
diff changeset
   573
90ce3da70b43 Initial load
duke
parents:
diff changeset
   574
90ce3da70b43 Initial load
duke
parents:
diff changeset
   575
90ce3da70b43 Initial load
duke
parents:
diff changeset
   576
90ce3da70b43 Initial load
duke
parents:
diff changeset
   577
90ce3da70b43 Initial load
duke
parents:
diff changeset
   578
90ce3da70b43 Initial load
duke
parents:
diff changeset
   579
90ce3da70b43 Initial load
duke
parents:
diff changeset
   580
90ce3da70b43 Initial load
duke
parents:
diff changeset
   581
90ce3da70b43 Initial load
duke
parents:
diff changeset
   582
90ce3da70b43 Initial load
duke
parents:
diff changeset
   583
90ce3da70b43 Initial load
duke
parents:
diff changeset
   584
90ce3da70b43 Initial load
duke
parents:
diff changeset
   585
90ce3da70b43 Initial load
duke
parents:
diff changeset
   586
90ce3da70b43 Initial load
duke
parents:
diff changeset
   587
90ce3da70b43 Initial load
duke
parents:
diff changeset
   588
90ce3da70b43 Initial load
duke
parents:
diff changeset
   589
90ce3da70b43 Initial load
duke
parents:
diff changeset
   590
90ce3da70b43 Initial load
duke
parents:
diff changeset
   591
90ce3da70b43 Initial load
duke
parents:
diff changeset
   592
90ce3da70b43 Initial load
duke
parents:
diff changeset
   593
90ce3da70b43 Initial load
duke
parents:
diff changeset
   594
90ce3da70b43 Initial load
duke
parents:
diff changeset
   595
90ce3da70b43 Initial load
duke
parents:
diff changeset
   596
90ce3da70b43 Initial load
duke
parents:
diff changeset
   597
90ce3da70b43 Initial load
duke
parents:
diff changeset
   598
90ce3da70b43 Initial load
duke
parents:
diff changeset
   599
90ce3da70b43 Initial load
duke
parents:
diff changeset
   600
90ce3da70b43 Initial load
duke
parents:
diff changeset
   601
90ce3da70b43 Initial load
duke
parents:
diff changeset
   602
90ce3da70b43 Initial load
duke
parents:
diff changeset
   603
90ce3da70b43 Initial load
duke
parents:
diff changeset
   604
90ce3da70b43 Initial load
duke
parents:
diff changeset
   605
90ce3da70b43 Initial load
duke
parents:
diff changeset
   606
90ce3da70b43 Initial load
duke
parents:
diff changeset
   607
90ce3da70b43 Initial load
duke
parents:
diff changeset
   608
90ce3da70b43 Initial load
duke
parents:
diff changeset
   609
90ce3da70b43 Initial load
duke
parents:
diff changeset
   610
90ce3da70b43 Initial load
duke
parents:
diff changeset
   611
90ce3da70b43 Initial load
duke
parents:
diff changeset
   612
90ce3da70b43 Initial load
duke
parents:
diff changeset
   613
90ce3da70b43 Initial load
duke
parents:
diff changeset
   614
90ce3da70b43 Initial load
duke
parents:
diff changeset
   615
90ce3da70b43 Initial load
duke
parents:
diff changeset
   616
90ce3da70b43 Initial load
duke
parents:
diff changeset
   617
90ce3da70b43 Initial load
duke
parents:
diff changeset
   618
90ce3da70b43 Initial load
duke
parents:
diff changeset
   619
90ce3da70b43 Initial load
duke
parents:
diff changeset
   620
90ce3da70b43 Initial load
duke
parents:
diff changeset
   621
90ce3da70b43 Initial load
duke
parents:
diff changeset
   622
90ce3da70b43 Initial load
duke
parents:
diff changeset
   623
90ce3da70b43 Initial load
duke
parents:
diff changeset
   624
90ce3da70b43 Initial load
duke
parents:
diff changeset
   625
90ce3da70b43 Initial load
duke
parents:
diff changeset
   626
90ce3da70b43 Initial load
duke
parents:
diff changeset
   627
90ce3da70b43 Initial load
duke
parents:
diff changeset
   628
90ce3da70b43 Initial load
duke
parents:
diff changeset
   629
90ce3da70b43 Initial load
duke
parents:
diff changeset
   630
90ce3da70b43 Initial load
duke
parents:
diff changeset
   631
90ce3da70b43 Initial load
duke
parents:
diff changeset
   632
90ce3da70b43 Initial load
duke
parents:
diff changeset
   633
90ce3da70b43 Initial load
duke
parents:
diff changeset
   634
90ce3da70b43 Initial load
duke
parents:
diff changeset
   635
90ce3da70b43 Initial load
duke
parents:
diff changeset
   636
90ce3da70b43 Initial load
duke
parents:
diff changeset
   637
90ce3da70b43 Initial load
duke
parents:
diff changeset
   638
90ce3da70b43 Initial load
duke
parents:
diff changeset
   639
90ce3da70b43 Initial load
duke
parents:
diff changeset
   640
90ce3da70b43 Initial load
duke
parents:
diff changeset
   641
90ce3da70b43 Initial load
duke
parents:
diff changeset
   642
90ce3da70b43 Initial load
duke
parents:
diff changeset
   643
90ce3da70b43 Initial load
duke
parents:
diff changeset
   644
90ce3da70b43 Initial load
duke
parents:
diff changeset
   645
90ce3da70b43 Initial load
duke
parents:
diff changeset
   646
90ce3da70b43 Initial load
duke
parents:
diff changeset
   647
90ce3da70b43 Initial load
duke
parents:
diff changeset
   648
90ce3da70b43 Initial load
duke
parents:
diff changeset
   649
90ce3da70b43 Initial load
duke
parents:
diff changeset
   650
90ce3da70b43 Initial load
duke
parents:
diff changeset
   651
90ce3da70b43 Initial load
duke
parents:
diff changeset
   652
90ce3da70b43 Initial load
duke
parents:
diff changeset
   653
90ce3da70b43 Initial load
duke
parents:
diff changeset
   654
90ce3da70b43 Initial load
duke
parents:
diff changeset
   655
90ce3da70b43 Initial load
duke
parents:
diff changeset
   656
90ce3da70b43 Initial load
duke
parents:
diff changeset
   657
90ce3da70b43 Initial load
duke
parents:
diff changeset
   658
90ce3da70b43 Initial load
duke
parents:
diff changeset
   659
90ce3da70b43 Initial load
duke
parents:
diff changeset
   660
90ce3da70b43 Initial load
duke
parents:
diff changeset
   661
90ce3da70b43 Initial load
duke
parents:
diff changeset
   662
90ce3da70b43 Initial load
duke
parents:
diff changeset
   663
90ce3da70b43 Initial load
duke
parents:
diff changeset
   664
90ce3da70b43 Initial load
duke
parents:
diff changeset
   665
90ce3da70b43 Initial load
duke
parents:
diff changeset
   666
90ce3da70b43 Initial load
duke
parents:
diff changeset
   667
90ce3da70b43 Initial load
duke
parents:
diff changeset
   668
90ce3da70b43 Initial load
duke
parents:
diff changeset
   669
90ce3da70b43 Initial load
duke
parents:
diff changeset
   670
90ce3da70b43 Initial load
duke
parents:
diff changeset
   671
90ce3da70b43 Initial load
duke
parents:
diff changeset
   672
90ce3da70b43 Initial load
duke
parents:
diff changeset
   673
90ce3da70b43 Initial load
duke
parents:
diff changeset
   674
90ce3da70b43 Initial load
duke
parents:
diff changeset
   675
90ce3da70b43 Initial load
duke
parents:
diff changeset
   676
90ce3da70b43 Initial load
duke
parents:
diff changeset
   677
90ce3da70b43 Initial load
duke
parents:
diff changeset
   678
90ce3da70b43 Initial load
duke
parents:
diff changeset
   679
90ce3da70b43 Initial load
duke
parents:
diff changeset
   680
90ce3da70b43 Initial load
duke
parents:
diff changeset
   681
90ce3da70b43 Initial load
duke
parents:
diff changeset
   682
90ce3da70b43 Initial load
duke
parents:
diff changeset
   683
90ce3da70b43 Initial load
duke
parents:
diff changeset
   684
90ce3da70b43 Initial load
duke
parents:
diff changeset
   685
90ce3da70b43 Initial load
duke
parents:
diff changeset
   686
90ce3da70b43 Initial load
duke
parents:
diff changeset
   687
90ce3da70b43 Initial load
duke
parents:
diff changeset
   688
90ce3da70b43 Initial load
duke
parents:
diff changeset
   689
90ce3da70b43 Initial load
duke
parents:
diff changeset
   690
90ce3da70b43 Initial load
duke
parents:
diff changeset
   691
90ce3da70b43 Initial load
duke
parents:
diff changeset
   692
90ce3da70b43 Initial load
duke
parents:
diff changeset
   693
90ce3da70b43 Initial load
duke
parents:
diff changeset
   694
90ce3da70b43 Initial load
duke
parents:
diff changeset
   695
90ce3da70b43 Initial load
duke
parents:
diff changeset
   696
90ce3da70b43 Initial load
duke
parents:
diff changeset
   697
90ce3da70b43 Initial load
duke
parents:
diff changeset
   698
90ce3da70b43 Initial load
duke
parents:
diff changeset
   699
90ce3da70b43 Initial load
duke
parents:
diff changeset
   700
90ce3da70b43 Initial load
duke
parents:
diff changeset
   701
90ce3da70b43 Initial load
duke
parents:
diff changeset
   702
90ce3da70b43 Initial load
duke
parents:
diff changeset
   703
90ce3da70b43 Initial load
duke
parents:
diff changeset
   704
90ce3da70b43 Initial load
duke
parents:
diff changeset
   705
90ce3da70b43 Initial load
duke
parents:
diff changeset
   706
90ce3da70b43 Initial load
duke
parents:
diff changeset
   707
90ce3da70b43 Initial load
duke
parents:
diff changeset
   708
90ce3da70b43 Initial load
duke
parents:
diff changeset
   709
90ce3da70b43 Initial load
duke
parents:
diff changeset
   710
90ce3da70b43 Initial load
duke
parents:
diff changeset
   711
90ce3da70b43 Initial load
duke
parents:
diff changeset
   712
90ce3da70b43 Initial load
duke
parents:
diff changeset
   713
90ce3da70b43 Initial load
duke
parents:
diff changeset
   714
90ce3da70b43 Initial load
duke
parents:
diff changeset
   715
90ce3da70b43 Initial load
duke
parents:
diff changeset
   716
90ce3da70b43 Initial load
duke
parents:
diff changeset
   717
90ce3da70b43 Initial load
duke
parents:
diff changeset
   718
90ce3da70b43 Initial load
duke
parents:
diff changeset
   719
90ce3da70b43 Initial load
duke
parents:
diff changeset
   720
90ce3da70b43 Initial load
duke
parents:
diff changeset
   721
90ce3da70b43 Initial load
duke
parents:
diff changeset
   722
90ce3da70b43 Initial load
duke
parents:
diff changeset
   723
90ce3da70b43 Initial load
duke
parents:
diff changeset
   724
90ce3da70b43 Initial load
duke
parents:
diff changeset
   725
90ce3da70b43 Initial load
duke
parents:
diff changeset
   726
90ce3da70b43 Initial load
duke
parents:
diff changeset
   727
90ce3da70b43 Initial load
duke
parents:
diff changeset
   728
90ce3da70b43 Initial load
duke
parents:
diff changeset
   729
90ce3da70b43 Initial load
duke
parents:
diff changeset
   730
90ce3da70b43 Initial load
duke
parents:
diff changeset
   731
90ce3da70b43 Initial load
duke
parents:
diff changeset
   732
90ce3da70b43 Initial load
duke
parents:
diff changeset
   733
90ce3da70b43 Initial load
duke
parents:
diff changeset
   734
90ce3da70b43 Initial load
duke
parents:
diff changeset
   735
90ce3da70b43 Initial load
duke
parents:
diff changeset
   736
90ce3da70b43 Initial load
duke
parents:
diff changeset
   737
90ce3da70b43 Initial load
duke
parents:
diff changeset
   738
90ce3da70b43 Initial load
duke
parents:
diff changeset
   739
90ce3da70b43 Initial load
duke
parents:
diff changeset
   740
90ce3da70b43 Initial load
duke
parents:
diff changeset
   741
90ce3da70b43 Initial load
duke
parents:
diff changeset
   742
90ce3da70b43 Initial load
duke
parents:
diff changeset
   743
90ce3da70b43 Initial load
duke
parents:
diff changeset
   744
90ce3da70b43 Initial load
duke
parents:
diff changeset
   745
90ce3da70b43 Initial load
duke
parents:
diff changeset
   746
90ce3da70b43 Initial load
duke
parents:
diff changeset
   747
90ce3da70b43 Initial load
duke
parents:
diff changeset
   748
90ce3da70b43 Initial load
duke
parents:
diff changeset
   749
90ce3da70b43 Initial load
duke
parents:
diff changeset
   750
90ce3da70b43 Initial load
duke
parents:
diff changeset
   751
90ce3da70b43 Initial load
duke
parents:
diff changeset
   752
90ce3da70b43 Initial load
duke
parents:
diff changeset
   753
90ce3da70b43 Initial load
duke
parents:
diff changeset
   754
90ce3da70b43 Initial load
duke
parents:
diff changeset
   755
90ce3da70b43 Initial load
duke
parents:
diff changeset
   756
90ce3da70b43 Initial load
duke
parents:
diff changeset
   757
90ce3da70b43 Initial load
duke
parents:
diff changeset
   758
90ce3da70b43 Initial load
duke
parents:
diff changeset
   759
90ce3da70b43 Initial load
duke
parents:
diff changeset
   760
90ce3da70b43 Initial load
duke
parents:
diff changeset
   761
90ce3da70b43 Initial load
duke
parents:
diff changeset
   762
90ce3da70b43 Initial load
duke
parents:
diff changeset
   763
90ce3da70b43 Initial load
duke
parents:
diff changeset
   764
90ce3da70b43 Initial load
duke
parents:
diff changeset
   765
90ce3da70b43 Initial load
duke
parents:
diff changeset
   766
90ce3da70b43 Initial load
duke
parents:
diff changeset
   767
90ce3da70b43 Initial load
duke
parents:
diff changeset
   768
90ce3da70b43 Initial load
duke
parents:
diff changeset
   769
90ce3da70b43 Initial load
duke
parents:
diff changeset
   770
90ce3da70b43 Initial load
duke
parents:
diff changeset
   771
90ce3da70b43 Initial load
duke
parents:
diff changeset
   772
90ce3da70b43 Initial load
duke
parents:
diff changeset
   773
90ce3da70b43 Initial load
duke
parents:
diff changeset
   774
90ce3da70b43 Initial load
duke
parents:
diff changeset
   775
90ce3da70b43 Initial load
duke
parents:
diff changeset
   776
90ce3da70b43 Initial load
duke
parents:
diff changeset
   777
90ce3da70b43 Initial load
duke
parents:
diff changeset
   778
90ce3da70b43 Initial load
duke
parents:
diff changeset
   779
90ce3da70b43 Initial load
duke
parents:
diff changeset
   780
90ce3da70b43 Initial load
duke
parents:
diff changeset
   781
90ce3da70b43 Initial load
duke
parents:
diff changeset
   782
90ce3da70b43 Initial load
duke
parents:
diff changeset
   783
90ce3da70b43 Initial load
duke
parents:
diff changeset
   784
90ce3da70b43 Initial load
duke
parents:
diff changeset
   785
90ce3da70b43 Initial load
duke
parents:
diff changeset
   786
90ce3da70b43 Initial load
duke
parents:
diff changeset
   787
90ce3da70b43 Initial load
duke
parents:
diff changeset
   788
90ce3da70b43 Initial load
duke
parents:
diff changeset
   789
90ce3da70b43 Initial load
duke
parents:
diff changeset
   790
90ce3da70b43 Initial load
duke
parents:
diff changeset
   791
90ce3da70b43 Initial load
duke
parents:
diff changeset
   792
90ce3da70b43 Initial load
duke
parents:
diff changeset
   793
90ce3da70b43 Initial load
duke
parents:
diff changeset
   794
90ce3da70b43 Initial load
duke
parents:
diff changeset
   795
90ce3da70b43 Initial load
duke
parents:
diff changeset
   796
90ce3da70b43 Initial load
duke
parents:
diff changeset
   797
90ce3da70b43 Initial load
duke
parents:
diff changeset
   798
90ce3da70b43 Initial load
duke
parents:
diff changeset
   799
90ce3da70b43 Initial load
duke
parents:
diff changeset
   800
90ce3da70b43 Initial load
duke
parents:
diff changeset
   801
90ce3da70b43 Initial load
duke
parents:
diff changeset
   802
90ce3da70b43 Initial load
duke
parents:
diff changeset
   803
90ce3da70b43 Initial load
duke
parents:
diff changeset
   804
90ce3da70b43 Initial load
duke
parents:
diff changeset
   805
90ce3da70b43 Initial load
duke
parents:
diff changeset
   806
90ce3da70b43 Initial load
duke
parents:
diff changeset
   807
90ce3da70b43 Initial load
duke
parents:
diff changeset
   808
90ce3da70b43 Initial load
duke
parents:
diff changeset
   809
90ce3da70b43 Initial load
duke
parents:
diff changeset
   810
90ce3da70b43 Initial load
duke
parents:
diff changeset
   811
90ce3da70b43 Initial load
duke
parents:
diff changeset
   812
90ce3da70b43 Initial load
duke
parents:
diff changeset
   813
90ce3da70b43 Initial load
duke
parents:
diff changeset
   814
90ce3da70b43 Initial load
duke
parents:
diff changeset
   815
90ce3da70b43 Initial load
duke
parents:
diff changeset
   816
90ce3da70b43 Initial load
duke
parents:
diff changeset
   817
90ce3da70b43 Initial load
duke
parents:
diff changeset
   818
90ce3da70b43 Initial load
duke
parents:
diff changeset
   819
90ce3da70b43 Initial load
duke
parents:
diff changeset
   820
90ce3da70b43 Initial load
duke
parents:
diff changeset
   821
90ce3da70b43 Initial load
duke
parents:
diff changeset
   822
90ce3da70b43 Initial load
duke
parents:
diff changeset
   823
90ce3da70b43 Initial load
duke
parents:
diff changeset
   824
90ce3da70b43 Initial load
duke
parents:
diff changeset
   825
90ce3da70b43 Initial load
duke
parents:
diff changeset
   826
90ce3da70b43 Initial load
duke
parents:
diff changeset
   827
90ce3da70b43 Initial load
duke
parents:
diff changeset
   828
90ce3da70b43 Initial load
duke
parents:
diff changeset
   829
90ce3da70b43 Initial load
duke
parents:
diff changeset
   830
90ce3da70b43 Initial load
duke
parents:
diff changeset
   831
90ce3da70b43 Initial load
duke
parents:
diff changeset
   832
90ce3da70b43 Initial load
duke
parents:
diff changeset
   833
90ce3da70b43 Initial load
duke
parents:
diff changeset
   834
90ce3da70b43 Initial load
duke
parents:
diff changeset
   835
90ce3da70b43 Initial load
duke
parents:
diff changeset
   836
90ce3da70b43 Initial load
duke
parents:
diff changeset
   837
90ce3da70b43 Initial load
duke
parents:
diff changeset
   838
27725
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
   839
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
   840
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
   841
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
   842
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
   843
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
   844
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
   845
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
   846
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
   847
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
   848
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
   849
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
   850
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
   851
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
   852
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
   853
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
   854
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
   855
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
   856
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
   857
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
   858
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
   859
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
   860
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
   861
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
   862
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
   863
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
   864
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   865
        //---------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
   866
        // %s - BigDecimal
90ce3da70b43 Initial load
duke
parents:
diff changeset
   867
        //---------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
   868
        BigDecimal one = BigDecimal.ONE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   869
        BigDecimal ten = BigDecimal.TEN;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   870
        BigDecimal pi  = new BigDecimal(Math.PI);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   871
        BigDecimal piToThe300 = pi.pow(300);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   872
90ce3da70b43 Initial load
duke
parents:
diff changeset
   873
        test("%s", "3.141592653589793115997963468544185161590576171875", pi);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   874
90ce3da70b43 Initial load
duke
parents:
diff changeset
   875
90ce3da70b43 Initial load
duke
parents:
diff changeset
   876
90ce3da70b43 Initial load
duke
parents:
diff changeset
   877
90ce3da70b43 Initial load
duke
parents:
diff changeset
   878
90ce3da70b43 Initial load
duke
parents:
diff changeset
   879
90ce3da70b43 Initial load
duke
parents:
diff changeset
   880
90ce3da70b43 Initial load
duke
parents:
diff changeset
   881
90ce3da70b43 Initial load
duke
parents:
diff changeset
   882
90ce3da70b43 Initial load
duke
parents:
diff changeset
   883
90ce3da70b43 Initial load
duke
parents:
diff changeset
   884
90ce3da70b43 Initial load
duke
parents:
diff changeset
   885
90ce3da70b43 Initial load
duke
parents:
diff changeset
   886
90ce3da70b43 Initial load
duke
parents:
diff changeset
   887
90ce3da70b43 Initial load
duke
parents:
diff changeset
   888
90ce3da70b43 Initial load
duke
parents:
diff changeset
   889
90ce3da70b43 Initial load
duke
parents:
diff changeset
   890
90ce3da70b43 Initial load
duke
parents:
diff changeset
   891
90ce3da70b43 Initial load
duke
parents:
diff changeset
   892
90ce3da70b43 Initial load
duke
parents:
diff changeset
   893
90ce3da70b43 Initial load
duke
parents:
diff changeset
   894
90ce3da70b43 Initial load
duke
parents:
diff changeset
   895
90ce3da70b43 Initial load
duke
parents:
diff changeset
   896
90ce3da70b43 Initial load
duke
parents:
diff changeset
   897
90ce3da70b43 Initial load
duke
parents:
diff changeset
   898
90ce3da70b43 Initial load
duke
parents:
diff changeset
   899
90ce3da70b43 Initial load
duke
parents:
diff changeset
   900
90ce3da70b43 Initial load
duke
parents:
diff changeset
   901
90ce3da70b43 Initial load
duke
parents:
diff changeset
   902
90ce3da70b43 Initial load
duke
parents:
diff changeset
   903
90ce3da70b43 Initial load
duke
parents:
diff changeset
   904
90ce3da70b43 Initial load
duke
parents:
diff changeset
   905
90ce3da70b43 Initial load
duke
parents:
diff changeset
   906
90ce3da70b43 Initial load
duke
parents:
diff changeset
   907
90ce3da70b43 Initial load
duke
parents:
diff changeset
   908
90ce3da70b43 Initial load
duke
parents:
diff changeset
   909
90ce3da70b43 Initial load
duke
parents:
diff changeset
   910
90ce3da70b43 Initial load
duke
parents:
diff changeset
   911
90ce3da70b43 Initial load
duke
parents:
diff changeset
   912
90ce3da70b43 Initial load
duke
parents:
diff changeset
   913
90ce3da70b43 Initial load
duke
parents:
diff changeset
   914
90ce3da70b43 Initial load
duke
parents:
diff changeset
   915
90ce3da70b43 Initial load
duke
parents:
diff changeset
   916
        //---------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
   917
        // flag/conversion errors
90ce3da70b43 Initial load
duke
parents:
diff changeset
   918
        //---------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
   919
        tryCatch("%d", IllegalFormatConversionException.class, one);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   920
        tryCatch("%,.4e", FormatFlagsConversionMismatchException.class, one);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   921
90ce3da70b43 Initial load
duke
parents:
diff changeset
   922
        //---------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
   923
        // %e
90ce3da70b43 Initial load
duke
parents:
diff changeset
   924
        //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   925
        // Floating-point conversions applicable to float, double, and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   926
        // BigDecimal.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   927
        //---------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
   928
        test("%e", "null", (Object)null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   929
90ce3da70b43 Initial load
duke
parents:
diff changeset
   930
        //---------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
   931
        // %e - float and double
90ce3da70b43 Initial load
duke
parents:
diff changeset
   932
        //---------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
   933
        // double PI = 3.141 592 653 589 793 238 46;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   934
        test("%e", "3.141593e+00", pi);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   935
        test("%.0e", "1e+01", ten);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   936
        test("%#.0e", "1.e+01", ten);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   937
        test("%E", "3.141593E+00", pi);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   938
        test("%10.3e", " 3.142e+00", pi);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   939
        test("%10.3e", "-3.142e+00", negate(pi));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   940
        test("%010.3e", "03.142e+00", pi);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   941
        test("%010.3e", "-3.142e+00", negate(pi));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   942
        test("%-12.3e", "3.142e+00   ", pi);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   943
        test("%-12.3e", "-3.142e+00  ", negate(pi));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   944
        test("%.3e", "3.142e+00", pi);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   945
        test("%.3e", "-3.142e+00", negate(pi));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   946
        test("%.3e", "3.142e+06", mult(pi, 1000000.0));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   947
        test("%.3e", "-3.142e+06", mult(pi, -1000000.0));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   948
90ce3da70b43 Initial load
duke
parents:
diff changeset
   949
        test(Locale.FRANCE, "%e", "3,141593e+00", pi);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   950
90ce3da70b43 Initial load
duke
parents:
diff changeset
   951
        // double PI^300
90ce3da70b43 Initial load
duke
parents:
diff changeset
   952
        //    = 13962455701329742638131355433930076081862072808 ... e+149
90ce3da70b43 Initial load
duke
parents:
diff changeset
   953
90ce3da70b43 Initial load
duke
parents:
diff changeset
   954
        //---------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
   955
        // %e - BigDecimal
90ce3da70b43 Initial load
duke
parents:
diff changeset
   956
        //---------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
   957
        test("%.3e", "1.396e+149", piToThe300);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   958
        test("%.3e", "-1.396e+149", piToThe300.negate());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   959
        test("%.3e", "1.000e-100", recip(ten.pow(100)));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   960
        test("%.3e", "-1.000e-100", negate(recip(ten.pow(100))));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   961
90ce3da70b43 Initial load
duke
parents:
diff changeset
   962
        test("%3.0e", "1e-06", new BigDecimal("0.000001"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   963
        test("%3.0e", "1e-05", new BigDecimal("0.00001"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   964
        test("%3.0e", "1e-04", new BigDecimal("0.0001"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   965
        test("%3.0e", "1e-03", new BigDecimal("0.001"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   966
        test("%3.0e", "1e-02", new BigDecimal("0.01"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   967
        test("%3.0e", "1e-01", new BigDecimal("0.1"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   968
        test("%3.0e", "9e-01", new BigDecimal("0.9"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   969
        test("%3.1e", "9.0e-01", new BigDecimal("0.9"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   970
        test("%3.0e", "1e+00", new BigDecimal("1.00"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   971
        test("%3.0e", "1e+01", new BigDecimal("10.00"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   972
        test("%3.0e", "1e+02", new BigDecimal("99.19"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   973
        test("%3.1e", "9.9e+01", new BigDecimal("99.19"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   974
        test("%3.0e", "1e+02", new BigDecimal("99.99"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   975
        test("%3.0e", "1e+02", new BigDecimal("100.00"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   976
        test("%#3.0e", "1.e+03",    new BigDecimal("1000.00"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   977
        test("%3.0e", "1e+04",     new BigDecimal("10000.00"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   978
        test("%3.0e", "1e+05",    new BigDecimal("100000.00"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   979
        test("%3.0e", "1e+06",   new BigDecimal("1000000.00"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   980
        test("%3.0e", "1e+07",  new BigDecimal("10000000.00"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   981
        test("%3.0e", "1e+08", new BigDecimal("100000000.00"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   982
90ce3da70b43 Initial load
duke
parents:
diff changeset
   983
90ce3da70b43 Initial load
duke
parents:
diff changeset
   984
        test("%10.3e", " 1.000e+00", one);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   985
        test("%+.3e", "+3.142e+00", pi);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   986
        test("%+.3e", "-3.142e+00", negate(pi));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   987
        test("% .3e", " 3.142e+00", pi);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   988
        test("% .3e", "-3.142e+00", negate(pi));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   989
        test("%#.0e", "3.e+00", create(3.0));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   990
        test("%#.0e", "-3.e+00", create(-3.0));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   991
        test("%.0e", "3e+00", create(3.0));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   992
        test("%.0e", "-3e+00", create(-3.0));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   993
90ce3da70b43 Initial load
duke
parents:
diff changeset
   994
        test("%(.4e", "3.1416e+06", mult(pi, 1000000.0));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   995
        test("%(.4e", "(3.1416e+06)", mult(pi, -1000000.0));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   996
90ce3da70b43 Initial load
duke
parents:
diff changeset
   997
        //---------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
   998
        // %e - boundary problems
90ce3da70b43 Initial load
duke
parents:
diff changeset
   999
        //---------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1000
        test("%3.0e", "1e-06", 0.000001);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1001
        test("%3.0e", "1e-05", 0.00001);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1002
        test("%3.0e", "1e-04", 0.0001);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1003
        test("%3.0e", "1e-03", 0.001);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1004
        test("%3.0e", "1e-02", 0.01);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1005
        test("%3.0e", "1e-01", 0.1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1006
        test("%3.0e", "9e-01", 0.9);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1007
        test("%3.1e", "9.0e-01", 0.9);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1008
        test("%3.0e", "1e+00", 1.00);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1009
        test("%3.0e", "1e+01", 10.00);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1010
        test("%3.0e", "1e+02", 99.19);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1011
        test("%3.1e", "9.9e+01", 99.19);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1012
        test("%3.0e", "1e+02", 99.99);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1013
        test("%3.0e", "1e+02", 100.00);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1014
        test("%#3.0e", "1.e+03",     1000.00);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1015
        test("%3.0e", "1e+04",     10000.00);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1016
        test("%3.0e", "1e+05",    100000.00);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1017
        test("%3.0e", "1e+06",   1000000.00);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1018
        test("%3.0e", "1e+07",  10000000.00);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1019
        test("%3.0e", "1e+08", 100000000.00);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1020
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1021
        //---------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1022
        // %f
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1023
        //
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1024
        // Floating-point conversions applicable to float, double, and
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1025
        // BigDecimal.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1026
        //---------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1027
        test("%f", "null", (Object)null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1028
        test("%f", "3.141593", pi);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1029
        test(Locale.FRANCE, "%f", "3,141593", pi);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1030
        test("%10.3f", "     3.142", pi);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1031
        test("%10.3f", "    -3.142", negate(pi));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1032
        test("%010.3f", "000003.142", pi);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1033
        test("%010.3f", "-00003.142", negate(pi));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1034
        test("%-10.3f", "3.142     ", pi);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1035
        test("%-10.3f", "-3.142    ", negate(pi));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1036
        test("%.3f", "3.142", pi);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1037
        test("%.3f", "-3.142", negate(pi));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1038
        test("%+.3f", "+3.142", pi);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1039
        test("%+.3f", "-3.142", negate(pi));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1040
        test("% .3f", " 3.142", pi);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1041
        test("% .3f", "-3.142", negate(pi));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1042
        test("%#.0f", "3.", create(3.0));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1043
        test("%#.0f", "-3.", create(-3.0));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1044
        test("%.0f", "3", create(3.0));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1045
        test("%.0f", "-3", create(-3.0));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1046
        test("%.3f", "10.000", ten);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1047
        test("%.3f", "1.000", one);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1048
        test("%10.3f", "     1.000", one);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1049
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1050
        //---------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1051
        // %f - boundary problems
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1052
        //---------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1053
        test("%3.0f", "  0", 0.000001);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1054
        test("%3.0f", "  0", 0.00001);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1055
        test("%3.0f", "  0", 0.0001);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1056
        test("%3.0f", "  0", 0.001);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1057
        test("%3.0f", "  0", 0.01);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1058
        test("%3.0f", "  0", 0.1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1059
        test("%3.0f", "  1", 0.9);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1060
        test("%3.1f", "0.9", 0.9);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1061
        test("%3.0f", "  1", 1.00);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1062
        test("%3.0f", " 10", 10.00);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1063
        test("%3.0f", " 99", 99.19);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1064
        test("%3.1f", "99.2", 99.19);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1065
        test("%3.0f", "100", 99.99);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1066
        test("%3.0f", "100", 100.00);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1067
        test("%#3.0f", "1000.",     1000.00);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1068
        test("%3.0f", "10000",     10000.00);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1069
        test("%3.0f", "100000",    100000.00);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1070
        test("%3.0f", "1000000",   1000000.00);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1071
        test("%3.0f", "10000000",  10000000.00);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1072
        test("%3.0f", "100000000", 100000000.00);
27725
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
  1073
        test("%10.0f", "   1000000",   1000000.00);
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
  1074
        test("%,10.0f", " 1,000,000",   1000000.00);
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
  1075
        test("%,10.1f", "1,000,000.0",   1000000.00);
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
  1076
        test("%,3.0f", "1,000,000",   1000000.00);
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
  1077
        test("%,3.0f", "10,000,000",  10000000.00);
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
  1078
        test("%,3.0f", "100,000,000", 100000000.00);
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
  1079
        test("%,3.0f", "10,000,000",  10000000.00);
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
  1080
        test("%,3.0f", "100,000,000", 100000000.00);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1081
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1082
        //---------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1083
        // %f - BigDecimal
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1084
        //---------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1085
        test("%4.0f", "  99", new BigDecimal("99.19"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1086
        test("%4.1f", "99.2", new BigDecimal("99.19"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1087
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1088
        BigDecimal val = new BigDecimal("99.95");
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1089
        test("%4.0f", " 100", val);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1090
        test("%#4.0f", "100.", val);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1091
        test("%4.1f", "100.0", val);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1092
        test("%4.2f", "99.95", val);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1093
        test("%4.3f", "99.950", val);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1094
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1095
        val = new BigDecimal(".99");
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1096
        test("%4.1f", " 1.0", val);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1097
        test("%4.2f", "0.99", val);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1098
        test("%4.3f", "0.990", val);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1099
1823
23d42a96635e 6476425: (fmt)java.util.Formatter.print() throws IllegalArgumentException on large BigDecima
sherman
parents: 2
diff changeset
  1100
        // #6476425
23d42a96635e 6476425: (fmt)java.util.Formatter.print() throws IllegalArgumentException on large BigDecima
sherman
parents: 2
diff changeset
  1101
        val = new BigDecimal("0.00001");
23d42a96635e 6476425: (fmt)java.util.Formatter.print() throws IllegalArgumentException on large BigDecima
sherman
parents: 2
diff changeset
  1102
        test("%.0f", "0", val);
23d42a96635e 6476425: (fmt)java.util.Formatter.print() throws IllegalArgumentException on large BigDecima
sherman
parents: 2
diff changeset
  1103
        test("%.1f", "0.0", val);
23d42a96635e 6476425: (fmt)java.util.Formatter.print() throws IllegalArgumentException on large BigDecima
sherman
parents: 2
diff changeset
  1104
        test("%.2f", "0.00", val);
23d42a96635e 6476425: (fmt)java.util.Formatter.print() throws IllegalArgumentException on large BigDecima
sherman
parents: 2
diff changeset
  1105
        test("%.3f", "0.000", val);
23d42a96635e 6476425: (fmt)java.util.Formatter.print() throws IllegalArgumentException on large BigDecima
sherman
parents: 2
diff changeset
  1106
        test("%.4f", "0.0000", val);
23d42a96635e 6476425: (fmt)java.util.Formatter.print() throws IllegalArgumentException on large BigDecima
sherman
parents: 2
diff changeset
  1107
        test("%.5f", "0.00001", val);
23d42a96635e 6476425: (fmt)java.util.Formatter.print() throws IllegalArgumentException on large BigDecima
sherman
parents: 2
diff changeset
  1108
23d42a96635e 6476425: (fmt)java.util.Formatter.print() throws IllegalArgumentException on large BigDecima
sherman
parents: 2
diff changeset
  1109
        val = new BigDecimal("1.00001");
23d42a96635e 6476425: (fmt)java.util.Formatter.print() throws IllegalArgumentException on large BigDecima
sherman
parents: 2
diff changeset
  1110
        test("%.0f", "1", val);
23d42a96635e 6476425: (fmt)java.util.Formatter.print() throws IllegalArgumentException on large BigDecima
sherman
parents: 2
diff changeset
  1111
        test("%.1f", "1.0", val);
23d42a96635e 6476425: (fmt)java.util.Formatter.print() throws IllegalArgumentException on large BigDecima
sherman
parents: 2
diff changeset
  1112
        test("%.2f", "1.00", val);
23d42a96635e 6476425: (fmt)java.util.Formatter.print() throws IllegalArgumentException on large BigDecima
sherman
parents: 2
diff changeset
  1113
        test("%.3f", "1.000", val);
23d42a96635e 6476425: (fmt)java.util.Formatter.print() throws IllegalArgumentException on large BigDecima
sherman
parents: 2
diff changeset
  1114
        test("%.4f", "1.0000", val);
23d42a96635e 6476425: (fmt)java.util.Formatter.print() throws IllegalArgumentException on large BigDecima
sherman
parents: 2
diff changeset
  1115
        test("%.5f", "1.00001", val);
23d42a96635e 6476425: (fmt)java.util.Formatter.print() throws IllegalArgumentException on large BigDecima
sherman
parents: 2
diff changeset
  1116
23d42a96635e 6476425: (fmt)java.util.Formatter.print() throws IllegalArgumentException on large BigDecima
sherman
parents: 2
diff changeset
  1117
        val = new BigDecimal("1.23456");
23d42a96635e 6476425: (fmt)java.util.Formatter.print() throws IllegalArgumentException on large BigDecima
sherman
parents: 2
diff changeset
  1118
        test("%.0f", "1", val);
23d42a96635e 6476425: (fmt)java.util.Formatter.print() throws IllegalArgumentException on large BigDecima
sherman
parents: 2
diff changeset
  1119
        test("%.1f", "1.2", val);
23d42a96635e 6476425: (fmt)java.util.Formatter.print() throws IllegalArgumentException on large BigDecima
sherman
parents: 2
diff changeset
  1120
        test("%.2f", "1.23", val);
23d42a96635e 6476425: (fmt)java.util.Formatter.print() throws IllegalArgumentException on large BigDecima
sherman
parents: 2
diff changeset
  1121
        test("%.3f", "1.235", val);
23d42a96635e 6476425: (fmt)java.util.Formatter.print() throws IllegalArgumentException on large BigDecima
sherman
parents: 2
diff changeset
  1122
        test("%.4f", "1.2346", val);
23d42a96635e 6476425: (fmt)java.util.Formatter.print() throws IllegalArgumentException on large BigDecima
sherman
parents: 2
diff changeset
  1123
        test("%.5f", "1.23456", val);
23d42a96635e 6476425: (fmt)java.util.Formatter.print() throws IllegalArgumentException on large BigDecima
sherman
parents: 2
diff changeset
  1124
        test("%.6f", "1.234560", val);
23d42a96635e 6476425: (fmt)java.util.Formatter.print() throws IllegalArgumentException on large BigDecima
sherman
parents: 2
diff changeset
  1125
23d42a96635e 6476425: (fmt)java.util.Formatter.print() throws IllegalArgumentException on large BigDecima
sherman
parents: 2
diff changeset
  1126
        val = new BigDecimal("9.99999");
23d42a96635e 6476425: (fmt)java.util.Formatter.print() throws IllegalArgumentException on large BigDecima
sherman
parents: 2
diff changeset
  1127
        test("%.0f", "10", val);
23d42a96635e 6476425: (fmt)java.util.Formatter.print() throws IllegalArgumentException on large BigDecima
sherman
parents: 2
diff changeset
  1128
        test("%.1f", "10.0", val);
23d42a96635e 6476425: (fmt)java.util.Formatter.print() throws IllegalArgumentException on large BigDecima
sherman
parents: 2
diff changeset
  1129
        test("%.2f", "10.00", val);
23d42a96635e 6476425: (fmt)java.util.Formatter.print() throws IllegalArgumentException on large BigDecima
sherman
parents: 2
diff changeset
  1130
        test("%.3f", "10.000", val);
23d42a96635e 6476425: (fmt)java.util.Formatter.print() throws IllegalArgumentException on large BigDecima
sherman
parents: 2
diff changeset
  1131
        test("%.4f", "10.0000", val);
23d42a96635e 6476425: (fmt)java.util.Formatter.print() throws IllegalArgumentException on large BigDecima
sherman
parents: 2
diff changeset
  1132
        test("%.5f", "9.99999", val);
23d42a96635e 6476425: (fmt)java.util.Formatter.print() throws IllegalArgumentException on large BigDecima
sherman
parents: 2
diff changeset
  1133
        test("%.6f", "9.999990", val);
23d42a96635e 6476425: (fmt)java.util.Formatter.print() throws IllegalArgumentException on large BigDecima
sherman
parents: 2
diff changeset
  1134
23d42a96635e 6476425: (fmt)java.util.Formatter.print() throws IllegalArgumentException on large BigDecima
sherman
parents: 2
diff changeset
  1135
23d42a96635e 6476425: (fmt)java.util.Formatter.print() throws IllegalArgumentException on large BigDecima
sherman
parents: 2
diff changeset
  1136
        val = new BigDecimal("1.99999");
23d42a96635e 6476425: (fmt)java.util.Formatter.print() throws IllegalArgumentException on large BigDecima
sherman
parents: 2
diff changeset
  1137
        test("%.0f", "2", val);
23d42a96635e 6476425: (fmt)java.util.Formatter.print() throws IllegalArgumentException on large BigDecima
sherman
parents: 2
diff changeset
  1138
        test("%.1f", "2.0", val);
23d42a96635e 6476425: (fmt)java.util.Formatter.print() throws IllegalArgumentException on large BigDecima
sherman
parents: 2
diff changeset
  1139
        test("%.2f", "2.00", val);
23d42a96635e 6476425: (fmt)java.util.Formatter.print() throws IllegalArgumentException on large BigDecima
sherman
parents: 2
diff changeset
  1140
        test("%.3f", "2.000", val);
23d42a96635e 6476425: (fmt)java.util.Formatter.print() throws IllegalArgumentException on large BigDecima
sherman
parents: 2
diff changeset
  1141
        test("%.4f", "2.0000", val);
23d42a96635e 6476425: (fmt)java.util.Formatter.print() throws IllegalArgumentException on large BigDecima
sherman
parents: 2
diff changeset
  1142
        test("%.5f", "1.99999", val);
23d42a96635e 6476425: (fmt)java.util.Formatter.print() throws IllegalArgumentException on large BigDecima
sherman
parents: 2
diff changeset
  1143
        test("%.6f", "1.999990", val);
23d42a96635e 6476425: (fmt)java.util.Formatter.print() throws IllegalArgumentException on large BigDecima
sherman
parents: 2
diff changeset
  1144
15520
b5c4972b71cd 6355704: (fmt) %f formatting of BigDecimals is incorrect
mchung
parents: 10608
diff changeset
  1145
        val = new BigDecimal(0.9996);
b5c4972b71cd 6355704: (fmt) %f formatting of BigDecimals is incorrect
mchung
parents: 10608
diff changeset
  1146
        test("%.0f", "1", val);
b5c4972b71cd 6355704: (fmt) %f formatting of BigDecimals is incorrect
mchung
parents: 10608
diff changeset
  1147
        test("%.1f", "1.0", val);
b5c4972b71cd 6355704: (fmt) %f formatting of BigDecimals is incorrect
mchung
parents: 10608
diff changeset
  1148
        test("%.2f", "1.00", val);
b5c4972b71cd 6355704: (fmt) %f formatting of BigDecimals is incorrect
mchung
parents: 10608
diff changeset
  1149
        test("%.3f", "1.000", val);
b5c4972b71cd 6355704: (fmt) %f formatting of BigDecimals is incorrect
mchung
parents: 10608
diff changeset
  1150
        test("%.4f", "0.9996", val);
b5c4972b71cd 6355704: (fmt) %f formatting of BigDecimals is incorrect
mchung
parents: 10608
diff changeset
  1151
        test("%.5f", "0.99960", val);
b5c4972b71cd 6355704: (fmt) %f formatting of BigDecimals is incorrect
mchung
parents: 10608
diff changeset
  1152
        test("%.6f", "0.999600", val);
b5c4972b71cd 6355704: (fmt) %f formatting of BigDecimals is incorrect
mchung
parents: 10608
diff changeset
  1153
28302
5de69b0d3a84 8059175: Zero BigDecimal with negative scale prints leading zeroes in String.format
bpb
parents: 27725
diff changeset
  1154
        val = new BigDecimal(BigInteger.ZERO, 6);
5de69b0d3a84 8059175: Zero BigDecimal with negative scale prints leading zeroes in String.format
bpb
parents: 27725
diff changeset
  1155
        test("%.4f", "0.0000", val);
5de69b0d3a84 8059175: Zero BigDecimal with negative scale prints leading zeroes in String.format
bpb
parents: 27725
diff changeset
  1156
        val = new BigDecimal(BigInteger.ZERO, -6);
5de69b0d3a84 8059175: Zero BigDecimal with negative scale prints leading zeroes in String.format
bpb
parents: 27725
diff changeset
  1157
        test("%.4f", "0.0000", val);
1823
23d42a96635e 6476425: (fmt)java.util.Formatter.print() throws IllegalArgumentException on large BigDecima
sherman
parents: 2
diff changeset
  1158
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1159
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1160
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1161
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1162
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1163
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1164
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1165
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1166
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1167
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1168
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1169
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1170
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1171
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1172
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1173
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1174
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1175
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1176
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1177
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1178
        //---------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1179
        // %f - float, double, Double, BigDecimal
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1180
        //---------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1181
        test("%.3f", "3141592.654", mult(pi, 1000000.0));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1182
        test("%.3f", "-3141592.654", mult(pi, -1000000.0));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1183
        test("%,.4f", "3,141,592.6536", mult(pi, 1000000.0));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1184
        test(Locale.FRANCE, "%,.4f", "3\u00a0141\u00a0592,6536", mult(pi, 1000000.0));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1185
        test("%,.4f", "-3,141,592.6536", mult(pi, -1000000.0));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1186
        test("%(.4f", "3141592.6536", mult(pi, 1000000.0));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1187
        test("%(.4f", "(3141592.6536)", mult(pi, -1000000.0));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1188
        test("%(,.4f", "3,141,592.6536", mult(pi, 1000000.0));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1189
        test("%(,.4f", "(3,141,592.6536)", mult(pi, -1000000.0));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1190
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1191
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1192
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1193
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1194
        //---------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1195
        // %g
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1196
        //
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1197
        // Floating-point conversions applicable to float, double, and
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1198
        // BigDecimal.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1199
        //---------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1200
        test("%g", "null", (Object)null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1201
        test("%g", "3.14159", pi);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1202
        test(Locale.FRANCE, "%g", "3,14159", pi);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1203
        test("%.0g", "1e+01", ten);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1204
        test("%G", "3.14159", pi);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1205
        test("%10.3g", "      3.14", pi);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1206
        test("%10.3g", "     -3.14", negate(pi));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1207
        test("%010.3g", "0000003.14", pi);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1208
        test("%010.3g", "-000003.14", negate(pi));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1209
        test("%-12.3g", "3.14        ", pi);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1210
        test("%-12.3g", "-3.14       ", negate(pi));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1211
        test("%.3g", "3.14", pi);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1212
        test("%.3g", "-3.14", negate(pi));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1213
        test("%.3g", "3.14e+08", mult(pi, 100000000.0));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1214
        test("%.3g", "-3.14e+08", mult(pi, -100000000.0));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1215
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1216
        test("%.3g", "1.00e-05", recip(create(100000.0)));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1217
        test("%.3g", "-1.00e-05", recip(create(-100000.0)));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1218
        test("%.0g", "-1e-05", recip(create(-100000.0)));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1219
        test("%.0g", "1e+05", create(100000.0));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1220
        test("%.3G", "1.00E-05", recip(create(100000.0)));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1221
        test("%.3G", "-1.00E-05", recip(create(-100000.0)));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1222
18545
5f4e734fad1b 6469160: (fmt) general (%g) formatting of zero (0.0) with precision 0 or 1 throws ArrayOutOfBoundsException
bpb
parents: 15520
diff changeset
  1223
        test("%.1g", "-0", -0.0);
5f4e734fad1b 6469160: (fmt) general (%g) formatting of zero (0.0) with precision 0 or 1 throws ArrayOutOfBoundsException
bpb
parents: 15520
diff changeset
  1224
        test("%3.0g", " -0", -0.0);
5f4e734fad1b 6469160: (fmt) general (%g) formatting of zero (0.0) with precision 0 or 1 throws ArrayOutOfBoundsException
bpb
parents: 15520
diff changeset
  1225
        test("%.1g", "0", 0.0);
5f4e734fad1b 6469160: (fmt) general (%g) formatting of zero (0.0) with precision 0 or 1 throws ArrayOutOfBoundsException
bpb
parents: 15520
diff changeset
  1226
        test("%3.0g", "  0", 0.0);
5f4e734fad1b 6469160: (fmt) general (%g) formatting of zero (0.0) with precision 0 or 1 throws ArrayOutOfBoundsException
bpb
parents: 15520
diff changeset
  1227
        test("%.1g", "0", +0.0);
5f4e734fad1b 6469160: (fmt) general (%g) formatting of zero (0.0) with precision 0 or 1 throws ArrayOutOfBoundsException
bpb
parents: 15520
diff changeset
  1228
        test("%3.0g", "  0", +0.0);
5f4e734fad1b 6469160: (fmt) general (%g) formatting of zero (0.0) with precision 0 or 1 throws ArrayOutOfBoundsException
bpb
parents: 15520
diff changeset
  1229
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1230
        test("%3.0g", "1e-06", 0.000001);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1231
        test("%3.0g", "1e-05", 0.00001);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1232
        test("%3.0g", "1e-05", 0.0000099);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1233
        test("%3.1g", "1e-05", 0.0000099);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1234
        test("%3.2g", "9.9e-06", 0.0000099);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1235
        test("%3.0g", "0.0001", 0.0001);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1236
        test("%3.0g", "9e-05",  0.00009);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1237
        test("%3.0g", "0.0001", 0.000099);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1238
        test("%3.1g", "0.0001", 0.000099);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1239
        test("%3.2g", "9.9e-05", 0.000099);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1240
        test("%3.0g", "0.001", 0.001);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1241
        test("%3.0g", "0.001", 0.00099);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1242
        test("%3.1g", "0.001", 0.00099);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1243
        test("%3.2g", "0.00099", 0.00099);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1244
        test("%3.3g", "0.00100", 0.001);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1245
        test("%3.4g", "0.001000", 0.001);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1246
        test("%3.0g", "0.01", 0.01);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1247
        test("%3.0g", "0.1", 0.1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1248
        test("%3.0g", "0.9", 0.9);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1249
        test("%3.1g", "0.9", 0.9);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1250
        test("%3.0g", "  1", 1.00);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1251
        test("%3.2g", " 10", 10.00);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1252
        test("%3.0g", "1e+01", 10.00);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1253
        test("%3.0g", "1e+02", 99.19);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1254
        test("%3.1g", "1e+02", 99.19);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1255
        test("%3.2g", " 99", 99.19);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1256
        test("%3.0g", "1e+02", 99.9);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1257
        test("%3.1g", "1e+02", 99.9);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1258
        test("%3.2g", "1.0e+02", 99.9);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1259
        test("%3.0g", "1e+02", 99.99);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1260
        test("%3.0g", "1e+02", 100.00);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1261
        test("%3.0g", "1e+03", 999.9);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1262
        test("%3.1g", "1e+03", 999.9);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1263
        test("%3.2g", "1.0e+03", 999.9);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1264
        test("%3.3g", "1.00e+03", 999.9);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1265
        test("%3.4g", "999.9", 999.9);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1266
        test("%3.4g", "1000", 999.99);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1267
        test("%3.0g", "1e+03", 1000.00);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1268
        test("%3.0g", "1e+04",     10000.00);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1269
        test("%3.0g", "1e+05",    100000.00);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1270
        test("%3.0g", "1e+06",   1000000.00);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1271
        test("%3.0g", "1e+07",  10000000.00);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1272
        test("%3.9g", "100000000",  100000000.00);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1273
        test("%3.10g", "100000000.0", 100000000.00);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1274
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1275
        tryCatch("%#3.0g", FormatFlagsConversionMismatchException.class, 1000.00);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1276
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1277
        // double PI^300
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1278
        //    = 13962455701329742638131355433930076081862072808 ... e+149
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1279
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1280
        //---------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1281
        // %g - BigDecimal
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1282
        //---------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1283
        test("%.3g", "1.40e+149", piToThe300);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1284
        test("%.3g", "-1.40e+149", piToThe300.negate());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1285
        test(Locale.FRANCE, "%.3g", "-1,40e+149", piToThe300.negate());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1286
        test("%.3g", "1.00e-100", recip(ten.pow(100)));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1287
        test("%.3g", "-1.00e-100", negate(recip(ten.pow(100))));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1288
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1289
        test("%3.0g", "1e-06", new BigDecimal("0.000001"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1290
        test("%3.0g", "1e-05", new BigDecimal("0.00001"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1291
        test("%3.0g", "0.0001", new BigDecimal("0.0001"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1292
        test("%3.0g", "0.001", new BigDecimal("0.001"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1293
        test("%3.3g", "0.00100", new BigDecimal("0.001"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1294
        test("%3.4g", "0.001000", new BigDecimal("0.001"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1295
        test("%3.0g", "0.01", new BigDecimal("0.01"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1296
        test("%3.0g", "0.1", new BigDecimal("0.1"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1297
        test("%3.0g", "0.9", new BigDecimal("0.9"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1298
        test("%3.1g", "0.9", new BigDecimal("0.9"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1299
        test("%3.0g", "  1", new BigDecimal("1.00"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1300
        test("%3.2g", " 10", new BigDecimal("10.00"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1301
        test("%3.0g", "1e+01", new BigDecimal("10.00"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1302
        test("%3.0g", "1e+02", new BigDecimal("99.19"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1303
        test("%3.1g", "1e+02", new BigDecimal("99.19"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1304
        test("%3.2g", " 99", new BigDecimal("99.19"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1305
        test("%3.0g", "1e+02", new BigDecimal("99.99"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1306
        test("%3.0g", "1e+02", new BigDecimal("100.00"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1307
        test("%3.0g", "1e+03", new BigDecimal("1000.00"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1308
        test("%3.0g", "1e+04",      new BigDecimal("10000.00"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1309
        test("%3.0g", "1e+05",      new BigDecimal("100000.00"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1310
        test("%3.0g", "1e+06",      new BigDecimal("1000000.00"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1311
        test("%3.0g", "1e+07",      new BigDecimal("10000000.00"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1312
        test("%3.9g", "100000000",  new BigDecimal("100000000.00"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1313
        test("%3.10g", "100000000.0", new BigDecimal("100000000.00"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1314
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1315
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1316
        test("%.3g", "10.0", ten);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1317
        test("%.3g", "1.00", one);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1318
        test("%10.3g", "      1.00", one);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1319
        test("%+10.3g", "     +3.14", pi);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1320
        test("%+10.3g", "     -3.14", negate(pi));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1321
        test("% .3g", " 3.14", pi);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1322
        test("% .3g", "-3.14", negate(pi));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1323
        test("%.0g", "3", create(3.0));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1324
        test("%.0g", "-3", create(-3.0));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1325
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1326
        test("%(.4g", "3.142e+08", mult(pi, 100000000.0));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1327
        test("%(.4g", "(3.142e+08)", mult(pi, -100000000.0));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1328
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1329
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1330
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1331
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1332
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1333
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1334
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1335
        test("%,.11g", "3,141,592.6536", mult(pi, 1000000.0));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1336
        test("%(,.11g", "(3,141,592.6536)", mult(pi, -1000000.0));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1337
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1338
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1339
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1340
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1341
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1342
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1343
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1344
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1345
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1346
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1347
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1348
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1349
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1350
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1351
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1352
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1353
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1354
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1355
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1356
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1357
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1358
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1359
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1360
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1361
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1362
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1363
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1364
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1365
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1366
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1367
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1368
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1369
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1370
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1371
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1372
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1373
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1374
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1375
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1376
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1377
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1378
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1379
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1380
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1381
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1382
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1383
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1384
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1385
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1386
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1387
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1388
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1389
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1390
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1391
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1392
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1393
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1394
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1395
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1396
27725
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
  1397
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
  1398
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
  1399
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
  1400
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
  1401
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
  1402
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
  1403
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
  1404
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
  1405
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
  1406
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
  1407
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
  1408
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
  1409
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
  1410
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
  1411
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
  1412
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
  1413
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
  1414
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
  1415
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
  1416
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
  1417
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
  1418
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
  1419
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
  1420
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
  1421
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
  1422
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
  1423
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
  1424
433b57a5a5c1 8058887: (fmt) Improve java/util/Formatter test coverage of group separators and width
redestad
parents: 23010
diff changeset
  1425
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1426
        //---------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1427
        // %f, %e, %g, %a - Boundaries
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1428
        //---------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1429
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1430
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1431
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1432
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1433
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1434
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1435
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1436
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1437
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1438
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1439
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1440
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1441
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1442
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1443
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1444
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1445
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1446
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1447
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1448
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1449
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1450
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1451
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1452
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1453
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1454
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1455
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1456
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1457
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1458
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1459
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1460
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1461
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1462
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1463
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1464
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1465
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1466
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1467
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1468
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1469
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1470
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1471
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1472
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1473
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1474
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1475
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1476
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1477
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1478
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1479
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1480
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1481
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1482
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1483
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1484
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1485
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1486
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1487
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1488
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1489
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1490
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1491
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1492
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1493
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1494
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1495
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1496
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1497
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1498
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1499
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1500
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1501
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1502
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1503
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1504
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1505
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1506
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1507
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1508
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1509
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1510
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1511
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1512
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1513
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1514
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1515
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1516
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1517
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1518
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1519
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1520
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1521
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1522
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1523
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1524
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1525
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1526
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1527
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1528
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1529
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1530
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1531
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1532
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1533
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1534
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1535
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1536
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1537
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1538
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1539
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1540
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1541
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1542
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1543
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1544
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1545
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1546
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1547
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1548
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1549
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1550
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1551
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1552
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1553
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1554
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1555
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1556
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1557
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1558
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1559
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1560
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1561
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1562
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1563
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1564
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1565
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1566
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1567
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1568
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1569
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1570
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1571
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1572
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1573
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1574
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1575
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1576
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1577
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1578
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1579
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1580
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1581
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1582
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1583
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1584
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1585
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1586
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1587
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1588
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1589
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1590
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1591
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1592
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1593
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1594
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1595
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1596
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1597
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1598
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1599
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1600
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1601
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1602
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1603
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1604
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1605
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1606
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1607
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1608
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1609
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1610
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1611
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1612
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1613
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1614
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1615
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1616
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1617
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1618
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1619
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1620
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1621
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1622
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1623
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1624
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1625
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1626
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1627
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1628
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1629
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1630
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1631
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1632
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1633
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1634
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1635
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1636
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1637
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1638
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1639
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1640
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1641
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1642
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1643
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1644
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1645
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1646
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1647
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1648
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1649
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1650
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1651
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1652
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1653
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1654
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1655
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1656
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1657
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1658
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1659
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1660
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1661
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1662
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1663
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1664
        //---------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1665
        // %t
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1666
        //
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1667
        // Date/Time conversions applicable to Calendar, Date, and long.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1668
        //---------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1669
        test("%tA", "null", (Object)null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1670
        test("%TA", "NULL", (Object)null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1671
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1672
        //---------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1673
        // %t - errors
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1674
        //---------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1675
        tryCatch("%t", UnknownFormatConversionException.class);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1676
        tryCatch("%T", UnknownFormatConversionException.class);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1677
        tryCatch("%tP", UnknownFormatConversionException.class);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1678
        tryCatch("%TP", UnknownFormatConversionException.class);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1679
        tryCatch("%.5tB", IllegalFormatPrecisionException.class);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1680
        tryCatch("%#tB", FormatFlagsConversionMismatchException.class);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1681
        tryCatch("%-tB", MissingFormatWidthException.class);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1682
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1683
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1684
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1685
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1686
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1687
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1688
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1689
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1690
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1691
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1692
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1693
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1694
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1695
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1696
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1697
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1698
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1699
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1700
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1701
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1702
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1703
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1704
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1705
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1706
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1707
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1708
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1709
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1710
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1711
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1712
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1713
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1714
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1715
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1716
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1717
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1718
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1719
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1720
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1721
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1722
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1723
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1724
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1725
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1726
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1727
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1728
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1729
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1730
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1731
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1732
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1733
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1734
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1735
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1736
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1737
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1738
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1739
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1740
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1741
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1742
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1743
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1744
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1745
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1746
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1747
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1748
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1749
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1750
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1751
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1752
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1753
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1754
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1755
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1756
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1757
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1758
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1759
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1760
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1761
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1762
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1763
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1764
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1765
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1766
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1767
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1768
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1769
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1770
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1771
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1772
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1773
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1774
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1775
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1776
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1777
        //---------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1778
        // %n
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1779
        //---------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1780
        test("%n", System.getProperty("line.separator"), (Object)null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1781
        test("%n", System.getProperty("line.separator"), "");
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1782
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1783
        tryCatch("%,n", IllegalFormatFlagsException.class);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1784
        tryCatch("%.n", UnknownFormatConversionException.class);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1785
        tryCatch("%5.n", UnknownFormatConversionException.class);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1786
        tryCatch("%5n", IllegalFormatWidthException.class);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1787
        tryCatch("%.7n", IllegalFormatPrecisionException.class);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1788
        tryCatch("%<n", IllegalFormatFlagsException.class);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1789
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1790
        //---------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1791
        // %%
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1792
        //---------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1793
        test("%%", "%", (Object)null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1794
        test("%%", "%", "");
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1795
        tryCatch("%%%", UnknownFormatConversionException.class);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1796
        // perhaps an IllegalFormatArgumentIndexException should be defined?
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1797
        tryCatch("%<%", IllegalFormatFlagsException.class);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1798
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1799
}