From ab9e470ea9958d5a1acceeb579c5093b1a5fbe95 Mon Sep 17 00:00:00 2001 From: Svetlana Isakova Date: Wed, 5 Mar 2014 15:26:22 +0400 Subject: [PATCH] check edges directions only in ControlFlowTest --- .../jet/cfg/AbstractControlFlowTest.java | 18 ++++++++++++++++++ .../jet/cfg/AbstractPseudocodeTest.java | 16 +--------------- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/compiler/tests/org/jetbrains/jet/cfg/AbstractControlFlowTest.java b/compiler/tests/org/jetbrains/jet/cfg/AbstractControlFlowTest.java index c77756f2335..2169111c5ae 100644 --- a/compiler/tests/org/jetbrains/jet/cfg/AbstractControlFlowTest.java +++ b/compiler/tests/org/jetbrains/jet/cfg/AbstractControlFlowTest.java @@ -100,4 +100,22 @@ public abstract class AbstractControlFlowTest extends AbstractPseudocodeTest { } return Collections.singleton(natural).equals(new HashSet(actual)); } + + @Override + protected void checkPseudocode(PseudocodeImpl pseudocode) { + //check edges directions + Collection instructions = pseudocode.getAllInstructions(); + for (Instruction instruction : instructions) { + if (!((InstructionImpl)instruction).isDead()) { + for (Instruction nextInstruction : instruction.getNextInstructions()) { + assertTrue("instruction '" + instruction + "' has '" + nextInstruction + "' among next instructions list, but not vice versa", + nextInstruction.getPreviousInstructions().contains(instruction)); + } + for (Instruction prevInstruction : instruction.getPreviousInstructions()) { + assertTrue("instruction '" + instruction + "' has '" + prevInstruction + "' among previous instructions list, but not vice versa", + prevInstruction.getNextInstructions().contains(instruction)); + } + } + } + } } diff --git a/compiler/tests/org/jetbrains/jet/cfg/AbstractPseudocodeTest.java b/compiler/tests/org/jetbrains/jet/cfg/AbstractPseudocodeTest.java index 37177ef5307..9905d3a05e5 100644 --- a/compiler/tests/org/jetbrains/jet/cfg/AbstractPseudocodeTest.java +++ b/compiler/tests/org/jetbrains/jet/cfg/AbstractPseudocodeTest.java @@ -122,21 +122,7 @@ public abstract class AbstractPseudocodeTest extends KotlinTestWithEnvironment { JetTestUtils.assertEqualsToFile(expectedInstructionsFile, instructionDump.toString()); } - private void checkPseudocode(PseudocodeImpl pseudocode) { - //check edges directions - Collection instructions = pseudocode.getAllInstructions(); - for (Instruction instruction : instructions) { - if (!((InstructionImpl)instruction).isDead()) { - for (Instruction nextInstruction : instruction.getNextInstructions()) { - assertTrue("instruction '" + instruction + "' has '" + nextInstruction + "' among next instructions list, but not vice versa", - nextInstruction.getPreviousInstructions().contains(instruction)); - } - for (Instruction prevInstruction : instruction.getPreviousInstructions()) { - assertTrue("instruction '" + instruction + "' has '" + prevInstruction + "' among previous instructions list, but not vice versa", - prevInstruction.getNextInstructions().contains(instruction)); - } - } - } + protected void checkPseudocode(PseudocodeImpl pseudocode) { } private static String formatInstruction(Instruction instruction, int maxLength, Set remainedAfterPostProcessInstructions) {