jakarta-bcel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dbros...@apache.org
Subject svn commit: r680907 - in /jakarta/bcel/trunk/src/test/java/org/apache/bcel/util: ./ InstructionFinderTest.java
Date Wed, 30 Jul 2008 03:02:59 GMT
Author: dbrosius
Date: Tue Jul 29 20:02:59 2008
New Revision: 680907

URL: http://svn.apache.org/viewvc?rev=680907&view=rev
Log:
add test for 45440

Added:
    jakarta/bcel/trunk/src/test/java/org/apache/bcel/util/
    jakarta/bcel/trunk/src/test/java/org/apache/bcel/util/InstructionFinderTest.java

Added: jakarta/bcel/trunk/src/test/java/org/apache/bcel/util/InstructionFinderTest.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/test/java/org/apache/bcel/util/InstructionFinderTest.java?rev=680907&view=auto
==============================================================================
--- jakarta/bcel/trunk/src/test/java/org/apache/bcel/util/InstructionFinderTest.java (added)
+++ jakarta/bcel/trunk/src/test/java/org/apache/bcel/util/InstructionFinderTest.java Tue Jul
29 20:02:59 2008
@@ -0,0 +1,28 @@
+package org.apache.bcel.util;
+
+import java.util.Iterator;
+
+import org.apache.bcel.AbstractTestCase;
+import org.apache.bcel.generic.IADD;
+import org.apache.bcel.generic.ILOAD;
+import org.apache.bcel.generic.ISTORE;
+import org.apache.bcel.generic.InstructionHandle;
+import org.apache.bcel.generic.InstructionList;
+
+public class InstructionFinderTest extends AbstractTestCase {
+
+	public void testSearch() {
+		InstructionList il = new InstructionList();
+		il.append(new ILOAD(1));
+		il.append(new ILOAD(2));
+		il.append(new IADD());
+		il.append(new ISTORE(3));
+		InstructionFinder finder = new InstructionFinder(il);
+		
+		Iterator it = finder.search("ILOAD IADD", il.getInstructionHandles()[0], null );
+		InstructionHandle[] ihs = (InstructionHandle[])it.next();
+		assertEquals(2, ihs.length);
+		assertEquals(ihs[0].getInstruction(), new ILOAD(2));
+		assertEquals(ihs[1].getInstruction(), new IADD());
+	}
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: bcel-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bcel-dev-help@jakarta.apache.org


Mime
View raw message