@@ -28,10 +28,6 @@ public class SortedKvStoreTests
2828 /// </summary>
2929 private const int ItemCount = 100_000 ;
3030
31- private SortedKvStore _store ;
32-
33- private int _entryCount ;
34-
3531 /// <summary>
3632 /// Adds the and try get works.
3733 /// </summary>
@@ -477,32 +473,28 @@ public void RemoveAndCompactTest()
477473 Assert . IsTrue ( store . ContainsKey ( 9 ) ) ;
478474 }
479475
480- public void TestCase ( )
476+ /// <summary>
477+ /// Removes the and compact test.
478+ /// </summary>
479+ [ TestMethod ]
480+ public void BinarySearch ( )
481481 {
482- const int size = 1024 ;
483- var count = 10 ;
482+ var store = new SortedKvStore ( 128 ) ;
484483
484+ for ( int i = 0 ; i < 10 ; i ++ )
485+ {
486+ store . Add ( i , i ) ;
487+ }
485488
486- _store = new SortedKvStore ( 128 ) ;
487-
488- for ( var cycle = 0 ; cycle < 5 ; cycle ++ )
489+ for ( int i = 5 ; i < 10 ; i ++ )
489490 {
490- var handles = new List < int > ( count ) ;
491- for ( var i = 0 ; i < count ; i ++ )
492- handles [ i ] = Allocate ( size ) ;
493- for ( var i = 0 ; i < count ; i ++ )
494- Free ( handles [ i ] ) ;
491+ store . Remove ( i ) ;
495492 }
496- }
497493
498- private void Free ( int memoryHandle )
499- {
500- //_store[id] = _entryCount;
501- }
494+ Trace . WriteLine ( store . ToString ( ) ) ;
495+ var position = store . BinarySearch ( 9 ) ;
502496
503- private int Allocate ( int size )
504- {
505- return 1 ;
497+ Assert . AreEqual ( 9 , position , "Wrong position." ) ;
506498 }
507499 }
508500}
0 commit comments