Package org.allspice.bytecode

Examples of org.allspice.bytecode.ClassDef


      assertEquals(o,s1) ;
    }   
  }
  public void test6() throws Exception {
   
    ClassDef cd = defadd("int","byte",1,2) ;
    Object obj = makeObject(cd) ;
    Method m = obj.getClass().getMethod("meth",byte.class,byte.class) ;
    Object o = m.invoke(obj,(byte)2,(byte)7) ;
    assertEquals(o,-5) ;
  }
View Full Code Here


    Object o = m.invoke(obj,(byte)2,(byte)7) ;
    assertEquals(o,-5) ;
  }
  public void test7() throws Exception {
   
    ClassDef cd = defadd("int","char",1,2) ;
    Object obj = makeObject(cd) ;
    Method m = obj.getClass().getMethod("meth",char.class,char.class) ;
    Object o = m.invoke(obj,(char)2,(char)7) ;
    assertEquals(o,-5) ;
  }
View Full Code Here

import org.allspice.bytecode.instructions.Nop;
import org.allspice.bytecode.instructions.Return;

public class TestIFEQ0 extends MyTestCase {
  public ClassDef defadd(String type,int i1) {
    ClassDef cd = makeClassDef() ;
    Var x = new Var(i1,new TypeName(type)) ;
    MethodDef md = new MethodDef(TypeName.BOOLEAN,"meth",x) ;
    Mark one = new Mark() ;
    md = md.addInstructions(
        new Load(x),
        new IfEquals0(TypeCode.getType(type),one),
        new Const(false),
        new Return(TypeCode.BOOLEAN),
        new Nop(one),
        new Const(true),
        new Return(TypeCode.BOOLEAN)
        ) ;
    return cd.addMethod(md)
  }
View Full Code Here

        ) ;
    return cd.addMethod(md)
  }
  public void test1() throws Exception {
   
    ClassDef cd = defadd("double",1) ;
    Object obj = makeObject(cd) ;
    Method m = obj.getClass().getMethod("meth",double.class) ;
    assertEquals(m.invoke(obj,0.0),true) ;
    assertEquals(m.invoke(obj,2.1),false) ;
  }
View Full Code Here

    assertEquals(m.invoke(obj,0.0),true) ;
    assertEquals(m.invoke(obj,2.1),false) ;
  }
  public void test2() throws Exception {
   
    ClassDef cd = defadd("long",1) ;
    Object obj = makeObject(cd) ;
    Method m = obj.getClass().getMethod("meth",long.class) ;
    assertEquals(m.invoke(obj,0),true) ;
    assertEquals(m.invoke(obj,2),false) ;
  }
View Full Code Here

    assertEquals(m.invoke(obj,0),true) ;
    assertEquals(m.invoke(obj,2),false) ;
  }
  public void test3() throws Exception {
   
    ClassDef cd = defadd("float",1) ;
    Object obj = makeObject(cd) ;
    Method m = obj.getClass().getMethod("meth",float.class) ;
    assertEquals(m.invoke(obj,0F),true) ;
    assertEquals(m.invoke(obj,2F),false) ;
  }
View Full Code Here

    assertEquals(m.invoke(obj,0F),true) ;
    assertEquals(m.invoke(obj,2F),false) ;
  }
  public void test4() throws Exception {
   
    ClassDef cd = defadd("int",1) ;
    Object obj = makeObject(cd) ;
    Method m = obj.getClass().getMethod("meth",int.class) ;
    assertEquals(m.invoke(obj,0),true) ;
    assertEquals(m.invoke(obj,2),false) ;
View Full Code Here

    assertEquals(m.invoke(obj,2),false) ;

  }
  public void test5() throws Exception {
   
    ClassDef cd = defadd("short",1) ;
    Object obj = makeObject(cd) ;
    Method m = obj.getClass().getMethod("meth",short.class) ;
    assertEquals(m.invoke(obj,(short)0),true) ;
    assertEquals(m.invoke(obj,(short)2),false) ;
  }
View Full Code Here

    assertEquals(m.invoke(obj,(short)0),true) ;
    assertEquals(m.invoke(obj,(short)2),false) ;
  }
  public void test6() throws Exception {
   
    ClassDef cd = defadd("byte",1) ;
    Object obj = makeObject(cd) ;
    Method m = obj.getClass().getMethod("meth",byte.class) ;
    assertEquals(m.invoke(obj,(byte)0),true) ;
    assertEquals(m.invoke(obj,(byte)2),false) ;
  }
View Full Code Here

    assertEquals(m.invoke(obj,(byte)0),true) ;
    assertEquals(m.invoke(obj,(byte)2),false) ;
  }
  public void test7() throws Exception {
   
    ClassDef cd = defadd("char",1) ;
    Object obj = makeObject(cd) ;
    Method m = obj.getClass().getMethod("meth",char.class) ;
    assertEquals(m.invoke(obj,(char)0),true) ;
    assertEquals(m.invoke(obj,(char)2),false) ;
  }
View Full Code Here

TOP

Related Classes of org.allspice.bytecode.ClassDef

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.