From 3814e7545edd55ecdedba7e10a53b9fe6400044f Mon Sep 17 00:00:00 2001 From: Michael Bebenita Date: Fri, 15 May 2015 13:44:17 -0700 Subject: [PATCH] Add double test. --- tests/ShellTestlets.java | 1 + tests/gnu/testlet/vm/DoubleTest.java | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 tests/gnu/testlet/vm/DoubleTest.java diff --git a/tests/ShellTestlets.java b/tests/ShellTestlets.java index 4e638716..b4110251 100644 --- a/tests/ShellTestlets.java +++ b/tests/ShellTestlets.java @@ -256,6 +256,7 @@ public class ShellTestlets { // "test/org/jikesrvm/basic/core/bytecode/TestResolveOnInstanceof", // "test/org/jikesrvm/basic/core/bytecode/TestResolveOnInvokeInterface", // "test/org/jikesrvm/basic/core/classloading/TestUTF8", + "gnu/testlet/vm/DoubleTest", null}; static { diff --git a/tests/gnu/testlet/vm/DoubleTest.java b/tests/gnu/testlet/vm/DoubleTest.java new file mode 100644 index 00000000..e621d467 --- /dev/null +++ b/tests/gnu/testlet/vm/DoubleTest.java @@ -0,0 +1,27 @@ +package gnu.testlet.vm; + +import gnu.testlet.*; + +public class DoubleTest implements Testlet { + public int getExpectedPass() { return 9; } + public int getExpectedFail() { return 0; } + public int getExpectedKnownFail() { return 0; } + static double h = 123.456; + static double a = 5; + static double b = 7; + static double c = 50; + static double d = 5; + + public void test(TestHarness th) { + th.check(("" + h), "123.456"); + th.check(a + b, 12D); + th.check(a - b, -2D); + th.check(a * b, 35D); + th.check(c / a, 10D); + th.check(c % b, 1D); + + th.check(a < b); + th.check(b > a); + th.check(a == d); + } +}