Skip to content

Commit

Permalink
+ test
Browse files Browse the repository at this point in the history
  • Loading branch information
kniazkov committed Nov 26, 2024
1 parent dbc82bf commit 14bb8f9
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,22 @@ void testBaseInterface() {
@Test
void removeNode() {
final ExtNodeCreator creator = new ExtNodeCreator();
final ExtNode left = creator.create(DraftNode.create("A(E,F)"));
final ExtNode left = creator.create(DraftNode.create("A(E,F,Q)"));
final ExtNode right = creator.create(DraftNode.create("A(G,H,I)"));
final Section initial = new Section(left, right);
final Section same = initial.removeNode(left);
Assertions.assertSame(initial, same);
initial.setFlag(Section.FLAG_NO_IDENTICAL);
Section section = initial.removeNode(right.getExtChild(1));
Assertions.assertFalse(section.hasNode(right.getExtChild(1)));
Assertions.assertEquals(4, section.getLeft().size() + section.getRight().size());
Assertions.assertEquals(5, section.getLeft().size() + section.getRight().size());
section = section.removeNode(left.getExtChild(0));
Assertions.assertFalse(section.hasNode(left.getExtChild(0)));
Assertions.assertSame(left.getExtChild(0), section.getPrevious());
Assertions.assertEquals(4, section.getLeft().size() + section.getRight().size());
section = section.removeNode(left.getExtChild(2));
Assertions.assertFalse(section.hasNode(left.getExtChild(2)));
Assertions.assertSame(left.getExtChild(0), section.getPrevious());
Assertions.assertEquals(3, section.getLeft().size() + section.getRight().size());
section = section.removeNode(left.getExtChild(1));
Assertions.assertFalse(section.hasNode(left.getExtChild(1)));
Expand All @@ -82,6 +86,7 @@ void removeNode() {
Assertions.assertTrue(section.getRight().isEmpty());
section = section.removeNode(left.getExtChild(0));
section = section.removeNode(left.getExtChild(1));
section = section.removeNode(left.getExtChild(2));
Assertions.assertNull(section);
}

Expand Down

0 comments on commit 14bb8f9

Please sign in to comment.