< prev index next >

test/runtime/CommandLine/OptionsValidation/common/optionsvalidation/DoubleJVMOption.java

Print this page




 106      */
 107     @Override
 108     String getMax() {
 109         return formatValue(max);
 110     }
 111 
 112     private String formatValue(double value) {
 113         return String.format(Locale.US, "%f", value);
 114     }
 115 
 116     /**
 117      * Return list of strings with valid option values which used for testing
 118      * using jcmd, attach and etc.
 119      *
 120      * @return list of strings which contain valid values for option
 121      */
 122     @Override
 123     protected List<String> getValidValues() {
 124         List<String> validValues = new ArrayList<>();
 125 

 126         validValues.add(formatValue(min));


 127         validValues.add(formatValue(max));

 128 

 129         if ((Double.compare(min, ADDITIONAL_TEST_DOUBLE_NEGATIVE) < 0)
 130                 && (Double.compare(max, ADDITIONAL_TEST_DOUBLE_NEGATIVE) > 0)) {
 131             validValues.add(formatValue(ADDITIONAL_TEST_DOUBLE_NEGATIVE));
 132         }
 133 
 134         if ((Double.compare(min, ADDITIONAL_TEST_DOUBLE_ZERO) < 0)
 135                 && (Double.compare(max, ADDITIONAL_TEST_DOUBLE_ZERO) > 0)) {
 136             validValues.add(formatValue(ADDITIONAL_TEST_DOUBLE_ZERO));
 137         }
 138 
 139         if ((Double.compare(min, ADDITIONAL_TEST_DOUBLE_POSITIVE) < 0)
 140                 && (Double.compare(max, ADDITIONAL_TEST_DOUBLE_POSITIVE) > 0)) {
 141             validValues.add(formatValue(ADDITIONAL_TEST_DOUBLE_POSITIVE));

 142         }
 143 
 144         return validValues;
 145     }
 146 
 147     /**
 148      * Return list of strings with invalid option values which used for testing
 149      * using jcmd, attach and etc.
 150      *
 151      * @return list of strings which contain invalid values for option
 152      */
 153     @Override
 154     protected List<String> getInvalidValues() {
 155         List<String> invalidValues = new ArrayList<>();
 156 
 157         if (withRange) {
 158             /* Return invalid values only for options which have defined range in VM */
 159             if (Double.compare(min, Double.MIN_VALUE) != 0) {
 160                 if ((Double.compare(min, 0.0) > 0)
 161                         && (Double.isNaN(min * 0.999) == false)) {




 106      */
 107     @Override
 108     String getMax() {
 109         return formatValue(max);
 110     }
 111 
 112     private String formatValue(double value) {
 113         return String.format(Locale.US, "%f", value);
 114     }
 115 
 116     /**
 117      * Return list of strings with valid option values which used for testing
 118      * using jcmd, attach and etc.
 119      *
 120      * @return list of strings which contain valid values for option
 121      */
 122     @Override
 123     protected List<String> getValidValues() {
 124         List<String> validValues = new ArrayList<>();
 125 
 126         if (testMinRange) {
 127             validValues.add(formatValue(min));
 128         }
 129         if (testMaxRange) {
 130             validValues.add(formatValue(max));
 131         }
 132 
 133         if (testMinRange) {
 134             if ((Double.compare(min, ADDITIONAL_TEST_DOUBLE_NEGATIVE) < 0)
 135                     && (Double.compare(max, ADDITIONAL_TEST_DOUBLE_NEGATIVE) > 0)) {
 136                 validValues.add(formatValue(ADDITIONAL_TEST_DOUBLE_NEGATIVE));
 137             }
 138 
 139             if ((Double.compare(min, ADDITIONAL_TEST_DOUBLE_ZERO) < 0)
 140                     && (Double.compare(max, ADDITIONAL_TEST_DOUBLE_ZERO) > 0)) {
 141                 validValues.add(formatValue(ADDITIONAL_TEST_DOUBLE_ZERO));
 142             }
 143 
 144             if ((Double.compare(min, ADDITIONAL_TEST_DOUBLE_POSITIVE) < 0)
 145                     && (Double.compare(max, ADDITIONAL_TEST_DOUBLE_POSITIVE) > 0)) {
 146                 validValues.add(formatValue(ADDITIONAL_TEST_DOUBLE_POSITIVE));
 147             }
 148         }
 149 
 150         return validValues;
 151     }
 152 
 153     /**
 154      * Return list of strings with invalid option values which used for testing
 155      * using jcmd, attach and etc.
 156      *
 157      * @return list of strings which contain invalid values for option
 158      */
 159     @Override
 160     protected List<String> getInvalidValues() {
 161         List<String> invalidValues = new ArrayList<>();
 162 
 163         if (withRange) {
 164             /* Return invalid values only for options which have defined range in VM */
 165             if (Double.compare(min, Double.MIN_VALUE) != 0) {
 166                 if ((Double.compare(min, 0.0) > 0)
 167                         && (Double.isNaN(min * 0.999) == false)) {


< prev index next >