예제 #1
0
        public void TestMultiplyKaratsubaV2Null()
        {
            int[] v1     = { 1, 2, 3, 4 };
            int[] v2     = null;
            int[] ex     = {};
            var   actual = BigNumberHelper.MultiplyKaratsuba(v1, v2);

            CollectionAssert.AreEqual(ex, actual);
        }
예제 #2
0
        public void TestMultiplyKaratsuba2()
        {
            int[] v1     = BigNumberHelper.GetArrayFromString("123456789");
            int[] v2     = BigNumberHelper.GetArrayFromString("8888");
            int[] ex     = BigNumberHelper.GetArrayFromString("1097283940632");
            var   actual = BigNumberHelper.MultiplyKaratsuba(v1, v2);

            CollectionAssert.AreEqual(ex, actual);
        }
예제 #3
0
        public void TestMultiplyKaratsuba3()
        {
            int[] v1     = BigNumberHelper.GetArrayFromString("1234567891011121314151617181920");
            int[] v2     = BigNumberHelper.GetArrayFromString("2019181716151413121110987654321");
            int[] ex     = BigNumberHelper.GetArrayFromString("2492816912877266687794240983772975935013386905490061131076320");
            var   actual = BigNumberHelper.MultiplyKaratsuba(v1, v2);

            CollectionAssert.AreEqual(ex, actual);
        }
예제 #4
0
        public void TestMultiplyKaratsuba1()
        {
            int[] v1     = BigNumberHelper.GetArrayFromString("1234");
            int[] v2     = BigNumberHelper.GetArrayFromString("5678");
            int[] ex     = BigNumberHelper.GetArrayFromString("7006652");
            var   actual = BigNumberHelper.MultiplyKaratsuba(v1, v2);

            CollectionAssert.AreEqual(ex, actual);
        }