use of com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionModel.CCachedExpressionTreeNode 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());
}
use of com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionModel.CCachedExpressionTreeNode 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());
}
use of com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionModel.CCachedExpressionTreeNode in project binnavi by google.
the class CCriteriumExecuterTest method testSingleSelectionCriterionUnselected.
@Test
public void testSingleSelectionCriterionUnselected() {
assertEquals(0, m_graph.getSelectedNodes().size());
m_graph.getRawView().getGraph().getNodes().get(1).setSelected(true);
assertEquals(1, m_graph.getSelectedNodes().size());
final CCachedSelectionCriterium criterium = new CCachedSelectionCriterium(SelectionState.UNSELECTED);
final CCachedExpressionTreeNode node = new CCachedExpressionTreeNode(criterium);
CCachedExpressionTreeNode.append(m_tree.getRoot(), node);
assertEquals(1, m_graph.getSelectedNodes().size());
CCriteriumExecuter.execute(m_tree, m_graph);
assertEquals(m_graph.getNodes().size() - 1, m_graph.getSelectedNodes().size());
assertFalse(m_graph.getRawView().getGraph().getNodes().get(1).isSelected());
}
use of com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionModel.CCachedExpressionTreeNode in project binnavi by google.
the class CCriteriumExecuterTest method testSingleSelectionCriterionSelected.
/**
* This test checks if a node that is selected also is selected after criterium executer has been
* run.
*/
@Test
public void testSingleSelectionCriterionSelected() {
assertEquals(0, m_graph.getSelectedNodes().size());
m_graph.getRawView().getGraph().getNodes().get(1).setSelected(true);
assertEquals(1, m_graph.getSelectedNodes().size());
final CCachedSelectionCriterium criterium = new CCachedSelectionCriterium(SelectionState.SELECTED);
final CCachedExpressionTreeNode node = new CCachedExpressionTreeNode(criterium);
CCachedExpressionTreeNode.append(m_tree.getRoot(), node);
assertEquals(1, m_graph.getSelectedNodes().size());
CCriteriumExecuter.execute(m_tree, m_graph);
assertEquals(1, m_graph.getSelectedNodes().size());
assertTrue(m_graph.getRawView().getGraph().getNodes().get(1).isSelected());
}
use of com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionModel.CCachedExpressionTreeNode in project binnavi by google.
the class CCriteriumExecuterTest method testSingleOutDegreeCriterion.
@Test
public void testSingleOutDegreeCriterion() {
final CCachedOutdegreeCriterium criterium = new CCachedOutdegreeCriterium("=", 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());
}
Aggregations