Search in sources :

Example 1 with CCachedOrCriterium

use of com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.Or.CCachedOrCriterium 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 2 with CCachedOrCriterium

use of com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.Or.CCachedOrCriterium in project binnavi by google.

the class CCriteriumExecuterTest method testInvalidOrCriterion1.

/**
   * This test makes sure that criteria trees with OR expressions with fewer than two children can
   * not be evaluated..
   */
@Test(expected = IllegalStateException.class)
public void testInvalidOrCriterion1() {
    final CCachedOrCriterium criterium = new CCachedOrCriterium();
    final CCachedExpressionTreeNode node = new CCachedExpressionTreeNode(criterium);
    CCachedExpressionTreeNode.append(m_tree.getRoot(), node);
    CCriteriumExecuter.execute(m_tree, m_graph);
}
Also used : CCachedOrCriterium(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.Or.CCachedOrCriterium) CCachedExpressionTreeNode(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionModel.CCachedExpressionTreeNode) Test(org.junit.Test)

Example 3 with CCachedOrCriterium

use of com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.Or.CCachedOrCriterium in project binnavi by google.

the class CCriteriumExecuterTest method testMatchingOrCriterion.

/**
   * This test makes sure that OR criteria are correctly evaluated (TRUE case).
   */
@Test
public void testMatchingOrCriterion() {
    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);
    final CCachedTextCriterium criterium2 = new CCachedTextCriterium("mov", 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) 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 4 with CCachedOrCriterium

use of com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.Or.CCachedOrCriterium in project binnavi by google.

the class CCriteriumExecuterTest method testValidOrCriterion.

/**
   * This test makes sure that OR criteria are correctly evaluated (FALSE case).
   */
@Test
public void testValidOrCriterion() {
    final CCachedOrCriterium criterium = new CCachedOrCriterium();
    final CCachedExpressionTreeNode node = new CCachedExpressionTreeNode(criterium);
    CCachedExpressionTreeNode.append(m_tree.getRoot(), node);
    final CCachedColorCriterium criterium3 = new CCachedColorCriterium(Color.GREEN);
    final CCachedExpressionTreeNode node3 = new CCachedExpressionTreeNode(criterium3);
    CCachedExpressionTreeNode.append(node, node3);
    final CCachedColorCriterium criterium2 = new CCachedColorCriterium(Color.BLUE);
    final CCachedExpressionTreeNode node2 = new CCachedExpressionTreeNode(criterium2);
    CCachedExpressionTreeNode.append(node, node2);
    assertEquals(0, m_graph.getSelectedNodes().size());
    CCriteriumExecuter.execute(m_tree, m_graph);
    assertEquals(0, m_graph.getSelectedNodes().size());
}
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)

Aggregations

CCachedOrCriterium (com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.Or.CCachedOrCriterium)4 CCachedExpressionTreeNode (com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionModel.CCachedExpressionTreeNode)4 Test (org.junit.Test)4 CCachedColorCriterium (com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.NodeColor.CCachedColorCriterium)3 CCachedTextCriterium (com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.Text.CCachedTextCriterium)1