Examples of Wyvern


Examples of wyvern.tools.parsing.Wyvern

public class CopperTests {
  @Test(expected= ToolError.class)
  public void testVal2() throws IOException, CopperParserException {
    String input = "val yx:Int = false\nyx";
    TypedAST res = (TypedAST)new Wyvern().parse(new StringReader(input), "test input");
    res.typecheck(Globals.getStandardEnv(), Optional.empty());
  }
View Full Code Here

Examples of wyvern.tools.parsing.Wyvern

    res.typecheck(Globals.getStandardEnv(), Optional.empty());
  }
  @Test(expected= RuntimeException.class)
  public void testVal3() throws IOException, CopperParserException {
    String input = "val yx:Int = 3\nyx = 9\nyx";
    TypedAST res = (TypedAST)new Wyvern().parse(new StringReader(input), "test input");
    res.typecheck(Globals.getStandardEnv(), Optional.empty());
  }
View Full Code Here

Examples of wyvern.tools.parsing.Wyvern

  @Test
  public void testDeclParams2() throws IOException, CopperParserException {
    String input =
        "def foo(x:Int,y:Int):Int = 5+x*y\n" +
            "foo(7,2)";
    TypedAST res = (TypedAST)new Wyvern().parse(new StringReader(input), "test input");
    Assert.assertEquals(res.typecheck(Globals.getStandardEnv(), Optional.empty()), Int.getInstance());
    Assert.assertEquals(res.evaluate(Globals.getStandardEnv()).toString(), "IntegerConstant(19)");
  }
View Full Code Here

Examples of wyvern.tools.parsing.Wyvern

    String input =
        "def foo():Int = bar()+20\n" +
            "def bar():Int\n" +
            "  9\n" +
            "foo()";
    TypedAST res = (TypedAST)new Wyvern().parse(new StringReader(input), "test input");
    Assert.assertEquals(res.typecheck(Globals.getStandardEnv(), Optional.empty()), Int.getInstance());
    Assert.assertEquals(res.evaluate(Globals.getStandardEnv()).toString(), "IntegerConstant(29)");
  }
View Full Code Here

Examples of wyvern.tools.parsing.Wyvern

  @Test
  public void testClass() throws IOException, CopperParserException {
    String input =
        "class Hello\n" +
        "6";
    TypedAST res = (TypedAST)new Wyvern().parse(new StringReader(input), "test input");
    Assert.assertEquals(res.typecheck(Globals.getStandardEnv(), Optional.empty()), Int.getInstance());
    Assert.assertEquals(res.evaluate(Globals.getStandardEnv()).toString(), "IntegerConstant(6)");
  }
View Full Code Here

Examples of wyvern.tools.parsing.Wyvern

    String input =
        "class Hello\n" +
        "  def foo():Int = 7\n" +
        "  val bar:Int = 19\n" +
        "6";
    TypedAST res = (TypedAST)new Wyvern().parse(new StringReader(input), "test input");
    Assert.assertEquals(res.typecheck(Globals.getStandardEnv(), Optional.empty()), Int.getInstance());
    Assert.assertEquals(res.evaluate(Globals.getStandardEnv()).toString(), "IntegerConstant(6)");
  }
View Full Code Here

Examples of wyvern.tools.parsing.Wyvern

        "class Hello\n" +
            "  class def create():Hello = new\n" +
            "  def foo():Int = 7\n" +
            "  val bar:Int = 19\n" +
            "Hello.create().foo()";
    TypedAST res = (TypedAST)new Wyvern().parse(new StringReader(input), "test input");
    Assert.assertEquals(res.typecheck(Globals.getStandardEnv(), Optional.empty()), Int.getInstance());
    Assert.assertEquals(res.evaluate(Globals.getStandardEnv()).toString(), "IntegerConstant(7)");
  }
View Full Code Here

Examples of wyvern.tools.parsing.Wyvern

        "class Hello\n" +
        "  class def create():Hello = new\n" +
        "  def foo():Foo = Foo.create()\n" +
        "  val bar:Int = 19\n" +
        "Hello.create().bar";
    TypedAST res = (TypedAST)new Wyvern().parse(new StringReader(input), "test input");
    Assert.assertEquals(res.typecheck(Globals.getStandardEnv(), Optional.empty()), Int.getInstance());
    Assert.assertEquals("IntegerConstant(19)", res.evaluate(Globals.getStandardEnv()).toString());
  }
View Full Code Here

Examples of wyvern.tools.parsing.Wyvern

    String input =
        "class C\n" +
        "  def bar():Int\n" +
        "    9\n" +
        "5";
    TypedAST res = (TypedAST)new Wyvern().parse(new StringReader(input), "test input");
    Assert.assertEquals(res.typecheck(Globals.getStandardEnv(), Optional.empty()), Int.getInstance());
    Assert.assertEquals(res.evaluate(Globals.getStandardEnv()).toString(), "IntegerConstant(5)");
  }
View Full Code Here

Examples of wyvern.tools.parsing.Wyvern

        "  class def create():C\n" +
        "    new\n" +
        "  def bar():Int\n" +
        "    9\n" +
        "5";
    TypedAST res = (TypedAST)new Wyvern().parse(new StringReader(input), "test input");
    Assert.assertEquals(res.typecheck(Globals.getStandardEnv(), Optional.empty()), Int.getInstance());
    Assert.assertEquals(res.evaluate(Globals.getStandardEnv()).toString(), "IntegerConstant(5)");
  }
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.