Exemplo n.º 1
0
  public void testReplace() {
    Path replacement = n[0].asPath().append(newEdge(0, 1).asPath()).append(newEdge(1, 0).asPath());
    Path trivial = path.replace(0, 0, replacement);
    assertEquals(2, trivial.size());
    assertTrue(trivial.isCycle());

    Path repl2 = n[0].asPath().append(newEdge(0, 5).asPath()).append(newEdge(5, 1).asPath());
    Path p = trivial.replace(0, 1, repl2);
    assertEquals(3, p.size());
    assertEquals(n[0], p.headNode());
    assertEquals(n[0], p.tailNode());
    assertEquals(n[5], p.getNode(1));
  }