public virtual void TestRandom()
{
int iters = 5;
for (int iter = 0; iter < iters; iter++)
{
DirectoryInfo path = CreateTempDir("testPostingsFormat");
Directory dir = NewFSDirectory(path);
bool indexPayloads = Random().NextBoolean();
// TODO test thread safety of buildIndex too
FieldsProducer fieldsProducer = BuildIndex(dir, FieldInfo.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS, indexPayloads, false);
TestFields(fieldsProducer);
// NOTE: you can also test "weaker" index options than
// you indexed with:
TestTerms(fieldsProducer, new HashSet<Option>(Enum.GetValues(typeof(Option)).Cast<Option>()), FieldInfo.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS, FieldInfo.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS, false);
fieldsProducer.Dispose();
fieldsProducer = null;
dir.Dispose();
System.IO.Directory.Delete(path.FullName, true);
}
}