/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4103117 4331084 4488017 4490929 6255285 6268365
* @summary Tests the BigDecimal string constructor.
*/
public class StringConstructor {
constructWithError("");
constructWithError("+");
constructWithError("-");
constructWithError("+e");
constructWithError("-e");
constructWithError("e+");
constructWithError("1.-0");
constructWithError(".-123");
constructWithError("-");
constructWithError("--1.1");
constructWithError("-+1.1");
constructWithError("+-1.1");
constructWithError("1-.1");
constructWithError("1+.1");
constructWithError("1.111+1");
constructWithError("1.111-1");
constructWithError("11.e+");
constructWithError("11.e-");
constructWithError("11.e+-");
constructWithError("11.e-+");
constructWithError("11.e-+1");
constructWithError("11.e+-1");
// Range checks
// Roundtrip tests
for (int i=0; i<100; i++) {
if (rnd.nextBoolean())
// System.err.println("bi" + bi.toString() + "\tscale " + scale);
// System.err.println("bd string: " + bdString);
"\t" + bdString);
throw new RuntimeException("String constructor failure.");
}
}
}
/*
* Verify precision is set properly if the significand has
* non-ASCII leading zeros.
*/
private static void nonAsciiZeroTest() {
"00004e5",
"\u0660\u0660\u0660\u06604e5",
};
// System.err.println("Testing " + s);
throw new RuntimeException("String constructor failure.");
}
}
}
private static void leadingExponentZeroTest() {
// Test with more excess zeros than the largest number of
// decimal digits needed to represent a long
// System.out.println(i + "\t" + t1 + "\t" + t2);
}
}
testString0(s, expected);
}
}
}
try {
} catch(NumberFormatException e) {
}
}
}