Example #1
0
        public static ulong GenerateDataFile(string fileName, int max)
        {
            if (File.Exists(fileName))
            {
                File.Delete(fileName);
            }

            var text = GenerateData(max);

            File.WriteAllText(fileName, text);
            return(DigitsSummer.SumV4(text));
        }
Example #2
0
        public static void SumVx_Tests(string data, ulong expected)
        {
            Assert.AreEqual(expected, DigitsSummer.Sum(data));
            Assert.AreEqual(expected, DigitsSummer.SumHash(data));
            Assert.AreEqual(expected, DigitsSummer.SumLinq(data));
            Assert.AreEqual(expected, DigitsSummer.SumPLinq(data));

            Assert.AreEqual(expected, DigitsSummer.SumV2(data));
            Assert.AreEqual(expected, DigitsSummer.SumV3(data));
            Assert.AreEqual(expected, DigitsSummer.SumV3_5(data));
            Assert.AreEqual(expected, DigitsSummer.SumV4(data));
            Assert.AreEqual(expected, DigitsSummer.SumVx(data));
            Assert.AreEqual(expected, DigitsSummer.SumVx2(data));
            Assert.AreEqual(expected, DigitsSummer.SumVx22(data));
            Assert.AreEqual(expected, DigitsSummer.SumVx23(data));
            Assert.AreEqual(expected, DigitsSummer.SumVx24(data));
        }