Пример #1
0
        static void CheckEqualsTrue(ArrayEqualsBenchmark arrayEquals)
        {
            Assert.IsTrue(arrayEquals.Naive());
            Assert.IsTrue(arrayEquals.LINQ());
            Assert.IsTrue(arrayEquals.Vectors());
            Assert.IsTrue(arrayEquals.MemCmp());
#if NETCOREAPP3_0
            Assert.IsTrue(arrayEquals.Intrinsics());
#endif
        }
Пример #2
0
        static void TestHelper(int itemsCount)
        {
            var arrayEquals = new ArrayEqualsBenchmark();

            arrayEquals.ItemsCount = itemsCount;
            arrayEquals.GlobalSetup();
            CheckEqualsTrue(arrayEquals);
            arrayEquals.ArrayA[0] = 1;
            CheckEqualsFalse(arrayEquals);
            arrayEquals.ArrayA[0] = 0;
            arrayEquals.ArrayB[itemsCount - 1] = 1;
            CheckEqualsFalse(arrayEquals);
        }
Пример #3
0
        public void Test99999()
        {
            var arrayEquals = new ArrayEqualsBenchmark();

            arrayEquals.ItemsCount = 99999;
            arrayEquals.GlobalSetup();
            CheckEqualsTrue(arrayEquals);
            for (int i = 0; i < 31; i++)
            {
                int index0 = 99999 - 1 - i;
                arrayEquals.ArrayA[index0] = 1;
                CheckEqualsFalse(arrayEquals);
                arrayEquals.ArrayB[index0] = 1;
                CheckEqualsTrue(arrayEquals);
            }
        }