mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 16:14:10 -08:00
Move VM tests off classlib package
This commit is contained in:
parent
8c3f071f88
commit
6f5c6cd66e
55
tests/src/test/java/org/teavm/vm/LongTest.java
Normal file
55
tests/src/test/java/org/teavm/vm/LongTest.java
Normal file
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2013 Alexey Andreev.
|
* Copyright 2016 Alexey Andreev.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.teavm.classlib.java.lang;
|
package org.teavm.vm;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
@ -31,33 +31,6 @@ public class VMTest {
|
||||||
assertEquals(int[].class, array[0].getClass());
|
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
|
@Test
|
||||||
public void catchesException() {
|
public void catchesException() {
|
||||||
try {
|
try {
|
Loading…
Reference in New Issue
Block a user