/// <summary> /// Executes the tests. /// </summary> public static void Test() { TagsTableCollectionIndex index = new TagsTableCollectionIndex(); // first fill the index. ITagCollectionIndexTests.FillIndex(index, 100000); // serialize the index. FileInfo testFile = new FileInfo(@"test.file"); testFile.Delete(); Stream writeStream = testFile.OpenWrite(); OsmSharp.Logging.Log.TraceEvent("Blocked", OsmSharp.Logging.TraceEventType.Information, "Serializing blocked file...."); TagIndexSerializer.SerializeBlocks(writeStream, index, 100); writeStream.Flush(); writeStream.Dispose(); OsmSharp.Logging.Log.TraceEvent("Blocked", OsmSharp.Logging.TraceEventType.Information, string.Format("Serialized file: {0}KB", testFile.Length / 1024)); // deserialize the index. Stream readStream = testFile.OpenRead(); ITagsCollectionIndexReadonly readOnlyIndex = TagIndexSerializer.DeserializeBlocks(readStream); // test access. OsmSharp.Logging.Log.TraceEvent("Blocked", OsmSharp.Logging.TraceEventType.Information, "Started testing random access...."); ITagCollectionIndexTests.TestRandomAccess("Blocked", readOnlyIndex, 1000); readStream.Dispose(); testFile.Delete(); }
/// <summary> /// Executes the tests. /// </summary> public static void Test(string name, ITagsCollectionIndex index, int addCount, int accessCount) { // tests adding tag collection to the given index. ITagCollectionIndexTests.TestAdd(name, new TagsTableCollectionIndex(), addCount); // tests random access. ITagCollectionIndexTests.TestRandomAccess(name, index, accessCount); }