test/java/lang/Integer/Unsigned.java

Print this page
rev 10594 : 8055251: Re-examine Integer.parseInt and Long.parseLong methods

@@ -301,10 +301,21 @@
                     errors++;
                     System.err.printf("Bad roundtrip conversion of %d in base %d" +
                                       "\tconverting back ''%s'' resulted in %d%n",
                                       value, radix, longString,  intResult);
                 }
+
+                // test offset based parse method
+                intResult = Integer.parseUnsignedInt("prefix" + longString + "suffix",
+                        "prefix".length(), "prefix".length() + longString.length(), radix);
+
+                if (Integer.toUnsignedLong(intResult) != value) {
+                    errors++;
+                    System.err.printf("Bad roundtrip conversion of %d in base %d" +
+                            "\tconverting back ''%s'' resulted in %d%n",
+                            value, radix, longString,  intResult);
+                }
             }
         }
 
         String[] outOfRange = {
             null,