1 /* toHexString.java -- test Float.toHexString |
|
2 Copyright (C) 2005 Red Hat, Inc. |
|
3 This file is part of Mauve. |
|
4 |
|
5 Mauve is free software; you can redistribute it and/or modify |
|
6 it under the terms of the GNU General Public License as published by |
|
7 the Free Software Foundation; either version 2, or (at your option) |
|
8 any later version. |
|
9 |
|
10 Mauve is distributed in the hope that it will be useful, but |
|
11 WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
13 General Public License for more details. |
|
14 |
|
15 You should have received a copy of the GNU General Public License |
|
16 along with Mauve; see the file COPYING. If not, write to the |
|
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
18 02110-1301 USA. |
|
19 |
|
20 */ |
|
21 |
|
22 // Tags: JDK1.5 |
|
23 |
|
24 package gnu.testlet.java.lang.Float; |
|
25 |
|
26 import gnu.testlet.TestHarness; |
|
27 import gnu.testlet.Testlet; |
|
28 |
|
29 /** |
|
30 * @author Tom Tromey |
|
31 */ |
|
32 public class toHexString implements Testlet { |
|
33 public void test(TestHarness harness) { |
|
34 harness.check(Float.toHexString(Float.NaN), "NaN"); |
|
35 harness.check(Float.toHexString(Float.POSITIVE_INFINITY), "Infinity"); |
|
36 harness.check(Float.toHexString(Float.NEGATIVE_INFINITY), "-Infinity"); |
|
37 harness.check(Float.toHexString(0.0f), "0x0.0p0"); |
|
38 harness.check(Float.toHexString(-0.0f), "-0x0.0p0"); |
|
39 harness.check(Float.toHexString(1.0f), "0x1.0p0"); |
|
40 harness.check(Float.toHexString(Float.MAX_VALUE), "0x1.fffffep127"); |
|
41 harness.check(Float.toHexString(Float.MIN_VALUE), "0x0.000002p-126"); |
|
42 } |
|
43 } |
|