Beispiel #1
0
 public void BenchSmallAppend()
 {
     var s1 = new Slice<int>(5);
     var s2 = new Slice<int>(5);
     for (int i = 0; i < 20; i++)
     {
         s1 = s1.Append(s2);
     }
 }
Beispiel #2
0
 public void BenchHugeAppend()
 {
     var s1 = new Slice<int>(66560);
     var s2 = new Slice<int>(66560);
     for (int i = 0; i < 20; i++)
     {
         s1 = s1.Append(s2);
     }
 }
Beispiel #3
0
 public void BenchLargeAppend()
 {
     var s1 = new Slice<int>(1024);
     var s2 = new Slice<int>(1024);
     for (int i = 0; i < 20; i++)
     {
         s1 = s1.Append(s2);
     }
 }
Beispiel #4
0
        public void TestAppend()
        {
            var fives = Five().Append(Five());
            var res1 = Slice.Make(0, 1, 2, 3, 4, 0, 1, 2, 3, 4);
            Assert.AreEqual(fives, res1);

            var seven = Five().Append(5, 6);
            var res2 = Slice.Make(0, 1, 2, 3, 4, 5, 6);
            Assert.AreEqual(seven, res2);

            var s = new Slice<int>(5, 10);
            Assert.IsTrue(s.Count == 5);
            Assert.IsTrue(s.Capacity == 10);
            for (int k = 0; k < s.Count; k++)
            {
                s[k] = k;
            }
            s = s.Append(Five());
            var res3 = Slice.Make(0, 1, 2, 3, 4, 0, 1, 2, 3, 4);
            Assert.AreEqual(s, res3);
            Assert.IsTrue(s.Count == 10);
        }