Examples of BytecodeValue


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

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

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

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

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

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

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

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

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

    +   "    sum = add(n,sum)     \n"
    +   "    z = z - 1         \n"
    +   "  sum             \n"
    +   "mult(5,5)            \n";

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

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

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

    +   "    sum = add(n,sum)     \n"
    +   "    z = z - 1         \n"
    +   "  sum             \n"
    +   "mult(3,6)            \n";

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

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

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

    "   n             \n"
    "  else           \n"
    "   n * factorial(n-1)     \n"
    +   "factorial(5)        \n";

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

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

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

    PRINTS_ON = false;

    s = "def func() : Int*Int*Int  \n"
    +   "  (1,2,3)          \n";

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

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

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

    s = "var x : Int          \n"
    +   "def setX(num : Int) : Unit    \n"
    +   "  x = num            \n";

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

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

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

       
    s = "var x : Int = 1   \n"
    +   "x = 3         \n"
    +   "val y = 5      \n";
   
    BytecodeValue res = runTest(s)
    assertEquals(res.toString(), "()");

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

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

   
    PRINTS_ON = false;
       
    s = "(15 / 4 / 2, 12 / 5, 10/11)";
   
    BytecodeValue res = runTest(s)
    assertEquals(res.toString(), "(1,2,0)");

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

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

    +   "val y : Int = 2 * x           \n"
    +   "val z : Str = \"Hello \" + \"World\"  \n"
    "val w = (x,y,z)            \n"
    +   "w\n";

    BytecodeValue res = runTest(s)
    assertEquals(res.toString(), "(4,8,Hello World)");
   
    String[] names = { "x", "y", "z", "w" };
    List<BytecodeValue> tuple = new ArrayList<BytecodeValue>();
    tuple.add(new BytecodeInt(4));
    tuple.add(new BytecodeInt(8));
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.