From cd977c17ee5cd4ef68d0021dc69c131364122376 Mon Sep 17 00:00:00 2001 From: JSDurand Date: Wed, 12 Jul 2023 10:29:50 +0800 Subject: Fix the bug of testing prefixes and planting Previously the functions `is_prefix` and `plant` did not take the situation of packed nodes into considerations. That was because I only dealt with non-packed nodes in the past: the fragment to test for prefixes and for planting did not intersect the packed nodes in the forest, and the grammar is so simple that the fragments do not contain packed nodes. Then a test revealed this situation, so I have to fix this lack of considerations now. This commit attempts to fix this issue. From the newly added unit-tests, it seems that this fix works. :) --- chain/src/item/default/splone.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'chain/src/item/default/splone.rs') diff --git a/chain/src/item/default/splone.rs b/chain/src/item/default/splone.rs index da13c56..c9d9c5a 100644 --- a/chain/src/item/default/splone.rs +++ b/chain/src/item/default/splone.rs @@ -657,7 +657,7 @@ impl DefaultForest> { } else if labela.clone_index().is_some() { let mut parentsa = self.parents_of(nodea)?; - // assert_eq!(parentsa.len(), 1); + assert_eq!(parentsa.len(), 1); let parenta = parentsa.next().unwrap().node(); -- cgit v1.2.3-18-g5258