long arithmetics initial

This commit is contained in:
Dmitry Jemerov
2011-04-07 14:13:00 +02:00
parent 66cfb99ce9
commit 561bcee4e2
4 changed files with 32 additions and 14 deletions
@@ -207,11 +207,20 @@ public class NamespaceGenTest extends LightCodeInsightFixtureTestCase {
assertEquals(10, main.invoke(null, "false"));
}
public void testBoxedInt() throws Exception {
public void _testBoxedInt() throws Exception {
loadText("fun foo(a: Int?): Int = if (a != null) a else 239");
final Method main = generateFunction();
assertEquals(610, main.invoke(null, 610));
assertEquals(239, main.invoke(null, new Object[] { null }));
assertEquals(239, main.invoke(null, new Object[]{null}));
}
public void testLong() throws Exception {
loadText("fun foo(a: Long, b: Long): Long = a + b");
System.out.println(generateToText());
final Method main = generateFunction();
long arg = (long) Integer.MAX_VALUE;
long expected = 2 * (long) Integer.MAX_VALUE;
assertEquals(expected, main.invoke(null, arg, arg));
}
private void binOpTest(final String text, final int arg1, final int arg2, final int expected) throws Exception {