List of usage examples for org.objectweb.asm Opcodes NOP
int NOP
To view the source code for org.objectweb.asm Opcodes NOP.
Click Source Link
From source file:org.jacoco.core.internal.analysis.InstructionsBuilderTest.java
License:Open Source License
@Test public void subsequent_instructions_should_not_be_linked_when_noSuccessor_was_called() { InsnNode i1 = new InsnNode(Opcodes.NOP); builder.addInstruction(i1);// ww w . j a v a2 s . co m builder.noSuccessor(); InsnNode i2 = new InsnNode(Opcodes.NOP); builder.addInstruction(i2); // mark i2 as covered builder.addProbe(1, 0); // coverage should not be propagated to i1 Map<AbstractInsnNode, Instruction> map = builder.getInstructions(); assertEquals(CounterImpl.COUNTER_1_0, map.get(i1).getInstructionCounter()); }
From source file:org.jacoco.core.internal.analysis.InstructionsBuilderTest.java
License:Open Source License
@Test public void subsequent_instructions_should_be_linked_after_label_marked_as_successor() { InsnNode i1 = new InsnNode(Opcodes.NOP); builder.addInstruction(i1);// ww w .ja va2s . com Label l = new Label(); LabelInfo.setSuccessor(l); builder.addLabel(l); InsnNode i2 = new InsnNode(Opcodes.NOP); builder.addInstruction(i2); // mark i2 as covered builder.addProbe(1, 0); // coverage should be propagated to i1 Map<AbstractInsnNode, Instruction> map = builder.getInstructions(); assertEquals(CounterImpl.COUNTER_0_1, map.get(i1).getInstructionCounter()); }
From source file:org.jacoco.core.internal.analysis.InstructionsBuilderTest.java
License:Open Source License
@Test public void subsequent_instructions_should_not_be_linked_after_label_not_marked_as_successor() { InsnNode i1 = new InsnNode(Opcodes.NOP); builder.addInstruction(i1);//from w w w .ja v a 2 s.co m builder.addLabel(new Label()); InsnNode i2 = new InsnNode(Opcodes.NOP); builder.addInstruction(i2); // mark i2 as covered builder.addProbe(1, 0); // coverage should not be propagated to i1 Map<AbstractInsnNode, Instruction> map = builder.getInstructions(); assertEquals(CounterImpl.COUNTER_1_0, map.get(i1).getInstructionCounter()); }
From source file:org.jacoco.core.internal.analysis.InstructionsBuilderTest.java
License:Open Source License
@Test public void jumps_should_propagate_coverage_status() { InsnNode i1 = new InsnNode(Opcodes.NOP); builder.addInstruction(i1);// w w w . j a va 2 s . c om Label l2 = new Label(); builder.addJump(l2, 0); builder.addLabel(l2); InsnNode i2 = new InsnNode(Opcodes.NOP); builder.addInstruction(i2); // mark i2 as covered builder.addProbe(1, 0); // coverage should be propagated to i1 Map<AbstractInsnNode, Instruction> map = builder.getInstructions(); assertEquals(CounterImpl.COUNTER_0_1, map.get(i1).getInstructionCounter()); }
From source file:org.jacoco.core.internal.analysis.MethodAnalyzerTest.java
License:Open Source License
private void createLinearSequence() { method.visitLineNumber(1001, new Label()); method.visitInsn(Opcodes.NOP); method.visitLineNumber(1002, new Label()); method.visitInsn(Opcodes.RETURN);/*from w ww . j ava 2 s . co m*/ }
From source file:org.jacoco.core.internal.analysis.MethodAnalyzerTest.java
License:Open Source License
private void createIfBranchMerge() { method.visitLineNumber(1001, new Label()); method.visitVarInsn(Opcodes.ILOAD, 1); Label l1 = new Label(); method.visitJumpInsn(Opcodes.IFEQ, l1); method.visitLineNumber(1002, new Label()); method.visitInsn(Opcodes.NOP); method.visitLabel(l1);/* w w w .j a va 2 s.c om*/ method.visitLineNumber(1003, l1); method.visitInsn(Opcodes.RETURN); }
From source file:org.jacoco.core.internal.analysis.MethodCoverageCalculatorTest.java
License:Open Source License
private InsnNode addInsn(int line, boolean... branches) { Instruction i = new Instruction(line); int idx = 0;//from w ww. j a va 2 s .c om for (boolean covered : branches) { i.addBranch(covered, idx++); } InsnNode node = new InsnNode(Opcodes.NOP); list.add(node); instructions.put(node, i); return node; }
From source file:org.jacoco.core.internal.flow.InstructionTest.java
License:Open Source License
@Before public void setup() { instruction = new Instruction(new InsnNode(Opcodes.NOP), 123); }
From source file:org.jacoco.core.internal.flow.InstructionTest.java
License:Open Source License
@Test public void testInit() { final InsnNode node = new InsnNode(Opcodes.NOP); instruction = new Instruction(node, 123); assertSame(node, instruction.getNode()); assertEquals(123, instruction.getLine()); assertEquals(0, instruction.getBranches()); assertEquals(0, instruction.getCoveredBranches()); }
From source file:org.jacoco.core.internal.flow.InstructionTest.java
License:Open Source License
@Test public void testSetPredecessor() { final Instruction predecessor = new Instruction(new InsnNode(Opcodes.NOP), 122); instruction.setPredecessor(predecessor, 0); assertEquals(1, predecessor.getBranches()); }