Skip to content

Commit 1547549

Browse files
committed
feat: assert that there is at most one ELIF/ELSE
1 parent 047df57 commit 1547549

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/main/java/org/variantsync/diffdetective/variation/diff/DiffNode.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -747,6 +747,14 @@ public void assertConsistency() {
747747
});
748748
}
749749

750+
// check that there is at most one ELIF/ELSE
751+
Time.forAll(time ->
752+
Assert.assertTrue(
753+
getChildOrder(time).stream().filter(c -> c.isElif() || c.isElse()).count() <= 1,
754+
"There is more than one ELIF/ELSE node"
755+
)
756+
);
757+
750758
final DiffNode<L> pb = getParent(BEFORE);
751759
final DiffNode<L> pa = getParent(AFTER);
752760

src/main/java/org/variantsync/diffdetective/variation/tree/VariationNode.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,12 @@ public void assertConsistency() {
537537
"The root has to have the feature mapping 'true'");
538538
}
539539

540+
// check that there is at most one ELIF/ELSE
541+
Assert.assertTrue(
542+
getChildren().stream().filter(c -> c.isElif() || c.isElse()).count() <= 1,
543+
"There is more than one ELIF/ELSE node"
544+
);
545+
540546
// check consistency of children lists and edges
541547
for (var child : getChildren()) {
542548
Assert.assertTrue(

0 commit comments

Comments
 (0)