Package org.apache.harmony.unpack200.bytecode

Examples of org.apache.harmony.unpack200.bytecode.CPUTF8


        pool.resolve(new Segment());
        assertTrue(pool.indexOf(u1) > 0);
    }

    public void testAllClasses() {
        pool.add(new CPClass(new CPUTF8("RandomClass", 1), 10));
        pool.add(new CPClass(new CPUTF8("RandomClass2", 2), 20));
        assertEquals(2, pool.allClasses().size());
    }
View Full Code Here


import org.apache.harmony.unpack200.bytecode.SourceFileAttribute;

public class ClassFileEntryTest extends TestCase {

    public void testUTF8() {
        CPUTF8 u1 = new CPUTF8(new String("thing"), 1); //$NON-NLS-1$
        CPUTF8 u2 = new CPUTF8(new String("thing"), 1); //$NON-NLS-1$
        CPUTF8 u3 = new CPUTF8(new String("otherthing"), 2); //$NON-NLS-1$
        checkEquality(u1, u2, "thing", u3);
    }
View Full Code Here

        assertFalse(unequal.equals(equal1));
        assertFalse(unequal.equals(equal2));
    }

    public void testSourceAttribute() {
        SourceFileAttribute sfa1 = new SourceFileAttribute(new CPUTF8(
                new String("Thing.java"), 1)); //$NON-NLS-1$
        SourceFileAttribute sfa2 = new SourceFileAttribute(new CPUTF8(
                new String("Thing.java"), 1)); //$NON-NLS-1$
        SourceFileAttribute sfa3 = new SourceFileAttribute(new CPUTF8(
                new String("OtherThing.java"), 2)); //$NON-NLS-1$
        checkEquality(sfa1, sfa2, "Thing.java", sfa3); //$NON-NLS-1$
    }
View Full Code Here

        CPFloat cp3 = new CPFloat(new Float(5), 5);
        checkEquality(cp1, cp2, "3", cp3); //$NON-NLS-1$
    }

    public void testCPString() {
        CPString cp1 = new CPString(new CPUTF8(new String("3"), 3), 3);
        CPString cp2 = new CPString(new CPUTF8(new String("3"), 3), 3);
        CPString cp3 = new CPString(new CPUTF8(new String("5"), 5), 5);
        checkEquality(cp1, cp2, "3", cp3); //$NON-NLS-1$
    }
View Full Code Here

        CPString cp3 = new CPString(new CPUTF8(new String("5"), 5), 5);
        checkEquality(cp1, cp2, "3", cp3); //$NON-NLS-1$
    }

    public void testCPField() {
        CPMember cp1 = new CPMember(new CPUTF8("Name", 3), new CPUTF8("I", 4),
                0, null);
        CPMember cp2 = new CPMember(new CPUTF8("Name", 3), new CPUTF8("I", 4),
                0, null);
        CPMember cp3 = new CPMember(new CPUTF8("Name", 3), new CPUTF8("Z", 5),
                0, null);
        CPMember cp4 = new CPMember(new CPUTF8("GName", 6), new CPUTF8("I", 4),
                0, null);
        checkEquality(cp1, cp2, "Name", cp3); //$NON-NLS-1$
        checkEquality(cp1, cp2, "I", cp4); //$NON-NLS-1$
    }
View Full Code Here

        public CPFieldRef cpFieldValue(int index) {
            return null;
        }

        public CPString cpStringValue(int index) {
            return new CPString(new CPUTF8("Hello"), -1);
        }
View Full Code Here

import org.apache.harmony.unpack200.bytecode.CPUTF8;

public class CPUTF8Test extends TestCase {

    public void testEquality() {
        CPUTF8 one = new CPUTF8("(III)V", 1);
        CPUTF8 two = new CPUTF8("((I[II)V", 2);
        CPUTF8 three = new CPUTF8("([III)V", 3);
        assertFalse(one.equals(two));
        assertFalse(one.equals(three));
        assertFalse(two.equals(three));

        assertFalse(two.equals(one));
        assertFalse(three.equals(one));
        assertFalse(three.equals(two));
    }
View Full Code Here

            };
        }

        private ClassFileEntry entry(String string) {
            return new CPUTF8(string);
        }
View Full Code Here

        public CPFieldRef cpFieldValue(int index) {
            return null;
        }

        public CPString cpStringValue(int index) {
            return new CPString(new CPUTF8("Hello", ClassConstantPool.DOMAIN_ATTRIBUTEASCIIZ), -1);
        }
View Full Code Here

import org.apache.harmony.unpack200.bytecode.ClassConstantPool;

public class CPUTF8Test extends TestCase {

    public void testEquality() {
        CPUTF8 one = new CPUTF8("(III)V",
                ClassConstantPool.DOMAIN_ATTRIBUTEASCIIZ, 1);
        CPUTF8 two = new CPUTF8("((I[II)V",
                ClassConstantPool.DOMAIN_ATTRIBUTEASCIIZ, 2);
        CPUTF8 three = new CPUTF8("([III)V",
                ClassConstantPool.DOMAIN_ATTRIBUTEASCIIZ, 3);
        assertFalse(one.equals(two));
        assertFalse(one.equals(three));
        assertFalse(two.equals(three));

        assertFalse(two.equals(one));
        assertFalse(three.equals(one));
        assertFalse(three.equals(two));
    }
View Full Code Here

TOP

Related Classes of org.apache.harmony.unpack200.bytecode.CPUTF8

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.