Package org.allspice.structuredtobc

Examples of org.allspice.structuredtobc.ConstObj


import junit.framework.TestCase;

public class TestConstConversions extends TestCase {
  public void test1() throws CompilerException {
    assertEquals(StdJavaExpressions.getBooleanValue(new ConstObj(Boolean.TRUE)),Boolean.TRUE) ;
    assertEquals(StdJavaExpressions.getBooleanValue(new ConstObj(Byte.valueOf((byte)5))),Boolean.TRUE) ;
    assertEquals(StdJavaExpressions.getBooleanValue(new ConstObj(Short.valueOf((short)5))),Boolean.TRUE) ;
    assertEquals(StdJavaExpressions.getBooleanValue(new ConstObj(Character.valueOf((char)5))),Boolean.TRUE) ;
    assertEquals(StdJavaExpressions.getBooleanValue(new ConstObj(Integer.valueOf(5))),Boolean.TRUE) ;
    assertEquals(StdJavaExpressions.getBooleanValue(new ConstObj(Long.valueOf(5))),Boolean.TRUE) ;
    assertEquals(StdJavaExpressions.getBooleanValue(new ConstObj(Float.valueOf(5))),Boolean.TRUE) ;
    assertEquals(StdJavaExpressions.getBooleanValue(new ConstObj(Double.valueOf(5))),Boolean.TRUE) ;
   
    assertEquals(StdJavaExpressions.getBooleanValue(new ConstObj(Boolean.FALSE)),Boolean.FALSE) ;
    assertEquals(StdJavaExpressions.getBooleanValue(new ConstObj(Byte.valueOf((byte)0))),Boolean.FALSE) ;
    assertEquals(StdJavaExpressions.getBooleanValue(new ConstObj(Short.valueOf((short)0))),Boolean.FALSE) ;
    assertEquals(StdJavaExpressions.getBooleanValue(new ConstObj(Character.valueOf((char)0))),Boolean.FALSE) ;
    assertEquals(StdJavaExpressions.getBooleanValue(new ConstObj(Integer.valueOf(0))),Boolean.FALSE) ;
    assertEquals(StdJavaExpressions.getBooleanValue(new ConstObj(Long.valueOf(0))),Boolean.FALSE) ;
    assertEquals(StdJavaExpressions.getBooleanValue(new ConstObj(Float.valueOf(0))),Boolean.FALSE) ;
    assertEquals(StdJavaExpressions.getBooleanValue(new ConstObj(Double.valueOf(0))),Boolean.FALSE) ;
  }
View Full Code Here


    assertEquals(StdJavaExpressions.getBooleanValue(new ConstObj(Float.valueOf(0))),Boolean.FALSE) ;
    assertEquals(StdJavaExpressions.getBooleanValue(new ConstObj(Double.valueOf(0))),Boolean.FALSE) ;
  }
  public void test2() throws CompilerException {
    byte five = (byte)5 ;
    assertEquals(StdJavaExpressions.getByteValue(new ConstObj(Boolean.TRUE)).byteValue(),(byte)1) ;
    assertEquals(StdJavaExpressions.getByteValue(new ConstObj(Byte.valueOf((byte)5))).byteValue(),five) ;
    assertEquals(StdJavaExpressions.getByteValue(new ConstObj(Short.valueOf((short)5))).byteValue(),five) ;
    assertEquals(StdJavaExpressions.getByteValue(new ConstObj(Character.valueOf((char)5))).byteValue(),five) ;
    assertEquals(StdJavaExpressions.getByteValue(new ConstObj(Integer.valueOf(5))).byteValue(),five) ;
    assertEquals(StdJavaExpressions.getByteValue(new ConstObj(Long.valueOf(5))).byteValue(),five) ;
    assertEquals(StdJavaExpressions.getByteValue(new ConstObj(Float.valueOf(5))).byteValue(),five) ;
    assertEquals(StdJavaExpressions.getByteValue(new ConstObj(Double.valueOf(5))).byteValue(),five) ;
  }
View Full Code Here

    assertEquals(StdJavaExpressions.getByteValue(new ConstObj(Float.valueOf(5))).byteValue(),five) ;
    assertEquals(StdJavaExpressions.getByteValue(new ConstObj(Double.valueOf(5))).byteValue(),five) ;
  }
  public void test3() throws CompilerException {
    short five = (short)5 ;
    assertEquals(StdJavaExpressions.getShortValue(new ConstObj(Boolean.TRUE)).shortValue(),(short)1) ;
    assertEquals(StdJavaExpressions.getShortValue(new ConstObj(Byte.valueOf((byte)5))).shortValue(),five) ;
    assertEquals(StdJavaExpressions.getShortValue(new ConstObj(Short.valueOf((short)5))).shortValue(),five) ;
    assertEquals(StdJavaExpressions.getShortValue(new ConstObj(Character.valueOf((char)5))).shortValue(),five) ;
    assertEquals(StdJavaExpressions.getShortValue(new ConstObj(Integer.valueOf(5))).shortValue(),five) ;
    assertEquals(StdJavaExpressions.getShortValue(new ConstObj(Long.valueOf(5))).shortValue(),five) ;
    assertEquals(StdJavaExpressions.getShortValue(new ConstObj(Float.valueOf(5))).shortValue(),five) ;
    assertEquals(StdJavaExpressions.getShortValue(new ConstObj(Double.valueOf(5))).shortValue(),five) ;
  }
View Full Code Here

    assertEquals(StdJavaExpressions.getShortValue(new ConstObj(Float.valueOf(5))).shortValue(),five) ;
    assertEquals(StdJavaExpressions.getShortValue(new ConstObj(Double.valueOf(5))).shortValue(),five) ;
  }
  public void test4() throws CompilerException {
    Character five = Character.valueOf((char)5) ;
    assertEquals(StdJavaExpressions.getCharValue(new ConstObj(Boolean.TRUE)),Character.valueOf((char)1)) ;
    assertEquals(StdJavaExpressions.getCharValue(new ConstObj(Byte.valueOf((byte)5))),five) ;
    assertEquals(StdJavaExpressions.getCharValue(new ConstObj(Short.valueOf((short)5))),five) ;
    assertEquals(StdJavaExpressions.getCharValue(new ConstObj(Character.valueOf((char)5))),five) ;
    assertEquals(StdJavaExpressions.getCharValue(new ConstObj(Integer.valueOf(5))),five) ;
    assertEquals(StdJavaExpressions.getCharValue(new ConstObj(Long.valueOf(5))),five) ;
    assertEquals(StdJavaExpressions.getCharValue(new ConstObj(Float.valueOf(5))),five) ;
    assertEquals(StdJavaExpressions.getCharValue(new ConstObj(Double.valueOf(5))),five) ;
  }
View Full Code Here

    assertEquals(StdJavaExpressions.getCharValue(new ConstObj(Float.valueOf(5))),five) ;
    assertEquals(StdJavaExpressions.getCharValue(new ConstObj(Double.valueOf(5))),five) ;
  }
  public void test5() throws CompilerException {
    Integer five = Integer.valueOf(5) ;
    assertEquals(StdJavaExpressions.getIntValue(new ConstObj(Boolean.TRUE)),Integer.valueOf(1)) ;
    assertEquals(StdJavaExpressions.getIntValue(new ConstObj(Byte.valueOf((byte)5))),five) ;
    assertEquals(StdJavaExpressions.getIntValue(new ConstObj(Short.valueOf((short)5))),five) ;
    assertEquals(StdJavaExpressions.getIntValue(new ConstObj(Character.valueOf((char)5))),five) ;
    assertEquals(StdJavaExpressions.getIntValue(new ConstObj(Integer.valueOf(5))),five) ;
    assertEquals(StdJavaExpressions.getIntValue(new ConstObj(Long.valueOf(5))),five) ;
    assertEquals(StdJavaExpressions.getIntValue(new ConstObj(Float.valueOf(5))),five) ;
    assertEquals(StdJavaExpressions.getIntValue(new ConstObj(Double.valueOf(5))),five) ;
  }
View Full Code Here

    assertEquals(StdJavaExpressions.getIntValue(new ConstObj(Float.valueOf(5))),five) ;
    assertEquals(StdJavaExpressions.getIntValue(new ConstObj(Double.valueOf(5))),five) ;
  }
  public void test6() throws CompilerException {
    Long five = Long.valueOf(5) ;
    assertEquals(StdJavaExpressions.getLongValue(new ConstObj(Boolean.TRUE)),Long.valueOf(1)) ;
    assertEquals(StdJavaExpressions.getLongValue(new ConstObj(Byte.valueOf((byte)5))),five) ;
    assertEquals(StdJavaExpressions.getLongValue(new ConstObj(Short.valueOf((short)5))),five) ;
    assertEquals(StdJavaExpressions.getLongValue(new ConstObj(Character.valueOf((char)5))),five) ;
    assertEquals(StdJavaExpressions.getLongValue(new ConstObj(Integer.valueOf(5))),five) ;
    assertEquals(StdJavaExpressions.getLongValue(new ConstObj(Long.valueOf(5))),five) ;
    assertEquals(StdJavaExpressions.getLongValue(new ConstObj(Float.valueOf(5))),five) ;
    assertEquals(StdJavaExpressions.getLongValue(new ConstObj(Double.valueOf(5))),five) ;
  }
View Full Code Here

  }
  public void test7() throws CompilerException {
    Float five = Float.valueOf(5) ;
    Float one = Float.valueOf(1) ;

    assertEquals(StdJavaExpressions.getFloatValue(new ConstObj(Boolean.TRUE)),one) ;
    assertEquals(StdJavaExpressions.getFloatValue(new ConstObj(Byte.valueOf((byte)5))),five) ;
    assertEquals(StdJavaExpressions.getFloatValue(new ConstObj(Short.valueOf((short)5))),five) ;
    assertEquals(StdJavaExpressions.getFloatValue(new ConstObj(Character.valueOf((char)5))),five) ;
    assertEquals(StdJavaExpressions.getFloatValue(new ConstObj(Integer.valueOf(5))),five) ;
    assertEquals(StdJavaExpressions.getFloatValue(new ConstObj(Long.valueOf(5))),five) ;
    assertEquals(StdJavaExpressions.getFloatValue(new ConstObj(Float.valueOf(5))),five) ;
    assertEquals(StdJavaExpressions.getFloatValue(new ConstObj(Double.valueOf(5))),five) ;
  }
View Full Code Here

    assertEquals(StdJavaExpressions.getFloatValue(new ConstObj(Double.valueOf(5))),five) ;
  }
  public void test8() throws CompilerException {
    Double five = Double.valueOf(5) ;
    Double one = Double.valueOf(1) ;
    assertEquals(StdJavaExpressions.getDoubleValue(new ConstObj(Boolean.TRUE)),one) ;
    assertEquals(StdJavaExpressions.getDoubleValue(new ConstObj(Byte.valueOf((byte)5))),five) ;
    assertEquals(StdJavaExpressions.getDoubleValue(new ConstObj(Short.valueOf((short)5))),five) ;
    assertEquals(StdJavaExpressions.getDoubleValue(new ConstObj(Character.valueOf((char)5))),five) ;
    assertEquals(StdJavaExpressions.getDoubleValue(new ConstObj(Integer.valueOf(5))),five) ;
    assertEquals(StdJavaExpressions.getDoubleValue(new ConstObj(Long.valueOf(5))),five) ;
    assertEquals(StdJavaExpressions.getDoubleValue(new ConstObj(Float.valueOf(5))),five) ;
    assertEquals(StdJavaExpressions.getDoubleValue(new ConstObj(Double.valueOf(5))),five) ;
  }
View Full Code Here

TOP

Related Classes of org.allspice.structuredtobc.ConstObj

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.