Beispiel #1
0
        public void CanWriteAndRestoreFromBinary()
        {
            var index = new BTreeIndex <string, bool, bool>(10);

            foreach (var s in strings)
            {
                index.EnsureValue(s);
            }
            using (var stream = new MemoryStream()){
                using (var sw = new BinaryWriter(stream, Encoding.UTF8, true)){
                    index.Write(sw);
                    sw.Flush();
                }
                index           = new BTreeIndex <string, bool, bool>(10);
                stream.Position = 0;
                using (var sr = new BinaryReader(stream, Encoding.UTF8, true))
                {
                    index.Read(sr);
                }
            };


            foreach (var s in strings)
            {
                Assert.NotNull(index.Find(s));
            }
        }
Beispiel #2
0
        public void CanStore()
        {
            var index = new BTreeIndex <string, bool, bool>(10);

            foreach (var s in strings)
            {
                index.EnsureValue(s);
            }
            Console.WriteLine(index.PlainIndex.Count);
        }
Beispiel #3
0
        public void CanRead()
        {
            var index = new BTreeIndex <string, bool, bool>(10);

            foreach (var s in strings)
            {
                index.EnsureValue(s);
            }
            foreach (var s in strings)
            {
                Assert.NotNull(index.Find(s));
            }
        }