Skip to content

Commit

Permalink
Descriptive names for all tests in FrameSnapshotTest (#609)
Browse files Browse the repository at this point in the history
  • Loading branch information
marchof authored and Godin committed Oct 9, 2017
1 parent 9924475 commit 4d6ca95
Showing 1 changed file with 16 additions and 8 deletions.
Expand Up @@ -49,40 +49,48 @@ public void teardown() {
} }


@Test @Test
public void testNullAnalyzer() { public void should_not_capture_frame_when_no_analyzer_is_given() {
frame = FrameSnapshot.create(null, 0); frame = FrameSnapshot.create(null, 0);
} }


@Test @Test
public void testNoFrame() { public void should_not_capture_frame_when_no_frame_is_defined() {
analyzer.visitJumpInsn(Opcodes.GOTO, new Label()); analyzer.visitJumpInsn(Opcodes.GOTO, new Label());
frame = FrameSnapshot.create(analyzer, 0); frame = FrameSnapshot.create(analyzer, 0);
} }


@Test @Test
public void testFrame() { public void should_capture_frame_when_frame_is_defined() {
analyzer.visitInsn(Opcodes.FCONST_0);
analyzer.visitVarInsn(Opcodes.FSTORE, 1);
analyzer.visitInsn(Opcodes.ICONST_0); analyzer.visitInsn(Opcodes.ICONST_0);
frame = FrameSnapshot.create(analyzer, 0); frame = FrameSnapshot.create(analyzer, 0);


expectedVisitor.visitFrame(Opcodes.F_FULL, 1, arr("Foo"), 1, expectedVisitor.visitFrame(Opcodes.F_FULL, 2, arr("Foo", Opcodes.FLOAT),
arr(Opcodes.INTEGER)); 1, arr(Opcodes.INTEGER));
} }


@Test @Test
public void testReduce() { public void should_combine_slots_when_doube_or_long_types_are_given() {
analyzer.visitInsn(Opcodes.DCONST_0);
analyzer.visitVarInsn(Opcodes.DSTORE, 1);
analyzer.visitInsn(Opcodes.FCONST_0);
analyzer.visitVarInsn(Opcodes.FSTORE, 3);

analyzer.visitInsn(Opcodes.ICONST_0); analyzer.visitInsn(Opcodes.ICONST_0);
analyzer.visitInsn(Opcodes.LCONST_0); analyzer.visitInsn(Opcodes.LCONST_0);
analyzer.visitInsn(Opcodes.ICONST_0); analyzer.visitInsn(Opcodes.ICONST_0);
analyzer.visitInsn(Opcodes.DCONST_0); analyzer.visitInsn(Opcodes.DCONST_0);
frame = FrameSnapshot.create(analyzer, 0); frame = FrameSnapshot.create(analyzer, 0);


final Object[] vars = arr("Foo", Opcodes.DOUBLE, Opcodes.FLOAT);
final Object[] stack = arr(Opcodes.INTEGER, Opcodes.LONG, final Object[] stack = arr(Opcodes.INTEGER, Opcodes.LONG,
Opcodes.INTEGER, Opcodes.DOUBLE); Opcodes.INTEGER, Opcodes.DOUBLE);
expectedVisitor.visitFrame(Opcodes.F_FULL, 1, arr("Foo"), 4, stack); expectedVisitor.visitFrame(Opcodes.F_FULL, 3, vars, 4, stack);
} }


@Test @Test
public void testPop() { public void should_decrease_stack_when_popCount_is_given() {
analyzer.visitInsn(Opcodes.ICONST_0); analyzer.visitInsn(Opcodes.ICONST_0);
analyzer.visitInsn(Opcodes.LCONST_0); analyzer.visitInsn(Opcodes.LCONST_0);
analyzer.visitInsn(Opcodes.ICONST_0); analyzer.visitInsn(Opcodes.ICONST_0);
Expand Down

0 comments on commit 4d6ca95

Please sign in to comment.