tests/libjava-mauve/src/gnu/testlet/java/text/DecimalFormat/PR27311.java
branchjk_new_structure
changeset 1541 75c2e24dea9a
parent 1540 92ac284961c1
child 1542 be11db817bcf
equal deleted inserted replaced
1540:92ac284961c1 1541:75c2e24dea9a
     1 // Tags: JDK1.2
       
     2 
       
     3 // Copyright (C) 2006 Andrew John Hughes <gnu_andrew@member.fsf.org>
       
     4 
       
     5 // This file is part of Mauve.
       
     6 
       
     7 // Mauve is free software; you can redistribute it and/or modify
       
     8 // it under the terms of the GNU General Public License as published by
       
     9 // the Free Software Foundation; either version 2, or (at your option)
       
    10 // any later version. 
       
    11 
       
    12 // Mauve is distributed in the hope that it will be useful,
       
    13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
    15 // GNU General Public License for more details.
       
    16 
       
    17 // You should have received a copy of the GNU General Public License
       
    18 // along with Mauve; see the file COPYING.  If not, write to
       
    19 // the Free Software Foundation, 59 Temple Place - Suite 330,
       
    20 // Boston, MA 02111-1307, USA.  */
       
    21 
       
    22 package gnu.testlet.java.text.DecimalFormat;
       
    23 
       
    24 import gnu.testlet.TestHarness;
       
    25 import gnu.testlet.Testlet;
       
    26 
       
    27 import java.text.DecimalFormat;
       
    28 import java.text.DecimalFormatSymbols;
       
    29 import java.util.Locale;
       
    30 
       
    31 /*
       
    32  * This test is based on PR27311, where
       
    33  * formatting 0.0E00 using the format 0.0#####E0
       
    34  * produced 0.0E--9223372036854775808.  This was down
       
    35  * to incorrect use of the logarithm function in 
       
    36  * calculating the exponent.  The log of 0 is negative
       
    37  * infinity, which explains the bizarre output.
       
    38  *
       
    39  * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
       
    40  */
       
    41 public class PR27311
       
    42   implements Testlet
       
    43 {
       
    44   public void test(TestHarness harness)
       
    45   {
       
    46     DecimalFormatSymbols dfs = new DecimalFormatSymbols(Locale.ENGLISH);
       
    47     DecimalFormat nf = new DecimalFormat("0.0#####E00", dfs);
       
    48     nf.setGroupingUsed(false);
       
    49     String result = nf.format(0.0E00);
       
    50     harness.check(result.equals("0.0E00"),result);
       
    51   }
       
    52 }
       
    53