@Test public void testPrintFalse() throws JellyException { String funId = IdUtils.qualify(this.prn, "printFalse"); Future<ExecutionContext> f = this.runtime.eval(funId); ExecutionContext ctx = f.get(); assertEquals(TyCon.mkzTyCon(0), ctx.getWhnf()); }
@Test public void testPolyDbl() throws JellyException { String funId = IdUtils.qualify(this.poly, "polyDbl"); Future<ExecutionContext> f = this.runtime.eval(funId); ExecutionContext ctx = f.get(); assertEquals(Math.PI, ((Double) ctx.getWhnf()).d); }
@Test public void testPolyInt() throws JellyException { String funId = IdUtils.qualify(this.poly, "polyInt"); Future<ExecutionContext> f = this.runtime.eval(funId); ExecutionContext ctx = f.get(); assertEquals(42, ((Int) ctx.getWhnf()).i); }
@Test public void testBottomCatched() throws JellyException { String funId = IdUtils.qualify(this.exn, "bottomCatched"); Future<ExecutionContext> f = this.runtime.eval(funId); ExecutionContext ctx = f.get(); assertEquals("Ok", ((Str) ctx.getWhnf()).s); }
@Test public void testHandle() throws JellyException { String funId = IdUtils.qualify(this.exn, "handle"); Future<ExecutionContext> f = this.runtime.eval(funId); ExecutionContext ctx = f.get(); assertEquals(6, ((Int) ctx.getWhnf()).i); }
@Test public void testTrickyMatch1() throws JellyException { String funId = IdUtils.qualify(this.bar, "trickyMatch1"); Future<ExecutionContext> f = this.runtime.eval(funId); ExecutionContext ctx = f.get(); assertEquals(-1, ((Int) ctx.getWhnf()).i); }
@Test public void testQuickSum() throws JellyException { String funId = IdUtils.qualify(this.baz, "quickSum"); Future<ExecutionContext> f = this.runtime.eval(funId); ExecutionContext ctx = f.get(); assertEquals(21, ((Int) ctx.getWhnf()).i); }
@Test public void testTrickyMatch() throws JellyException { String funId = IdUtils.qualify(this.bar, "trickyMatch"); Future<ExecutionContext> f = this.runtime.eval(funId); ExecutionContext ctx = f.get(); TyCon t = (TyCon) ctx.getWhnf(); assertEquals(0, t.getTag()); assertEquals(1, ((Int) t.getNodes()[0]).i); assertEquals(2, ((Int) t.getNodes()[1]).i); }