Пример #1
0
        public virtual void TestSimpleIntBlocks()
        {
            Directory dir = NewDirectory();

            Int32StreamFactory f = (new MockFixedInt32BlockPostingsFormat(128)).GetInt32Factory();

            Int32IndexOutput @out = f.CreateOutput(dir, "test", NewIOContext(Random));

            for (int i = 0; i < 11777; i++)
            {
                @out.Write(i);
            }
            @out.Dispose();

            Int32IndexInput @in = f.OpenInput(dir, "test", NewIOContext(Random));

            Int32IndexInput.Reader r = @in.GetReader();

            for (int i = 0; i < 11777; i++)
            {
                assertEquals(i, r.Next());
            }
            @in.Dispose();

            dir.Dispose();
        }
Пример #2
0
        public virtual void TestEmptySimpleIntBlocks()
        {
            Directory dir = NewDirectory();

            Int32StreamFactory f    = (new MockFixedInt32BlockPostingsFormat(128)).GetInt32Factory();
            Int32IndexOutput   @out = f.CreateOutput(dir, "test", NewIOContext(Random));

            // write no ints
            @out.Dispose();

            Int32IndexInput @in = f.OpenInput(dir, "test", NewIOContext(Random));

            @in.GetReader();
            // read no ints
            @in.Dispose();
            dir.Dispose();
        }