TestDouble.java revision 827
4548N/A/*
4548N/A * Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
4548N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4548N/A *
4548N/A * This code is free software; you can redistribute it and/or modify it
4548N/A * under the terms of the GNU General Public License version 2 only, as
4548N/A * published by the Free Software Foundation.
4548N/A *
4548N/A * This code is distributed in the hope that it will be useful, but WITHOUT
4548N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4548N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
4548N/A * version 2 for more details (a copy is included in the LICENSE file that
4548N/A * accompanied this code).
4548N/A *
4548N/A * You should have received a copy of the GNU General Public License version
4548N/A * 2 along with this work; if not, write to the Free Software Foundation,
4548N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4548N/A *
4548N/A * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
4548N/A * CA 95054 USA or visit www.sun.com if you need additional information or
4548N/A * have any questions.
4548N/A */
4548N/A
4548N/A/*
4548N/A * @test
4548N/A * @summary Tests <double> element
4548N/A * @author Sergey Malenkov
4548N/A */
4548N/A
4548N/Aimport java.beans.XMLDecoder;
4548N/A
4548N/Apublic final class TestDouble extends AbstractTest {
4548N/A public static final String XML
4548N/A = "<java>\n"
4548N/A + " <double>0</double>\n"
4548N/A + " <double>1000</double>\n"
4548N/A + " <double>-1.1e15</double>\n"
4548N/A + " <double>10.11e-123</double>\n"
4548N/A + "</java>";
4548N/A
4548N/A public static void main(String[] args) {
4548N/A new TestDouble().test(true);
4548N/A }
4548N/A
4548N/A @Override
4548N/A protected void validate(XMLDecoder decoder) {
4549N/A validate(0.0, decoder.readObject());
4548N/A validate(1000.0, decoder.readObject());
4548N/A validate(-1.1e15, decoder.readObject());
4548N/A validate(10.11e-123, decoder.readObject());
4548N/A }
4548N/A
4548N/A private static void validate(double value, Object object) {
4548N/A if (!object.equals(Double.valueOf(value))) {
4548N/A throw new Error("double " + value + " expected");
4548N/A }
4548N/A }
4548N/A}
4548N/A