Path: blob/master/test/hotspot/jtreg/vmTestbase/nsk/jdi/DoubleValue/value/value001a.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.value;2425import nsk.share.*;26import nsk.share.jpda.*;27import nsk.share.jdi.*;282930/**31* This class is used as debuggee application for the value001a JDI test.32*/3334public class value001a {3536//----------------------------------------------------- templete section3738static final int PASSED = 0;39static final int FAILED = 2;40static final int PASS_BASE = 95;4142//-------------------------------------------------- log procedures4344static boolean verbMode = false; // debugger may switch to true4546private static void log1(String message) {47if (verbMode)48System.err.println("**> value001a: " + message);49}5051private static void logErr(String message) {52if (verbMode)53System.err.println("!!**> value001a: " + message);54}5556//====================================================== test program57//................................................... globals for a debugger5859public static double pos_inf = Double.POSITIVE_INFINITY;60public static double pos_zero = 0.0d;61public static double neg_zero = -0.0d;62public static double neg_inf = Double.NEGATIVE_INFINITY;6364public static double pos_largest = Double.MAX_VALUE;65public static double pos_smallest = Double.MIN_VALUE;66public static double neg_largest = -Double.MAX_VALUE;67public static double neg_smallest = -Double.MIN_VALUE;6869public static double double_nan = Double.NaN;7071// public static double plus1_1 = +1.0d;72// public static double plus1_2 = +1.0d;73// public static double minus1 = -1.0d;7475// public static float float_plus1 = +1.0f;7677//....................................................78//---------------------------------------------------- main method7980public static void main (String argv[]) {8182for (int i=0; i<argv.length; i++) {83if ( argv[i].equals("-vbs") || argv[i].equals("-verbose") ) {84verbMode = true;85break;86}87}88log1("debuggee started!");8990// informing a debugger of readyness91ArgumentHandler argHandler = new ArgumentHandler(argv);92IOPipe pipe = argHandler.createDebugeeIOPipe();93pipe.println("ready");949596int exitCode = PASSED;97for (int i = 0; ; i++) {9899String instruction;100101log1("waiting for an instruction from the debugger ...");102instruction = pipe.readln();103if (instruction.equals("quit")) {104log1("'quit' recieved");105break ;106107} else if (instruction.equals("newcheck")) {108switch (i) {109110//------------------------------------------------------ section tested111112case 0:113pipe.println("checkready");114break ;115116//------------------------------------------------- standard end section117118default:119pipe.println("checkend");120break ;121}122123} else {124logErr("ERRROR: unexpected instruction: " + instruction);125exitCode = FAILED;126break ;127}128}129130System.exit(exitCode + PASS_BASE);131}132}133134135