Package org.apache.harmony.pack200.tests.bytecode

Examples of org.apache.harmony.pack200.tests.bytecode.ByteCodeTest


        for (int i = 1; i < 255; i++)
            last = decode(BYTE1D, new byte[] { (byte) 1 }, i, last);
    }

    public void testByte1DeltaException() throws Exception {
        Codec BYTE1D = new BHSDCodec(1, 256, 0, 1);
        try {
            BYTE1D.decode(new ByteArrayInputStream(new byte[] { (byte) 1 }));
            fail("Decoding with a delta stream and not passing a last value should throw exception");
        } catch (Pack200Exception e) {
            assertTrue(true);
        }
    }
View Full Code Here


            assertTrue(true);
        }
    }

    public void testByte1Signed() throws Exception {
        Codec BYTE1S2 = new BHSDCodec(1, 256, 2);
        decode(BYTE1S2, new byte[] { 0 }, 0, 0);
        decode(BYTE1S2, new byte[] { 1 }, 1, 0);
        decode(BYTE1S2, new byte[] { 2 }, 2, 0);
        decode(BYTE1S2, new byte[] { 3 }, -1, 0);
        decode(BYTE1S2, new byte[] { 4 }, 3, 0);
View Full Code Here

* @author Alex Blewitt
* @version $Revision: $
*/
public class CodecEncodingTest extends TestCase {
  public void testCanonicalEncodings() throws IOException, Pack200Exception {
    Codec defaultCodec = new BHSDCodec(2,16,0,0);
    assertEquals(defaultCodec,CodecEncoding.getCodec(0,null, defaultCodec));
    Map map = new HashMap();
    // These are the canonical encodings specified by the Pack200 spec
    map.put(new Integer(1), "(1,256)");
    map.put(new Integer(2), "(1,256,1)");
View Full Code Here

    for (int i = 0; i < 255; i++)
      decode(Codec.BYTE1, new byte[] { (byte) i }, i, 0);
  }

  public void testByte1Delta() throws Exception {
    Codec BYTE1D = new BHSDCodec(1, 256, 0, 1);
    long last = 0;
    for (int i = 1; i < 255; i++)
      last = decode(BYTE1D, new byte[] { (byte) 1 }, i, last);
  }
View Full Code Here

    long last = 0;
    for (int i = 1; i < 255; i++)
      last = decode(BYTE1D, new byte[] { (byte) 1 }, i, last);
  }
  public void testByte1DeltaException() throws Exception {
    Codec BYTE1D = new BHSDCodec(1, 256, 0, 1);
    try {
      BYTE1D.decode(new ByteArrayInputStream(new byte[] { (byte) 1 }));
      fail("Decoding with a delta stream and not passing a last value should throw exception");
    } catch (Pack200Exception e) {
      assertTrue(true);
    }
  }
View Full Code Here

    } catch (Pack200Exception e) {
      assertTrue(true);
    }
  }
  public void testByte1Signed() throws Exception {
    Codec BYTE1S2 = new BHSDCodec(1,256,2);
    decode(BYTE1S2,new byte[] { 0 }, 0, 0);
    decode(BYTE1S2,new byte[] { 1 }, 1, 0);
    decode(BYTE1S2,new byte[] { 2 }, 2, 0);
    decode(BYTE1S2,new byte[] { 3 }, -1, 0);
    decode(BYTE1S2,new byte[] { 4 }, 3, 0);
View Full Code Here

*
*/
public class CodecEncodingTest extends TestCase {

    public void testCanonicalEncodings() throws IOException, Pack200Exception {
        Codec defaultCodec = new BHSDCodec(2, 16, 0, 0);
        assertEquals(defaultCodec, CodecEncoding
                .getCodec(0, null, defaultCodec));
        Map map = new HashMap();
        // These are the canonical encodings specified by the Pack200 spec
        map.put(new Integer(1), "(1,256)");
View Full Code Here

        for (int i = 0; i < 255; i++)
            decode(Codec.BYTE1, new byte[] { (byte) i }, i, 0);
    }

    public void testByte1Delta() throws Exception {
        Codec BYTE1D = new BHSDCodec(1, 256, 0, 1);
        long last = 0;
        for (int i = 1; i < 255; i++)
            last = decode(BYTE1D, new byte[] { (byte) 1 }, i, last);
    }
View Full Code Here

        for (int i = 1; i < 255; i++)
            last = decode(BYTE1D, new byte[] { (byte) 1 }, i, last);
    }

    public void testByte1DeltaException() throws Exception {
        Codec BYTE1D = new BHSDCodec(1, 256, 0, 1);
        try {
            BYTE1D.decode(new ByteArrayInputStream(new byte[] { (byte) 1 }));
            fail("Decoding with a delta stream and not passing a last value should throw exception");
        } catch (Pack200Exception e) {
            assertTrue(true);
        }
    }
View Full Code Here

            assertTrue(true);
        }
    }

    public void testByte1Signed() throws Exception {
        Codec BYTE1S2 = new BHSDCodec(1, 256, 2);
        decode(BYTE1S2, new byte[] { 0 }, 0, 0);
        decode(BYTE1S2, new byte[] { 1 }, 1, 0);
        decode(BYTE1S2, new byte[] { 2 }, 2, 0);
        decode(BYTE1S2, new byte[] { 3 }, -1, 0);
        decode(BYTE1S2, new byte[] { 4 }, 3, 0);
View Full Code Here

TOP

Related Classes of org.apache.harmony.pack200.tests.bytecode.ByteCodeTest

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.