/// <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();
        }
Пример #2
0
        /// <summary>
        /// Executes a test adding tags from a PBF file.
        /// </summary>
        /// <param name="name"></param>
        /// <param name="index"></param>
        /// <param name="pbfFile"></param>
        public static void Test(string name, ITagsCollectionIndex index, string pbfFile)
        {
            FileInfo           testFile = new FileInfo(string.Format(@".\TestFiles\{0}", pbfFile));
            Stream             stream   = testFile.OpenRead();
            PBFOsmStreamSource source   = new PBFOsmStreamSource(stream);

            ITagCollectionIndexTests.TestAdd(name, index, source);
        }
Пример #3
0
        /// <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);
        }
        /// <summary>
        /// Executes the tests.
        /// </summary>
        public static void Test()
        {
            TagsTableCollectionIndex index = new TagsTableCollectionIndex();

            // execute the standard tests on this index.
            ITagCollectionIndexTests.Test("Table", index, 100000, 10000000);

            // start over.
            index = new TagsTableCollectionIndex();

            // execute the standard tests on this index.
            ITagCollectionIndexTests.Test("Table", index, "kempen-big.osm.pbf");
        }
Пример #5
0
        /// <summary>
        /// Tests adding simple tags to the given index.
        /// </summary>
        /// <param name="name"></param>
        /// <param name="index"></param>
        /// <param name="collectionCount"></param>
        public static void TestAdd(string name, ITagsCollectionIndex index,
                                   int collectionCount)
        {
            PerformanceInfoConsumer performanceInfo = new PerformanceInfoConsumer(string.Format("{0}.Add", name));

            performanceInfo.Start();
            performanceInfo.Report("Adding {0} tag collections...", collectionCount);

            ITagCollectionIndexTests.FillIndex(index, collectionCount);

            performanceInfo.Stop();

            Console.Write("", index.Max);
        }
Пример #6
0
        /// <summary>
        /// Tests adding simple tags to the given index.
        /// </summary>
        /// <param name="name"></param>
        /// <param name="index"></param>
        /// <param name="source"></param>
        public static void TestAdd(string name, ITagsCollectionIndex index,
                                   OsmStreamSource source)
        {
            PerformanceInfoConsumer performanceInfo = new PerformanceInfoConsumer(string.Format("{0}.Add", name));

            performanceInfo.Start();
            performanceInfo.Report("Adding tags from {0}...", source.ToString());

            ITagCollectionIndexTests.FillIndex(index, source);

            performanceInfo.Stop();

            Console.Write("", index.Max);
        }