Search in sources :

Example 6 with CCachedExpressionTreeNode

use of com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionModel.CCachedExpressionTreeNode in project binnavi by google.

the class CCriteriumExecuterTest method testInvalidOrCriterion2.

@Test(expected = IllegalStateException.class)
public void testInvalidOrCriterion2() {
    final CCachedOrCriterium criterium = new CCachedOrCriterium();
    final CCachedExpressionTreeNode node = new CCachedExpressionTreeNode(criterium);
    CCachedExpressionTreeNode.append(m_tree.getRoot(), node);
    final CCachedColorCriterium criterium3 = new CCachedColorCriterium(Color.RED);
    final CCachedExpressionTreeNode node3 = new CCachedExpressionTreeNode(criterium3);
    CCachedExpressionTreeNode.append(node, node3);
    CCriteriumExecuter.execute(m_tree, m_graph);
}
Also used : CCachedOrCriterium(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.Or.CCachedOrCriterium) CCachedColorCriterium(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.NodeColor.CCachedColorCriterium) CCachedExpressionTreeNode(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionModel.CCachedExpressionTreeNode) Test(org.junit.Test)

Example 7 with CCachedExpressionTreeNode

use of com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionModel.CCachedExpressionTreeNode in project binnavi by google.

the class CCriteriumExecuterTest method testMatchingNotCriterion.

/**
   * This test makes sure that NOT criteria are correctly evaluated (TRUE case).
   */
@Test
public void testMatchingNotCriterion() {
    final CCachedNotCriterium criterium = new CCachedNotCriterium();
    final CCachedExpressionTreeNode node = new CCachedExpressionTreeNode(criterium);
    CCachedExpressionTreeNode.append(m_tree.getRoot(), node);
    final CCachedColorCriterium criterium3 = new CCachedColorCriterium(Color.RED);
    final CCachedExpressionTreeNode node3 = new CCachedExpressionTreeNode(criterium3);
    CCachedExpressionTreeNode.append(node, node3);
    assertEquals(0, m_graph.getSelectedNodes().size());
    CCriteriumExecuter.execute(m_tree, m_graph);
    assertEquals(2, m_graph.getSelectedNodes().size());
}
Also used : CCachedColorCriterium(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.NodeColor.CCachedColorCriterium) CCachedExpressionTreeNode(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionModel.CCachedExpressionTreeNode) CCachedNotCriterium(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.Not.CCachedNotCriterium) Test(org.junit.Test)

Example 8 with CCachedExpressionTreeNode

use of com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionModel.CCachedExpressionTreeNode in project binnavi by google.

the class CCriteriumExecuterTest method testSingleInDegreeCriterion.

@Test
public void testSingleInDegreeCriterion() {
    final CCachedIndegreeCriterium criterium = new CCachedIndegreeCriterium("=", 1);
    final CCachedExpressionTreeNode node = new CCachedExpressionTreeNode(criterium);
    CCachedExpressionTreeNode.append(m_tree.getRoot(), node);
    assertEquals(0, m_graph.getSelectedNodes().size());
    CCriteriumExecuter.execute(m_tree, m_graph);
    assertEquals(2, m_graph.getSelectedNodes().size());
}
Also used : CCachedIndegreeCriterium(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.InDegrees.CCachedIndegreeCriterium) CCachedExpressionTreeNode(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionModel.CCachedExpressionTreeNode) Test(org.junit.Test)

Example 9 with CCachedExpressionTreeNode

use of com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionModel.CCachedExpressionTreeNode in project binnavi by google.

the class CCriteriumExecuterTest method testSingleVisibilityCriterionUnvisible.

@Test
public void testSingleVisibilityCriterionUnvisible() {
    final CCachedVisibilityCriterium criterium = new CCachedVisibilityCriterium(VisibilityState.UNVISIBLE);
    final CCachedExpressionTreeNode node = new CCachedExpressionTreeNode(criterium);
    CCachedExpressionTreeNode.append(m_tree.getRoot(), node);
    assertEquals(0, m_graph.getSelectedNodes().size());
    CCriteriumExecuter.execute(m_tree, m_graph);
    assertEquals(1, m_graph.getSelectedNodes().size());
}
Also used : CCachedVisibilityCriterium(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.Visibillity.CCachedVisibilityCriterium) CCachedExpressionTreeNode(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionModel.CCachedExpressionTreeNode) Test(org.junit.Test)

Example 10 with CCachedExpressionTreeNode

use of com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionModel.CCachedExpressionTreeNode in project binnavi by google.

the class CCriteriumExecuterTest method testValidNotCriterion.

/**
   * This test makes sure that NOT criteria are correctly evaluated (FALSE case).
   */
@Test
public void testValidNotCriterion() {
    final CCachedNotCriterium criterium = new CCachedNotCriterium();
    final CCachedExpressionTreeNode node = new CCachedExpressionTreeNode(criterium);
    CCachedExpressionTreeNode.append(m_tree.getRoot(), node);
    final CCachedTextCriterium criterium2 = new CCachedTextCriterium("nop", false, false);
    final CCachedExpressionTreeNode node2 = new CCachedExpressionTreeNode(criterium2);
    CCachedExpressionTreeNode.append(node, node2);
    assertEquals(0, m_graph.getSelectedNodes().size());
    CCriteriumExecuter.execute(m_tree, m_graph);
    assertEquals(2, m_graph.getSelectedNodes().size());
}
Also used : CCachedTextCriterium(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.Text.CCachedTextCriterium) CCachedExpressionTreeNode(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionModel.CCachedExpressionTreeNode) CCachedNotCriterium(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.Not.CCachedNotCriterium) Test(org.junit.Test)

Aggregations

CCachedExpressionTreeNode (com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionModel.CCachedExpressionTreeNode)25 Test (org.junit.Test)25 CCachedColorCriterium (com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.NodeColor.CCachedColorCriterium)11 CCachedTextCriterium (com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.Text.CCachedTextCriterium)9 CCachedAndCriterium (com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.And.CCachedAndCriterium)5 CCriteriumCache (com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Cache.CCriteriumCache)4 CCachedOrCriterium (com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.Or.CCachedOrCriterium)4 CCachedExpressionTree (com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionModel.CCachedExpressionTree)4 CCachedNotCriterium (com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.Not.CCachedNotCriterium)3 CCachedSelectionCriterium (com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.Selection.CCachedSelectionCriterium)2 CCachedVisibilityCriterium (com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.Visibillity.CCachedVisibilityCriterium)2 CCachedIndegreeCriterium (com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.InDegrees.CCachedIndegreeCriterium)1 CCachedOutdegreeCriterium (com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.OutDegree.CCachedOutdegreeCriterium)1 CCachedTagCriterium (com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.Tag.CCachedTagCriterium)1 CTag (com.google.security.zynamics.binnavi.Tagging.CTag)1 NaviNode (com.google.security.zynamics.binnavi.yfileswrap.zygraph.NaviNode)1 HashSet (java.util.HashSet)1