Search in sources :

Example 11 with CCachedExpressionTreeNode

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

the class CCriteriumExecuterTest method testInvalidAndCriterion1.

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

Example 12 with CCachedExpressionTreeNode

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

the class CCriteriumCacheTest method testAdd.

@Test
public void testAdd() {
    final CCachedExpressionTree cachedTree = new CCachedExpressionTree();
    final CCachedExpressionTree cachedTree2 = new CCachedExpressionTree();
    final CCachedAndCriterium criterium = new CCachedAndCriterium();
    final CCachedExpressionTreeNode node = new CCachedExpressionTreeNode(criterium);
    CCachedExpressionTreeNode.append(cachedTree.getRoot(), node);
    final CCachedExpressionTreeNode node_a = new CCachedExpressionTreeNode(new CCachedColorCriterium(Color.red));
    CCachedExpressionTreeNode.append(node, node_a);
    final CCachedExpressionTreeNode node_b = new CCachedExpressionTreeNode(new CCachedColorCriterium(Color.blue));
    CCachedExpressionTreeNode.append(node, node_b);
    final CCachedExpressionTreeNode node2 = new CCachedExpressionTreeNode(new CCachedTextCriterium("foo", false, false));
    CCachedExpressionTreeNode.append(cachedTree2.getRoot(), node2);
    final CCriteriumCache criteriumCache = new CCriteriumCache();
    criteriumCache.addListener(m_listener);
    assertEquals(0, criteriumCache.getTrees().size());
    criteriumCache.add(cachedTree);
    assertEquals(1, criteriumCache.getTrees().size());
    criteriumCache.add(cachedTree2);
    assertEquals(2, criteriumCache.getTrees().size());
}
Also used : CCachedAndCriterium(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.And.CCachedAndCriterium) CCachedExpressionTree(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionModel.CCachedExpressionTree) CCachedTextCriterium(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.Text.CCachedTextCriterium) CCachedColorCriterium(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.NodeColor.CCachedColorCriterium) CCachedExpressionTreeNode(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionModel.CCachedExpressionTreeNode) CCriteriumCache(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Cache.CCriteriumCache) Test(org.junit.Test)

Example 13 with CCachedExpressionTreeNode

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

the class CCriteriumCacheTest method testRemoveListener.

@Test
public void testRemoveListener() {
    final CCachedExpressionTree cachedTree = new CCachedExpressionTree();
    final CCachedExpressionTreeNode node = new CCachedExpressionTreeNode(new CCachedTextCriterium("foo", false, false));
    CCachedExpressionTreeNode.append(cachedTree.getRoot(), node);
    final CCriteriumCache criteriumCache = new CCriteriumCache();
    criteriumCache.addListener(m_listener);
    assertEquals(0, criteriumCache.getTrees().size());
    criteriumCache.add(cachedTree);
    assertEquals(1, criteriumCache.getTrees().size());
    criteriumCache.removeListener(m_listener);
}
Also used : CCachedExpressionTree(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionModel.CCachedExpressionTree) CCachedTextCriterium(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.Text.CCachedTextCriterium) CCachedExpressionTreeNode(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionModel.CCachedExpressionTreeNode) CCriteriumCache(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Cache.CCriteriumCache) Test(org.junit.Test)

Example 14 with CCachedExpressionTreeNode

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

the class CCriteriumExecuterTest method testInvalidCriterionNumber.

@Test(expected = IllegalStateException.class)
public void testInvalidCriterionNumber() {
    final CCachedColorCriterium criterium2 = new CCachedColorCriterium(Color.BLUE);
    final CCachedExpressionTreeNode node2 = new CCachedExpressionTreeNode(criterium2);
    CCachedExpressionTreeNode.append(m_tree.getRoot(), node2);
    final CCachedColorCriterium criterium3 = new CCachedColorCriterium(Color.RED);
    final CCachedExpressionTreeNode node3 = new CCachedExpressionTreeNode(criterium3);
    CCachedExpressionTreeNode.append(m_tree.getRoot(), node3);
    CCriteriumExecuter.execute(m_tree, m_graph);
}
Also used : 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 15 with CCachedExpressionTreeNode

use of com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionModel.CCachedExpressionTreeNode 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)

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