use of il.org.spartan.Leonidas.plugin.tippers.LeonidasTipper in project Main by SpartanRefactoring.
the class BooleanLiteralTest method testTipper.
public void testTipper() throws Exception {
File f = new File(Resources.getResource("BooleanLiteralTestTip.java").getPath());
LeonidasTipper lt = new LeonidasTipper("BooleanLiteralTestTip.java", IOUtils.toString(new BufferedReader(new InputStreamReader(new FileInputStream(f)))));
PsiWhileStatement pws1 = createTestWhileStatementFromString("while (true) {\nx++;\n}");
assertTrue(lt.canTip(pws1));
PsiWhileStatement pws2 = createTestWhileStatementFromString("while (false) {\nx++;\n}");
assertTrue(lt.canTip(pws2));
PsiWhileStatement pws3 = createTestWhileStatementFromString("while (x > 2) {\nx++;\n}");
assertFalse(lt.canTip(pws3));
PsiWhileStatement pws4 = createTestWhileStatementFromString("while (true) {\nx++; x--;\n}");
assertFalse(lt.canTip(pws4));
}
use of il.org.spartan.Leonidas.plugin.tippers.LeonidasTipper in project Main by SpartanRefactoring.
the class OptionalTest method testTip1.
public void testTip1() throws Exception {
File f = new File(Resources.getResource("OptionalTestTipper1.java").getPath());
LeonidasTipper lt = new LeonidasTipper("OptionalTestTipper1", IOUtils.toString(new BufferedReader(new InputStreamReader(new FileInputStream(f)))));
PsiWhileStatement pws1 = createTestWhileStatementFromString("while (x > 2) {\nx++; y--; x--; \n}");
assertTrue(lt.canTip(pws1));
PsiWhileStatement pws2 = createTestWhileStatementFromString("while (x > 2) {\nx++; x--; \n}");
assertTrue(lt.canTip(pws2));
PsiWhileStatement pws3 = createTestWhileStatementFromString("while (x > 2) {\nx++;\n}");
assertFalse(lt.canTip(pws3));
PsiWhileStatement pws4 = createTestWhileStatementFromString("while (x > 2) {\nx++; x--; x--; \n}");
assertTrue(lt.canTip(pws4));
PsiWhileStatement pws5 = createTestWhileStatementFromString("while (x > 2) {\nx++; x++; x--; \n}");
assertTrue(lt.canTip(pws5));
}
use of il.org.spartan.Leonidas.plugin.tippers.LeonidasTipper in project Main by SpartanRefactoring.
the class AnyNumberOfTest method testTipper.
public void testTipper() throws Exception {
File f = new File(Resources.getResource("AnyNumberOfTipperTest.java").getPath());
LeonidasTipper lt = new LeonidasTipper("AnyNumberOfTipperTest", IOUtils.toString(new BufferedReader(new InputStreamReader(new FileInputStream(f)))));
PsiWhileStatement pws1 = createTestWhileStatementFromString("while (x > 2) {\nx++; y--; x--; \n}");
assertTrue(lt.canTip(pws1));
PsiWhileStatement pws2 = createTestWhileStatementFromString("while (x > 2) {\nx++; x--; \n}");
assertTrue(lt.canTip(pws2));
PsiWhileStatement pws3 = createTestWhileStatementFromString("while (x > 2) {\nx++;\n}");
assertFalse(lt.canTip(pws3));
PsiWhileStatement pws4 = createTestWhileStatementFromString("while (x > 2) {\nx++; x--; x--; \n}");
assertTrue(lt.canTip(pws4));
PsiWhileStatement pws5 = createTestWhileStatementFromString("while (x > 2) {\nx++; x++; x--; \n}");
assertTrue(lt.canTip(pws5));
PsiWhileStatement pws6 = createTestWhileStatementFromString("while (x > 2) {\nx++; y--; y++; x--; \n}");
assertTrue(lt.canTip(pws6));
}
Aggregations