CeilAndFloorTests.java revision 2362
/*
* 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 6908131
* @summary Check for correct implementation of Math.ceil and Math.floor
*/
public class CeilAndFloorTests {
int failures = 0;
return failures;
}
int failures = 0;
return failures;
}
private static int nearIntegerTests() {
int failures = 0;
double [] fixedPoints = {
-0.0,
0.0,
-1.0,
1.0,
};
for(double fixedPoint : fixedPoints) {
}
if (i < 0) {
} else {
} else {
}
} else {
}
}
}
for(int i = -(0x10000); i <= 0x10000; i++) {
double d = (double) i;
failures += testCeilCase( d, d);
failures += testCeilCase(-d, -d);
failures += testFloorCase( d, d);
failures += testFloorCase(-d, -d);
}
}
return failures;
}
public static int roundingTests() {
int failures = 0;
double [][] testCases = {
{ 0.1, 1.0},
{-0.1, -0.0},
{ 0.5, 1.0},
{-0.5, -0.0},
{ 1.5, 2.0},
{-1.5, -1.0},
{ 2.5, 3.0},
{-2.5, -2.0},
};
}
return failures;
}
int failures = 0;
failures += nearIntegerTests();
failures += roundingTests();
if (failures > 0) {
+ failures + " failures.");
throw new RuntimeException();
}
}
}