Package org.allspice.structured.expr

Examples of org.allspice.structured.expr.ConstExpr


  public void test1() throws Exception {
    ComplexArrayTest obj = makeObject(ComplexArrayTest.class,new DeclareStatement(
        new FIFO<VarDecl>(new VarDecl("int[][]","i",new ArrayOfExpr(null,
            new FIFO<Expr>(
              new ArrayOfExpr(null,new FIFO<Expr>(
                  new ConstExpr(Integer.valueOf(6),null),
                  new ConstExpr(Integer.valueOf(9),null)
                  )),
              new ArrayOfExpr(null,new FIFO<Expr>(
                  new ConstExpr(Integer.valueOf(5),null),
                  new ConstExpr(Integer.valueOf(7),null)
                  )))
              ),
            false)),
        new FIFO<Statement>(new ReturnStatement(new VarExpr("i",null),null)),
        null
View Full Code Here


  public static interface ComplexArrayTest {
    public int[] meth() ;
  }
  public void test1() throws Exception {
    ComplexArrayTest obj = makeObject(ComplexArrayTest.class,
        new NewArrayExpr("int",new FIFO<Expr>(new ConstExpr(Integer.valueOf(2),null)),null,null)) ;
    final int[] arr = obj.meth();
    assertEquals(arr.length,2) ;
  }
View Full Code Here

    public int meth(int arg0) ;
  }
  public void test1() throws Exception {
    SwitchTest obj = makeObject(SwitchTest.class,new SwitchStatement(ARG0,
        new FIFO<Statement>(
        new CaseStatement(new ConstExpr(Integer.valueOf(1),null),null),
        new ReturnStatement(new ConstExpr(Integer.valueOf(2),null),null),
        new CaseStatement(new ConstExpr(Integer.valueOf(0),null),null),
        new ReturnStatement(new ConstExpr(Integer.valueOf(0),null),null),
        new CaseStatement(new ConstExpr(Integer.valueOf(2),null),null),
        new ReturnStatement(new ConstExpr(Integer.valueOf(4),null),null),
        new CaseStatement(null,null),
        new ReturnStatement(new ConstExpr(Integer.valueOf(-1),null),null)
    ),null)) ;
    assertEquals(obj.meth(0),0) ;
    assertEquals(obj.meth(1),2) ;
    assertEquals(obj.meth(2),4) ;
    assertEquals(obj.meth(3),-1) ;
View Full Code Here

  }
  public void test1() throws Exception {
    WhileTest obj = makeObject(WhileTest.class,new DeclareStatement(
        new FIFO<VarDecl>(new VarDecl("int","i"),new VarDecl("int","total")),
        new FIFO<Statement>(
        new ExprStatement(new SetValueExpr(I,new ConstExpr(Integer.valueOf(0),null),null),null),
        new ExprStatement(new SetValueExpr(TOTAL,new ConstExpr(Integer.valueOf(0),null),null),null),
        new WhileStatement(
            new LTExpr(I,ARG0,null),
            new FIFO<Statement>(
            new ExprStatement(new AddInPlaceExpr(I,new ConstExpr(Integer.valueOf(1),null),null),null),
            new ExprStatement(new AddInPlaceExpr(TOTAL,new ConstExpr(Integer.valueOf(2),null),null),null)),null),
        new ReturnStatement(TOTAL,null)
      ),null)) ;
    assertEquals(obj.meth(5),10) ;
    assertEquals(obj.meth(0),0) ;
  }
View Full Code Here

TOP

Related Classes of org.allspice.structured.expr.ConstExpr

Copyright © 2018 www.massapicom. 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.