From 14bb8f995f50f0fdcdfbf2aa6f322ec0432e8959 Mon Sep 17 00:00:00 2001 From: Ivan Kniazkov Date: Tue, 26 Nov 2024 13:50:41 +0300 Subject: [PATCH] + test --- .../astranaut/core/algorithms/mapping/SectionTest.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/test/java/org/cqfn/astranaut/core/algorithms/mapping/SectionTest.java b/src/test/java/org/cqfn/astranaut/core/algorithms/mapping/SectionTest.java index c6ba89a..bfd79d4 100644 --- a/src/test/java/org/cqfn/astranaut/core/algorithms/mapping/SectionTest.java +++ b/src/test/java/org/cqfn/astranaut/core/algorithms/mapping/SectionTest.java @@ -54,7 +54,7 @@ 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); @@ -62,10 +62,14 @@ void removeNode() { 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))); @@ -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); }