SolveCubicTest.java revision 3442
f30ee734ac0ee8b792c77ab3bc42494fcddb1508hajma/*
f30ee734ac0ee8b792c77ab3bc42494fcddb1508hajma * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
f30ee734ac0ee8b792c77ab3bc42494fcddb1508hajma * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
f30ee734ac0ee8b792c77ab3bc42494fcddb1508hajma *
f30ee734ac0ee8b792c77ab3bc42494fcddb1508hajma * This code is free software; you can redistribute it and/or modify it
f30ee734ac0ee8b792c77ab3bc42494fcddb1508hajma * under the terms of the GNU General Public License version 2 only, as
f30ee734ac0ee8b792c77ab3bc42494fcddb1508hajma * published by the Free Software Foundation.
f30ee734ac0ee8b792c77ab3bc42494fcddb1508hajma *
f30ee734ac0ee8b792c77ab3bc42494fcddb1508hajma * This code is distributed in the hope that it will be useful, but WITHOUT
f30ee734ac0ee8b792c77ab3bc42494fcddb1508hajma * 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 4645692
* @summary Verifies that SolveCubic doesn't miss any roots.
* @run main SolveCubicTest
*/
import static java.awt.geom.CubicCurve2D.solveCubic;
public class SolveCubicTest {
public static void main(String[] args) throws Exception {
double[] eqn = {0, 0, 1, 1};
int numRoots = solveCubic(eqn, eqn);
if (numRoots < 2) {
throw new Exception("There are 2 roots. Only " + numRoots + " were found.");
}
}
}