Beispiel #1
0
        public void MultiplyIntegerTest()
        {
            Func <int[], int[], int[]>[] functions = new Func <int[], int[], int[]>[]
            {
                MultiplyInteger.Convert,
                MultiplyInteger.ToArray
            };

            for (int x = -20; x <= 20; x++)
            {
                for (int y = -20; y <= 20; y++)
                {
                    int[][] results = new int[functions.Length][];

                    for (int k = 0; k < functions.Length; k++)
                    {
                        results[k] = functions[k](MultiplyInteger.ToArray(x), MultiplyInteger.ToArray(y));
                        Assert.IsTrue(ArrayUtilities.AreEqual(results[0], results[k]));
                    }
                }
            }
        }
Beispiel #2
0
 private static int[] Convert(int[] x, int[] y)
 {
     return(MultiplyInteger.ToArray(MultiplyInteger.ToInt(x) * MultiplyInteger.ToInt(y)));
 }