Examples of BytecodeValue


Examples of wyvern.targets.Common.wyvernIL.interpreter.values.BytecodeValue

    +"l.insert(0,3)                    \n"
    +"l.insert(1,4)                    \n"
    +"bubbleSortList(l)                  \n"
    +"(l.get(0),l.get(1),l.get(2),l.get(3),l.get(4))  \n";

    BytecodeValue res = runTest(s);
    assertEquals(res.toString(), "(0,1,2,6,7)");

    String[] names = { "Node", "DummyNode", "IntList", "l", "bubbleSortList" };
    BytecodeValue[] vals = { clasDef, clasDef, clasDef, clas, func };
    assertTrue(isInContext(names, vals));
  }
View Full Code Here

Examples of wyvern.targets.Common.wyvernIL.interpreter.values.BytecodeValue

    +"l.insert(6,5)                            \n"
    +"l.insert(8,6)                            \n"
    +"reverseList(l)                          \n"
    +"(l.get(0),l.get(1),l.get(2),l.get(3),l.get(4),l.get(5),l.get(6))  \n";
   
    BytecodeValue res = runTest(s);
    assertEquals(res.toString(), "(8,6,9,0,1,5,3)");

    String[] names = { "l", "reverseList" };
    BytecodeValue[] vals = { clas, func };
    assertTrue(isInContext(names, vals));
  }
View Full Code Here

Examples of wyvern.targets.Common.wyvernIL.interpreter.values.BytecodeValue

    +   "val x4 = mod(21,6)              \n"
    +   "val x5 = mod(12,10)            \n"
    +   "val x6 = mod(123,10)            \n"
    +   "(x1,x2,x3,x4,x5,x6)            \n";
   
    BytecodeValue res = runTest(s);
    assertEquals(res.toString(), "(2,0,5,3,2,3)");

    String[] names = { "mod" };
    BytecodeValue[] vals = { func };
    assertTrue(isInContext(names, vals));
  }
View Full Code Here

Examples of wyvern.targets.Common.wyvernIL.interpreter.values.BytecodeValue

    +   "    newNum                    \n"
    +   "                          \n"
    +   "val r : Reverser = Reverser.create()        \n"
    +   "r.reverseInt(123456)                \n";

    BytecodeValue res = runTest(s);
    assertEquals(res.toString(), "654321");

    String[] names = { "Reverser", "r" };
    BytecodeValue[] vals = { clasDef, clas };
    assertTrue(isInContext(names, vals));
  }
View Full Code Here

Examples of wyvern.targets.Common.wyvernIL.interpreter.values.BytecodeValue

   
    s =  "val applyTwice : (Int->Int)->(Int->Int) = fn f : Int -> Int => fn x : Int => f(f(x))  \n"
    "val addOne : (Int->Int) = fn x : Int => x + 1                                      \n"
    "applyTwice(addOne)(1)                                                             \n";

    BytecodeValue res = runTest(s);
    assertEquals(res.toString(), "3");

    String[] names = { "applyTwice", "addOne" };
    BytecodeValue[] vals = { func, func };
    assertTrue(isInContext(names, vals));
  }
View Full Code Here

Examples of wyvern.targets.Common.wyvernIL.interpreter.values.BytecodeValue

    +   "l.insert(4,3)                    \n"
    +   "def square(x : Int) : Int = x * x          \n"
    +   "map(square, l)                    \n"
    +   "(l.get(0),l.get(1),l.get(2),l.get(3))        \n";

    BytecodeValue res = runTest(s);
    assertEquals(res.toString(), "(1,4,9,16)");

    String[] names = { "map", "l", "square" };
    BytecodeValue[] vals = { func, clas, func };
    assertTrue(isInContext(names, vals));   
  }
View Full Code Here

Examples of wyvern.targets.Common.wyvernIL.interpreter.values.BytecodeValue

    s =  "val fun1 = fn x : Int => x + 1             \n"
    +   "val fun2 = fn f : Int -> Int => fn x : Int => f(f(x))  \n"
    +   "def fun3(z : Int) : Int                \n"
    "  z+1                           \n";

    BytecodeValue res = runTest(s)
    assertEquals(res.toString(), "()")

    String[] names = { "fun1", "fun2", "fun3" };
    BytecodeValue[] vals = { func, func, func };
    assertTrue(isInContext(names,vals));
  }
View Full Code Here

Examples of wyvern.targets.Common.wyvernIL.interpreter.values.BytecodeValue

    s =  "def mult(n:Int,m:Int):Int = n+5*m     \n"
    "val x = mult(3,2)             \n"
    +   "val y = mult(4,5)             \n"
    +   "val z = mult(1,1)            \n";

    BytecodeValue res = runTest(s)
    assertEquals(res.toString(), "()");

    String[] names = { "x", "y", "z", "mult" };
    BytecodeValue[] vals = { new BytecodeInt(13), new BytecodeInt(29),
                 new BytecodeInt(6), func };
    assertTrue(isInContext(names,vals));
View Full Code Here

Examples of wyvern.targets.Common.wyvernIL.interpreter.values.BytecodeValue

   
    PRINTS_ON = false;
   
    s =  "val x = (fn x : Int => x + 1)(3)";

    BytecodeValue res = runTest(s);
    assertEquals(res.toString(), "()")

    String[] names = { "x" };
    BytecodeValue[] vals = { new BytecodeInt(4) };
    assertTrue(isInContext(names,vals));
  }
View Full Code Here

Examples of wyvern.targets.Common.wyvernIL.interpreter.values.BytecodeValue

   
    s =  "var x : Int = 3             \n"
    +   "def mult(n:Int,m:Int):Int = (n+m)*x   \n"
    +   "mult(1,2)                \n";

    BytecodeValue res = runTest(s)
    assertEquals(res.toString(), "9");

    String[] names = { "x", "mult" };
    BytecodeValue[] vals = { new BytecodeInt(3) , func };
    assertTrue(isInContext(names,vals));
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.