Path: blob/master/test/hotspot/jtreg/vmTestbase/nsk/jdi/DoubleValue/equals/equals001a.java
41161 views
/*1* Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223package nsk.jdi.DoubleValue.equals;2425import nsk.share.*;26import nsk.share.jpda.*;27import nsk.share.jdi.*;282930/**31* This class is used as debuggee application for the equals001a JDI test.3233*/3435public class equals001a {3637//----------------------------------------------------- templete section3839static final int PASSED = 0;40static final int FAILED = 2;41static final int PASS_BASE = 95;4243//-------------------------------------------------- log procedures4445static boolean verbMode = false; // debugger may switch to true4647private static void log1(String message) {48if (verbMode)49System.err.println("**> equals001a: " + message);50}5152private static void logErr(String message) {53if (verbMode)54System.err.println("!!**> equals001a: " + message);55}5657//====================================================== test program58//................................................... globals for a debugger5960// public static double pos_inf = Double.POSITIVE_INFINITY;61// public static double pos_zero = 0.0d;62// public static double neg_zero = -0.0d;63// public static double neg_inf = Double.NEGATIVE_INFINITY;6465// public static double pos_largest = Double.MAX_VALUE;66// public static double pos_smallest = Double.MIN_VALUE;67// public static double neg_largest = -Double.MAX_VALUE;68// public static double neg_smallest = -Double.MIN_VALUE;6970// public static double double_nan = Double.NaN;7172public static double plus1_1 = +1.0d;73public static double plus1_2 = +1.0d;74public static double minus1 = -1.0d;7576public static float float_plus1 = +1.0f;7778//....................................................79//---------------------------------------------------- main method8081public static void main (String argv[]) {8283for (int i=0; i<argv.length; i++) {84if ( argv[i].equals("-vbs") || argv[i].equals("-verbose") ) {85verbMode = true;86break;87}88}89log1("debuggee started!");9091// informing a debugger of readyness92ArgumentHandler argHandler = new ArgumentHandler(argv);93IOPipe pipe = argHandler.createDebugeeIOPipe();94pipe.println("ready");959697int exitCode = PASSED;98for (int i = 0; ; i++) {99100String instruction;101102log1("waiting for an instruction from the debugger ...");103instruction = pipe.readln();104if (instruction.equals("quit")) {105log1("'quit' recieved");106break ;107108} else if (instruction.equals("newcheck")) {109switch (i) {110111//------------------------------------------------------ section tested112113case 0:114pipe.println("checkready");115break ;116117//------------------------------------------------- standard end section118119default:120pipe.println("checkend");121break ;122}123124} else {125logErr("ERRROR: unexpected instruction: " + instruction);126exitCode = FAILED;127break ;128}129}130131System.exit(exitCode + PASS_BASE);132}133}134135136