Ejemplo n.º 1
0
        public static IEnumerable <object[]> Float_TestData()
        {
            yield return(new object[] { new float[] { float.MaxValue }, float.MaxValue });

            yield return(new object[] { new float[] { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f }, 0f });

            yield return(new object[] { new float[] { 5.5f, -10f, 15.5f, 40.5f, 28.5f }, 16f });

            for (int i = 1; i <= 33; i++)
            {
                int sum = 0;
                for (int c = 1; c <= i; c++)
                {
                    sum += c;
                }
                float expected = (float)sum / i;

                yield return(new object[] { Shuffler.Shuffle(Enumerable.Range(1, i).Select(i => (float)i)), expected });

                yield return(new object[] { Shuffler.Shuffle(Enumerable.Range(1, i).Select(i => (float)i).ToArray()), expected });
            }
        }
Ejemplo n.º 2
0
        public static IEnumerable <object[]> Decimal_TestData()
        {
            yield return(new object[] { new decimal[] { decimal.MaxValue }, decimal.MaxValue });

            yield return(new object[] { new decimal[] { 0.0m, 0.0m, 0.0m, 0.0m, 0.0m }, 0 });

            yield return(new object[] { new decimal[] { 5.5m, -10m, 15.5m, 40.5m, 28.5m }, 16 });

            for (int i = 1; i <= 33; i++)
            {
                int sum = 0;
                for (int c = 1; c <= i; c++)
                {
                    sum += c;
                }
                decimal expected = (decimal)sum / i;

                yield return(new object[] { Shuffler.Shuffle(Enumerable.Range(1, i).Select(i => (decimal)i)), expected });

                yield return(new object[] { Shuffler.Shuffle(Enumerable.Range(1, i).Select(i => (decimal)i).ToArray()), expected });
            }
        }
Ejemplo n.º 3
0
        public static IEnumerable <object[]> Long_TestData()
        {
            yield return(new object[] { new long[] { long.MaxValue }, long.MaxValue });

            yield return(new object[] { new long[] { 0, 0, 0, 0, 0 }, 0 });

            yield return(new object[] { new long[] { 5, -10, 15, 40, 28 }, 15.6 });

            for (int i = 1; i <= 33; i++)
            {
                int sum = 0;
                for (int c = 1; c <= i; c++)
                {
                    sum += c;
                }
                double expected = (double)sum / i;

                yield return(new object[] { Shuffler.Shuffle(Enumerable.Range(1, i).Select(i => (long)i)), expected });

                yield return(new object[] { Shuffler.Shuffle(Enumerable.Range(1, i).Select(i => (long)i).ToArray()), expected });
            }
        }
Ejemplo n.º 4
0
        public static IEnumerable <object[]> Int_TestData()
        {
            yield return(new object[] { new int[] { 5 }, 5 });

            yield return(new object[] { new int[] { 0, 0, 0, 0, 0 }, 0 });

            yield return(new object[] { new int[] { 5, -10, 15, 40, 28 }, 15.6 });

            for (int i = 1; i <= 33; i++)
            {
                int sum = 0;
                for (int c = 1; c <= i; c++)
                {
                    sum += c;
                }
                double expected = (double)sum / i;

                yield return(new object[] { Shuffler.Shuffle(Enumerable.Range(1, i)), expected });

                yield return(new object[] { Shuffler.Shuffle(Enumerable.Range(1, i).ToArray()), expected });
            }
        }
Ejemplo n.º 5
0
        public static IEnumerable <object[]> Double_TestData()
        {
            yield return(new object[] { new double[] { double.MaxValue }, double.MaxValue });

            yield return(new object[] { new double[] { 0.0, 0.0, 0.0, 0.0, 0.0 }, 0 });

            yield return(new object[] { new double[] { 5.5, -10, 15.5, 40.5, 28.5 }, 16 });

            yield return(new object[] { new double[] { 5.58, double.NaN, 30, 4.55, 19.38 }, double.NaN });

            for (int i = 1; i <= 33; i++)
            {
                int sum = 0;
                for (int c = 1; c <= i; c++)
                {
                    sum += c;
                }
                double expected = (double)sum / i;

                yield return(new object[] { Shuffler.Shuffle(Enumerable.Range(1, i).Select(i => (double)i)), expected });

                yield return(new object[] { Shuffler.Shuffle(Enumerable.Range(1, i).Select(i => (double)i).ToArray()), expected });
            }
        }