Exemplo n.º 1
0
        public void BenchmarkOld2(int pointCount)
        {
            SortedPointBuffer <HistorianKey, HistorianValue> points = new SortedPointBuffer <HistorianKey, HistorianValue>(pointCount, true);

            HistorianKey   key   = new HistorianKey();
            HistorianValue value = new HistorianValue();

            for (int x = 0; x < pointCount; x++)
            {
                key.PointID = (ulong)x;
                points.TryEnqueue(key, value);
            }

            points.IsReadingMode = true;

            Stopwatch sw = new Stopwatch();

            sw.Start();
            using (BinaryStream bs = new BinaryStream(true))
            {
                SortedTree <HistorianKey, HistorianValue> st = SortedTree <HistorianKey, HistorianValue> .Create(bs, 4096, HistorianFileEncodingDefinition.TypeGuid);

                st.AddRange(points);

                //SequentialSortedTreeWriter<HistorianKey, HistorianValue>.Create(bs, 4096, SortedTree.FixedSizeNode, points);
            }
            sw.Stop();

            System.Console.WriteLine("Points {0}: {1}MPPS", pointCount, (pointCount / sw.Elapsed.TotalSeconds / 1000000).ToString("0.0"));
        }
Exemplo n.º 2
0
        public void AddRage_MultipleElements_ShouldSortWhenTravers()
        {
            var st = new SortedTree<int>();
            st.AddRange(new List<int> { 3, 23, 52, 1, 44, 11, 9 });

            CollectionAssert.AreEqual(new List<int> { 1,3,9,11,23,44,52 }, st.Traverse());
        }
Exemplo n.º 3
0
        public void AddRange_TwoSameElements_ShouldThrowArgumentException()
        {
            var st = new SortedTree<int>();

            Assert.Throws<ArgumentException>(() => st.AddRange(new List<int> { 3, 23, 3, }));
        }
Exemplo n.º 4
0
 public void AddRange_NullPassedAsElements_ShouldThrowArgumentException()
 {
     var st = new SortedTree<int>();
     Assert.Throws<ArgumentException>(() => st.AddRange(null));
 }
Exemplo n.º 5
0
 public void AddRange_NullPassedAsElementsAlternativeTraverse_ShouldThrowArgumentException()
 {
     var st = new SortedTree<int>(true);
     Assert.Throws<ArgumentException>(() => st.AddRange(null));
 }