feat(batch2): verify sublist helper remainder features
This commit is contained in:
@@ -219,6 +219,51 @@ public class SubscriptionIndexTests
|
||||
s.NumLevels().ShouldBe(0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void PruneNode_NullNode_DoesNotMutateLiteralNodes()
|
||||
{
|
||||
var level = new SubscriptionIndex.Level();
|
||||
var literal = new SubscriptionIndex.Node();
|
||||
level.Nodes["foo"] = literal;
|
||||
level.Fwc = new SubscriptionIndex.Node();
|
||||
level.Pwc = new SubscriptionIndex.Node();
|
||||
|
||||
level.PruneNode(null!, "foo");
|
||||
|
||||
level.Nodes.Count.ShouldBe(1);
|
||||
level.Nodes["foo"].ShouldBeSameAs(literal);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void IsEmpty_WithAndWithoutChildren_TracksNodeEmptiness()
|
||||
{
|
||||
var node = new SubscriptionIndex.Node();
|
||||
node.IsEmpty().ShouldBeTrue();
|
||||
|
||||
node.Next = new SubscriptionIndex.Level();
|
||||
node.Next.Nodes["bar"] = new SubscriptionIndex.Node();
|
||||
node.IsEmpty().ShouldBeFalse();
|
||||
|
||||
node.Next.Nodes.Clear();
|
||||
node.IsEmpty().ShouldBeTrue();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void NumNodes_WithLiteralAndWildcardEntries_CountsAllBranches()
|
||||
{
|
||||
var level = new SubscriptionIndex.Level();
|
||||
level.Nodes["foo"] = new SubscriptionIndex.Node();
|
||||
level.Pwc = new SubscriptionIndex.Node();
|
||||
level.Fwc = new SubscriptionIndex.Node();
|
||||
|
||||
level.NumNodes().ShouldBe(3);
|
||||
|
||||
level.PruneNode(level.Pwc, SubscriptionIndex.Pwcs);
|
||||
level.PruneNode(level.Fwc, SubscriptionIndex.Fwcs);
|
||||
level.PruneNode(level.Nodes["foo"], "foo");
|
||||
level.NumNodes().ShouldBe(0);
|
||||
}
|
||||
|
||||
[Theory] // T:2983, T:2984
|
||||
[InlineData(true)]
|
||||
[InlineData(false)]
|
||||
|
||||
Reference in New Issue
Block a user