Package org.apache.harmony.pack200

Examples of org.apache.harmony.pack200.AttributeLayout$Key


    assertEquals("Zero",layout.getValue(1, segment.getConstantPool()));
    assertEquals("One",layout.getValue(2, segment.getConstantPool()));
  }

  public void testLayoutRS() throws Pack200Exception {
    AttributeLayout layout = new AttributeLayout("RS",AttributeLayout.CONTEXT_CLASS,"RS", 1);
    Segment segment = new TestSegment();
    assertNull(layout.getValue(-1, segment.getConstantPool()));
    assertEquals("Eins",layout.getValue(0, segment.getConstantPool()));
    assertEquals("Zwei",layout.getValue(1, segment.getConstantPool()));
  }
View Full Code Here


    assertEquals("Eins",layout.getValue(0, segment.getConstantPool()));
    assertEquals("Zwei",layout.getValue(1, segment.getConstantPool()));
  }

    public void testLayoutRSN() throws Pack200Exception {
    AttributeLayout layout = new AttributeLayout("RSN",AttributeLayout.CONTEXT_CLASS,"RSN", 1);
    Segment segment = new TestSegment();
    assertNull(layout.getValue(0, segment.getConstantPool()));
    assertEquals("Eins",layout.getValue(1, segment.getConstantPool()));
    assertEquals("Zwei",layout.getValue(2, segment.getConstantPool()));
  }
View Full Code Here

    assertEquals("Eins",layout.getValue(1, segment.getConstantPool()));
    assertEquals("Zwei",layout.getValue(2, segment.getConstantPool()));
  }

    public void testGetCodec() throws Pack200Exception {
        AttributeLayout layout = new AttributeLayout("O", AttributeLayout.CONTEXT_CLASS, "HOBS", 1);
        assertEquals(Codec.BRANCH5, layout.getCodec());
        layout = new AttributeLayout("P", AttributeLayout.CONTEXT_METHOD, "PIN", 1);
        assertEquals(Codec.BCI5, layout.getCodec());
        layout = new AttributeLayout("S", AttributeLayout.CONTEXT_FIELD, "HS", 1);
        assertEquals(Codec.SIGNED5, layout.getCodec());
        layout = new AttributeLayout("RS", AttributeLayout.CONTEXT_CODE, "RRRS", 1);
        assertEquals(Codec.UNSIGNED5, layout.getCodec());
        layout = new AttributeLayout("KS", AttributeLayout.CONTEXT_CLASS, "RKS", 1);
        assertEquals(Codec.UNSIGNED5, layout.getCodec());
        layout = new AttributeLayout("B", AttributeLayout.CONTEXT_CLASS, "TRKSB", 1);
        assertEquals(Codec.BYTE1, layout.getCodec());
    }
View Full Code Here

        assertEquals(Codec.BYTE1, layout.getCodec());
    }

  public boolean throwsException(String name, int context, String layout) {
    try {
      new AttributeLayout(name,context,layout,-1);
      return false;
    } catch (Pack200Exception e) {
      return true;
    }
  }
View Full Code Here

    assertTrue(throwsException("name",-1,""));
    assertTrue(throwsException("name",1234,""));
  }

  public void testLayoutRU() throws Pack200Exception {
    AttributeLayout layout = new AttributeLayout("RU",AttributeLayout.CONTEXT_CLASS,"RU", 1);
    Segment segment = new TestSegment();
    assertNull(layout.getValue(-1, segment.getConstantPool()));
    assertEquals("Zero",layout.getValue(0, segment.getConstantPool()));
    assertEquals("One",layout.getValue(1, segment.getConstantPool()));
  }
View Full Code Here

    assertEquals("Zero",layout.getValue(0, segment.getConstantPool()));
    assertEquals("One",layout.getValue(1, segment.getConstantPool()));
  }

  public void testLayoutRUN() throws Pack200Exception {
    AttributeLayout layout = new AttributeLayout("RUN",AttributeLayout.CONTEXT_CLASS,"RUN", 1);
    Segment segment = new TestSegment();
    assertNull(layout.getValue(0, segment.getConstantPool()));
    assertEquals("Zero",layout.getValue(1, segment.getConstantPool()));
    assertEquals("One",layout.getValue(2, segment.getConstantPool()));
  }
View Full Code Here

    assertEquals("Zero",layout.getValue(1, segment.getConstantPool()));
    assertEquals("One",layout.getValue(2, segment.getConstantPool()));
  }

  public void testLayoutRS() throws Pack200Exception {
    AttributeLayout layout = new AttributeLayout("RS",AttributeLayout.CONTEXT_CLASS,"RS", 1);
    Segment segment = new TestSegment();
    assertNull(layout.getValue(-1, segment.getConstantPool()));
    assertEquals("Eins",layout.getValue(0, segment.getConstantPool()));
    assertEquals("Zwei",layout.getValue(1, segment.getConstantPool()));
  }
View Full Code Here

    assertEquals("Eins",layout.getValue(0, segment.getConstantPool()));
    assertEquals("Zwei",layout.getValue(1, segment.getConstantPool()));
  }

    public void testLayoutRSN() throws Pack200Exception {
    AttributeLayout layout = new AttributeLayout("RSN",AttributeLayout.CONTEXT_CLASS,"RSN", 1);
    Segment segment = new TestSegment();
    assertNull(layout.getValue(0, segment.getConstantPool()));
    assertEquals("Eins",layout.getValue(1, segment.getConstantPool()));
    assertEquals("Zwei",layout.getValue(2, segment.getConstantPool()));
  }
View Full Code Here

    assertEquals("Eins",layout.getValue(1, segment.getConstantPool()));
    assertEquals("Zwei",layout.getValue(2, segment.getConstantPool()));
  }

    public void testGetCodec() throws Pack200Exception {
        AttributeLayout layout = new AttributeLayout("O", AttributeLayout.CONTEXT_CLASS, "HOBS", 1);
        assertEquals(Codec.BRANCH5, layout.getCodec());
        layout = new AttributeLayout("P", AttributeLayout.CONTEXT_METHOD, "PIN", 1);
        assertEquals(Codec.BCI5, layout.getCodec());
        layout = new AttributeLayout("S", AttributeLayout.CONTEXT_FIELD, "HS", 1);
        assertEquals(Codec.SIGNED5, layout.getCodec());
        layout = new AttributeLayout("RS", AttributeLayout.CONTEXT_CODE, "RRRS", 1);
        assertEquals(Codec.UNSIGNED5, layout.getCodec());
        layout = new AttributeLayout("KS", AttributeLayout.CONTEXT_CLASS, "RKS", 1);
        assertEquals(Codec.UNSIGNED5, layout.getCodec());
        layout = new AttributeLayout("B", AttributeLayout.CONTEXT_CLASS, "TRKSB", 1);
        assertEquals(Codec.BYTE1, layout.getCodec());
    }
View Full Code Here

        assertEquals(Codec.BYTE1, layout.getCodec());
    }

  public boolean throwsException(String name, int context, String layout) {
    try {
      new AttributeLayout(name,context,layout,-1);
      return false;
    } catch (Pack200Exception e) {
      return true;
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.harmony.pack200.AttributeLayout$Key

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.