public virtual void TestSimpleIntBlocks() { Directory dir = NewDirectory(); IntStreamFactory f = (new MockFixedIntBlockPostingsFormat(128)).getIntFactory(); IntIndexOutput @out = f.CreateOutput(dir, "test", NewIOContext(Random())); for (int i = 0; i < 11777; i++) { @out.Write(i); } @out.Dispose(); IntIndexInput @in = f.OpenInput(dir, "test", NewIOContext(Random())); IntIndexInputReader r = @in.Reader(); for (int i = 0; i < 11777; i++) { assertEquals(i, r.Next()); } @in.Dispose(); dir.Dispose(); }
public virtual void TestEmptySimpleIntBlocks() { Directory dir = NewDirectory(); IntStreamFactory f = (new MockFixedIntBlockPostingsFormat(128)).getIntFactory(); IntIndexOutput @out = f.CreateOutput(dir, "test", NewIOContext(Random())); // write no ints @out.Dispose(); IntIndexInput @in = f.OpenInput(dir, "test", NewIOContext(Random())); @in.Reader(); // read no ints @in.Dispose(); dir.Dispose(); }