Examples of typeCheck()


Examples of wyvern.tools.typedAST.interfaces.TypedAST.typecheck()

   
    // System.out.println("Parsed OK.");
   
    // System.out.println("typecheck returned: " + res.typecheck(Globals.getStandardEnv(), Optional.empty()));
   
    Assert.assertEquals(res.typecheck(Globals.getStandardEnv(), Optional.empty()).toString(), "TYPE()");
   
    // System.out.println("evaluate returned: " + res.evaluate(Globals.getStandardEnv()).toString());
   
    Assert.assertEquals(res.evaluate(Globals.getStandardEnv()).toString(), "()");   
  }
View Full Code Here

Examples of wyvern.tools.typedAST.interfaces.TypedAST.typecheck()

        "";
    TypedAST res = (TypedAST)new Wyvern().parse(new StringReader(input), "test input");
   
    System.out.println("Parsed OK.");
   
    System.out.println("typecheck returned: " + res.typecheck(Globals.getStandardEnv(), Optional.empty()));
   
    Assert.assertEquals(res.typecheck(Globals.getStandardEnv(), Optional.empty()).toString(), "TYPE()");
   
    System.out.println("evaluate returned: " + res.evaluate(Globals.getStandardEnv()).toString());
   
View Full Code Here

Examples of wyvern.tools.typedAST.interfaces.TypedAST.typecheck()

   
    System.out.println("Parsed OK.");
   
    System.out.println("typecheck returned: " + res.typecheck(Globals.getStandardEnv(), Optional.empty()));
   
    Assert.assertEquals(res.typecheck(Globals.getStandardEnv(), Optional.empty()).toString(), "TYPE()");
   
    System.out.println("evaluate returned: " + res.evaluate(Globals.getStandardEnv()).toString());
   
    Assert.assertEquals(res.evaluate(Globals.getStandardEnv()).toString(), "()");   
  }
View Full Code Here

Examples of wyvern.tools.typedAST.interfaces.TypedAST.typecheck()

        "";
    TypedAST res = (TypedAST)new Wyvern().parse(new StringReader(input), "test input");
   
    System.out.println("Parsed OK.");
   
    System.out.println("typecheck returned: " + res.typecheck(Globals.getStandardEnv(), Optional.empty()));
   
    // Assert.assertEquals(res.typecheck(Globals.getStandardEnv(), Optional.empty()).toString(), "TYPE()");
   
    // System.out.println("evaluate returned: " + res.evaluate(Globals.getStandardEnv()).toString());
   
View Full Code Here

Examples of wyvern.tools.typedAST.interfaces.TypedAST.typecheck()

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());
  }
  @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");
View Full Code Here

Examples of wyvern.tools.typedAST.interfaces.TypedAST.typecheck()

  }
  @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());
  }
  @Test
  public void testDeclParams2() throws IOException, CopperParserException {
    String input =
        "def foo(x:Int,y:Int):Int = 5+x*y\n" +
View Full Code Here

Examples of wyvern.tools.typedAST.interfaces.TypedAST.typecheck()

  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)");
  }
  @Test
  public void testFwdDecls() throws IOException, CopperParserException {
    String input =
View Full Code Here

Examples of wyvern.tools.typedAST.interfaces.TypedAST.typecheck()

        "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)");
  }
  @Test
  public void testClass() throws IOException, CopperParserException {
    String input =
View Full Code Here

Examples of wyvern.tools.typedAST.interfaces.TypedAST.typecheck()

  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)");
  }

  @Test
  public void testClass2()  throws IOException, CopperParserException {
View Full Code Here

Examples of wyvern.tools.typedAST.interfaces.TypedAST.typecheck()

        "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)");
  }

  @Test
  public void testClass3() throws IOException, CopperParserException {
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.