//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldReInitializeTreeLogicWithSameSplitRatioAsInitiallySet0() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void ShouldReInitializeTreeLogicWithSameSplitRatioAsInitiallySet0() { TreeHeightTracker treeHeightTracker = new TreeHeightTracker(this); try (GBPTree <MutableLong, MutableLong> gbpTree = new GBPTreeBuilder <>(_pageCache, Directory.file("index"), _layout) .with(treeHeightTracker).build(); Writer <MutableLong, MutableLong> writer = gbpTree.writer(0)) { MutableLong dontCare = _layout.value(0); long keySeed = 10_000; while (treeHeightTracker.TreeHeight < 5) { MutableLong key = _layout.key(keySeed--); writer.Put(key, dontCare); } // We now have a tree with height 6. // The leftmost node on all levels should have only a single key. KeyCountingVisitor keyCountingVisitor = new KeyCountingVisitor(this); gbpTree.visit(keyCountingVisitor); foreach (int?leftmostKeyCount in keyCountingVisitor.KeyCountOnLeftmostPerLevel) { assertEquals(1, leftmostKeyCount.Value); } } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldReInitializeTreeLogicWithSameSplitRatioAsInitiallySet1() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void ShouldReInitializeTreeLogicWithSameSplitRatioAsInitiallySet1() { TreeHeightTracker treeHeightTracker = new TreeHeightTracker(this); try (GBPTree <MutableLong, MutableLong> gbpTree = new GBPTreeBuilder <>(_pageCache, Directory.file("index"), _layout) .with(treeHeightTracker).build(); Writer <MutableLong, MutableLong> writer = gbpTree.writer(1)) { MutableLong dontCare = _layout.value(0); long keySeed = 0; while (treeHeightTracker.TreeHeight < 5) { MutableLong key = _layout.key(keySeed++); writer.Put(key, dontCare); } // We now have a tree with height 6. // The rightmost node on all levels should have either one or zero key (zero for internal nodes). KeyCountingVisitor keyCountingVisitor = new KeyCountingVisitor(this); gbpTree.visit(keyCountingVisitor); foreach (int?rightmostKeyCount in keyCountingVisitor.KeyCountOnRightmostPerLevel) { assertTrue(rightmostKeyCount == 0 || rightmostKeyCount == 1); } } }