use of com.google.security.zynamics.binnavi.yfileswrap.Gui.GraphWindows.Searchers.Text.Model.GraphSearcher in project binnavi by google.
the class GraphSearcherTest method testAfterLast.
@Test
public void testAfterLast() {
final ZyNodeRealizer<NaviNode> r = new ZyNormalNodeRealizer<NaviNode>(m_content);
final NaviNode m_node1 = new NaviNode(m_ynode, r, m_codeNode1);
final GraphSearcher searcher = new GraphSearcher();
searcher.search(Lists.newArrayList(m_node1), new ArrayList<NaviEdge>(), "");
assertNull(searcher.getCursor().current());
m_content.addLineContent(new ZyLineContent("Hello my Test", null));
searcher.search(Lists.newArrayList(m_node1), new ArrayList<NaviEdge>(), "my");
assertFalse(searcher.getCursor().isAfterLast());
searcher.getCursor().next();
assertTrue(searcher.getCursor().isAfterLast());
searcher.getCursor().next();
assertTrue(searcher.getCursor().isAfterLast());
}
use of com.google.security.zynamics.binnavi.yfileswrap.Gui.GraphWindows.Searchers.Text.Model.GraphSearcher in project binnavi by google.
the class GraphSearcherTest method testSimpleNoResult.
@Test
public void testSimpleNoResult() {
final ZyNodeRealizer<NaviNode> r = new ZyNormalNodeRealizer<NaviNode>(m_content);
final NaviNode m_node1 = new NaviNode(m_ynode, r, m_codeNode1);
final GraphSearcher searcher = new GraphSearcher();
m_content.addLineContent(new ZyLineContent("Hello my Test", null));
searcher.search(Lists.newArrayList(m_node1), new ArrayList<NaviEdge>(), "mx");
searcher.getCursor().next();
assertNull(searcher.getCursor().current());
}
use of com.google.security.zynamics.binnavi.yfileswrap.Gui.GraphWindows.Searchers.Text.Model.GraphSearcher in project binnavi by google.
the class GraphSearcherTest method testSearchSelected.
@Test
public void testSearchSelected() {
final ZyNodeRealizer<NaviNode> r = new ZyNormalNodeRealizer<NaviNode>(m_content);
final NaviNode m_node1 = new NaviNode(m_ynode, r, m_codeNode1);
final GraphSearcher searcher = new GraphSearcher();
searcher.getSettings().setOnlySelected(true);
m_content.addLineContent(new ZyLineContent("Hello my Test", null));
searcher.search(Lists.newArrayList(m_node1), new ArrayList<NaviEdge>(), "my");
assertNull(searcher.getCursor().current());
m_node1.getRawNode().setSelected(true);
searcher.search(Lists.newArrayList(m_node1), new ArrayList<NaviEdge>(), "my");
assertEquals(m_node1, searcher.getCursor().current().getObject());
assertEquals(0, searcher.getCursor().current().getLine());
assertEquals(6, searcher.getCursor().current().getPosition());
assertEquals(2, searcher.getCursor().current().getLength());
// TEST: Do not move beyond the last result
searcher.getCursor().next();
assertEquals(m_node1, searcher.getCursor().current().getObject());
assertEquals(0, searcher.getCursor().current().getLine());
assertEquals(6, searcher.getCursor().current().getPosition());
assertEquals(2, searcher.getCursor().current().getLength());
}
use of com.google.security.zynamics.binnavi.yfileswrap.Gui.GraphWindows.Searchers.Text.Model.GraphSearcher in project binnavi by google.
the class GraphSearcherTest method testSearchRegex.
@Test
public void testSearchRegex() {
final ZyNodeRealizer<NaviNode> r = new ZyNormalNodeRealizer<NaviNode>(m_content);
final NaviNode m_node1 = new NaviNode(m_ynode, r, m_codeNode1);
final GraphSearcher searcher = new GraphSearcher();
searcher.getSettings().setRegEx(true);
m_content.addLineContent(new ZyLineContent("Hello my Test", null));
searcher.search(Lists.newArrayList(m_node1), new ArrayList<NaviEdge>(), "my[^s]*");
assertEquals(m_node1, searcher.getCursor().current().getObject());
assertEquals(0, searcher.getCursor().current().getLine());
assertEquals(6, searcher.getCursor().current().getPosition());
assertEquals(5, searcher.getCursor().current().getLength());
searcher.search(Lists.newArrayList(m_node1), new ArrayList<NaviEdge>(), "my.*");
assertEquals(m_node1, searcher.getCursor().current().getObject());
assertEquals(0, searcher.getCursor().current().getLine());
assertEquals(6, searcher.getCursor().current().getPosition());
assertEquals(7, searcher.getCursor().current().getLength());
searcher.getSettings().setCaseSensitive(true);
searcher.search(Lists.newArrayList(m_node1), new ArrayList<NaviEdge>(), "my[^t]*");
assertEquals(m_node1, searcher.getCursor().current().getObject());
assertEquals(0, searcher.getCursor().current().getLine());
assertEquals(6, searcher.getCursor().current().getPosition());
assertEquals(6, searcher.getCursor().current().getLength());
}
use of com.google.security.zynamics.binnavi.yfileswrap.Gui.GraphWindows.Searchers.Text.Model.GraphSearcher in project binnavi by google.
the class GraphSearcherTest method testSimpleMultiple.
@Test
public void testSimpleMultiple() {
final ZyNodeRealizer<NaviNode> r = new ZyNormalNodeRealizer<NaviNode>(m_content);
final NaviNode m_node1 = new NaviNode(m_ynode, r, m_codeNode1);
final GraphSearcher searcher = new GraphSearcher();
m_content.addLineContent(new ZyLineContent("Hello my my Test", null));
searcher.search(Lists.newArrayList(m_node1), new ArrayList<NaviEdge>(), "my");
assertEquals(m_node1, searcher.getCursor().current().getObject());
assertEquals(0, searcher.getCursor().current().getLine());
assertEquals(6, searcher.getCursor().current().getPosition());
assertEquals(2, searcher.getCursor().current().getLength());
}
Aggregations