Beispiel #1
0
 @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());
 }
Beispiel #2
0
 @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);
 }
Beispiel #3
0
 @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);
 }
Beispiel #4
0
 @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);
 }
Beispiel #5
0
 @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);
 }
Beispiel #6
0
 @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);
 }
Beispiel #7
0
 @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);
 }
Beispiel #8
0
 @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);
 }