From 6f5c6cd66e99f66d10419dc106163d6af7218de9 Mon Sep 17 00:00:00 2001 From: Alexey Andreev Date: Fri, 4 Nov 2016 13:34:25 +0300 Subject: [PATCH] Move VM tests off classlib package --- .../src/test/java/org/teavm/vm/LongTest.java | 55 +++++++++++++++++++ .../{classlib/java/lang => vm}/VMTest.java | 31 +---------- 2 files changed, 57 insertions(+), 29 deletions(-) create mode 100644 tests/src/test/java/org/teavm/vm/LongTest.java rename tests/src/test/java/org/teavm/{classlib/java/lang => vm}/VMTest.java (82%) diff --git a/tests/src/test/java/org/teavm/vm/LongTest.java b/tests/src/test/java/org/teavm/vm/LongTest.java new file mode 100644 index 000000000..397be4a8b --- /dev/null +++ b/tests/src/test/java/org/teavm/vm/LongTest.java @@ -0,0 +1,55 @@ +/* + * Copyright 2016 Alexey Andreev. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.teavm.vm; + +import static org.junit.Assert.assertEquals; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.teavm.junit.TeaVMTestRunner; + +@RunWith(TeaVMTestRunner.class) +public class LongTest { + @Test + public void longIntegersMultipied() { + long a = id(1199747L); + long b = id(1062911L); + assertEquals(1275224283517L, a * b); + assertEquals(-1275224283517L, a * -b); + a = id(229767376164L); + b = id(907271478890L); + assertEquals(-5267604004427634456L, a * b); + assertEquals(5267604004427634456L, a * -b); + } + + @Test + public void longIntegersDivided() { + long a = id(12752242835177213L); + long b = id(1062912L); + assertEquals(11997458712L, a / b); + assertEquals(-11997458712L, a / -b); + } + + @Test + public void longAdditionWorks() { + long a = id(1134903170); + long b = id(1836311903); + assertEquals(2971215073L, a + b); + } + + private static long id(long value) { + return value; + } +} diff --git a/tests/src/test/java/org/teavm/classlib/java/lang/VMTest.java b/tests/src/test/java/org/teavm/vm/VMTest.java similarity index 82% rename from tests/src/test/java/org/teavm/classlib/java/lang/VMTest.java rename to tests/src/test/java/org/teavm/vm/VMTest.java index fcf80727f..fe2367b86 100644 --- a/tests/src/test/java/org/teavm/classlib/java/lang/VMTest.java +++ b/tests/src/test/java/org/teavm/vm/VMTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2013 Alexey Andreev. + * Copyright 2016 Alexey Andreev. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.teavm.classlib.java.lang; +package org.teavm.vm; import static org.junit.Assert.*; import org.junit.Test; @@ -31,33 +31,6 @@ public class VMTest { assertEquals(int[].class, array[0].getClass()); } - @Test - public void longIntegersMultipied() { - long a = 1199747L; - long b = 1062911L; - assertEquals(1275224283517L, a * b); - assertEquals(-1275224283517L, a * -b); - a = 229767376164L; - b = 907271478890L; - assertEquals(-5267604004427634456L, a * b); - assertEquals(5267604004427634456L, a * -b); - } - - @Test - public void longIntegersDivided() { - long a = 12752242835177213L; - long b = 1062912L; - assertEquals(11997458712L, a / b); - assertEquals(-11997458712L, a / -b); - } - - @Test - public void longAdditionWorks() { - long a = 1134903170; - long b = 1836311903; - assertEquals(2971215073L, a + b); - } - @Test public void catchesException() { try {