Package org.allspice.bytecode

Examples of org.allspice.bytecode.ClassDef


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


    assertEquals(m.invoke(obj,false),true) ;
    assertEquals(m.invoke(obj,true),false) ;
  }
  public void test9() throws Exception {
   
    ClassDef cd = defadd("java.lang.String",1) ;
    Object obj = makeObject(cd) ;
    Method m = obj.getClass().getMethod("meth",String.class) ;
    assertEquals(m.invoke(obj,"abc"),false) ;
    assertEquals(m.invoke(obj,new Object[]{null}),true) ;
  }
View Full Code Here

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

public class TestIFLE0 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 IfLessThanEq0(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,-2.0),true) ;
    assertEquals(m.invoke(obj,0.0),true) ;
    assertEquals(m.invoke(obj,2.0),false) ;
View Full Code Here

    assertEquals(m.invoke(obj,0.0),true) ;
    assertEquals(m.invoke(obj,2.0),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,-2L),true) ;
    assertEquals(m.invoke(obj,0L),true) ;
    assertEquals(m.invoke(obj,2L),false) ;
View Full Code Here

    assertEquals(m.invoke(obj,0L),true) ;
    assertEquals(m.invoke(obj,2L),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,-2F),true) ;
    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,-2),true) ;
    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 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)-1),true) ;
    assertEquals(m.invoke(obj,(short)0),true) ;
    assertEquals(m.invoke(obj,(short)1),false) ;
View Full Code Here

    assertEquals(m.invoke(obj,(short)0),true) ;
    assertEquals(m.invoke(obj,(short)1),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)-2),true) ;
    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)-2),false) ;     
    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.