diff --git a/java/java-tests/testData/inspection/dataFlow/fixture/ManyDistinctPairsNotComplex.java b/java/java-tests/testData/inspection/dataFlow/fixture/ManyDistinctPairsNotComplex.java new file mode 100644 index 000000000000..857ea1538de1 --- /dev/null +++ b/java/java-tests/testData/inspection/dataFlow/fixture/ManyDistinctPairsNotComplex.java @@ -0,0 +1,31 @@ +public class ManyDistinctPairsNotComplex { + enum SquareType { + BLACKROOK, BLACKKNIGHT, BLACKBISHOP, BLACKKING, BLACKQUEEN, BLACKPAWN + } + + private SquareType[][] squares; + private int WIDTH; + private int HEIGHT; + + public void blackStartPos() { + for (int row = 0; row < HEIGHT; row++) { + for (int col = 0; col < WIDTH; col++) { + if (row == 6) { + squares[row][col] = SquareType.BLACKPAWN; + } else if (row == 7 && (col == 0 || col == 7)) { + squares[row][col] = SquareType.BLACKROOK; + } else if (row == 7 && (col == 1 || col == 6)) { + squares[row][col] = SquareType.BLACKKNIGHT; + } else if (row == 7 && (col == 2 || col == 5)) { + squares[row][col] = SquareType.BLACKBISHOP; + } else if (row == 7 && col == 3) { + squares[row][col] = SquareType.BLACKKING; + } else if (row == 7 && col == 4) { + squares[row][col] = SquareType.BLACKQUEEN; + } else if (row == 7 && col == 2) { + System.out.println("Impossible"); + } + } + } + } +} diff --git a/java/java-tests/testSrc/com/intellij/codeInspection/DataFlowInspectionTest.java b/java/java-tests/testSrc/com/intellij/codeInspection/DataFlowInspectionTest.java index b495359d971c..59c7d90faf7f 100644 --- a/java/java-tests/testSrc/com/intellij/codeInspection/DataFlowInspectionTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInspection/DataFlowInspectionTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * Copyright 2000-2017 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -273,6 +273,7 @@ public class DataFlowInspectionTest extends DataFlowInspectionTestCase { public void testManySequentialIfsNotComplex() { doTest(); } public void testManySequentialInstanceofsNotComplex() { doTest(); } public void testLongDisjunctionsNotComplex() { doTest(); } + public void testManyDistinctPairsNotComplex() { doTest(); } public void testWhileNotComplex() { doTest(); } public void testAssertTrueNotComplex() { doTest(); } public void testAssertThrowsAssertionError() { doTest(); }