private static IEnumerable <TestCaseData> GetColumnTestCases()
            {
                var matrix = RefMatrix4x4.FromSystem2DArray(
                    new float[, ] {
                    { 1, 2, 3, 4 },
                    { 9, 8, 7, 6 },
                    { 3, 6, 12, 24 },
                    { 5, 25, 125, 625 }
                });

                var firstColumn = new RefColumn <float, RefMatrix4x4>(
                    RefMatrix4x4.FromSystem2DArray(
                        new float[, ] {
                    { 1, 0, 0, 0 },
                    { 9, 0, 0, 0 },
                    { 3, 0, 0, 0 },
                    { 5, 0, 0, 0 }
                }), 0);

                var lastColumn = new RefColumn <float, RefMatrix4x4>(
                    RefMatrix4x4.FromSystem2DArray(
                        new float[, ] {
                    { 4, 0, 0, 0 },
                    { 6, 0, 0, 0 },
                    { 24, 0, 0, 0 },
                    { 625, 0, 0, 0 }
                }), 0);

                yield return(new TestCaseData(matrix, 0, firstColumn));

                yield return(new TestCaseData(matrix, 3, lastColumn));
            }
            private static IEnumerable <TestCaseData> IPredicateIndex2DBounds2DTestCases()
            {
                var matrix = RefMatrix4x4.FromSystem2DArray(
                    new float[, ] {
                    { 1, 2, 3, 4 },
                    { 9, 8, 7, 6 },
                    { 3, 6, 12, 24 },
                    { 5, 25, 125, 625 }
                });

                yield return(new TestCaseData(
                                 matrix,
                                 new Index2D(0, 0),
                                 new Bounds2D(4, 4),
                                 new GreaterThanPredicate <float>(125))
                             .Returns(new ItemRequestResult <Index2D>((3, 3))));

                yield return(new TestCaseData(
                                 matrix,
                                 new Index2D(0, 0),
                                 new Bounds2D(0, 0),
                                 new AlwaysTruePredicate <float>())
                             .Returns(ItemRequestResult <Index2D> .Fail));

                yield return(new TestCaseData(
                                 matrix,
                                 new Index2D(2, 2),
                                 new Bounds2D(2, 2),
                                 new EqualsPredicate <float>(10))
                             .Returns(ItemRequestResult <Index2D> .Fail));
            }
            private static IEnumerable <TestCaseData> PredicateIndex2DBounds2DTestCases()
            {
                var matrix = RefMatrix4x4.FromSystem2DArray(
                    new float[, ] {
                    { 1, 2, 3, 4 },
                    { 9, 8, 7, 6 },
                    { 3, 6, 12, 24 },
                    { 5, 25, 125, 625 }
                });

                yield return(new TestCaseData(
                                 matrix,
                                 new Index2D(3, 3),
                                 new Bounds2D(4, 4),
                                 new Predicate <float>(o => o < 2))
                             .Returns(new ItemRequestResult <Index2D>((0, 0))));

                yield return(new TestCaseData(
                                 matrix,
                                 new Index2D(0, 0),
                                 new Bounds2D(0, 0),
                                 new Predicate <float>(o => true))
                             .Returns(ItemRequestResult <Index2D> .Fail));

                yield return(new TestCaseData(
                                 matrix,
                                 new Index2D(1, 1),
                                 new Bounds2D(2, 2),
                                 new Predicate <float>(o => o == 10))
                             .Returns(ItemRequestResult <Index2D> .Fail));
            }
示例#4
0
            private static IEnumerable <TestCaseData> IPredicateTestCases()
            {
                var matrix = RefMatrix4x4.FromSystem2DArray(
                    new float[, ] {
                    { 1, 2, 3, 4 },
                    { 9, 8, 7, 6 },
                    { 3, 6, 12, 24 },
                    { 5, 25, 125, 625 }
                });

                yield return(new TestCaseData(matrix, new GreaterThanPredicate <float>(125))
                             .Returns(true));

                yield return(new TestCaseData(matrix, new EqualsPredicate <float>(10))
                             .Returns(false));
            }
示例#5
0
            private static IEnumerable <TestCaseData> LastTestCases()
            {
                var matrix = RefMatrix4x4.FromSystem2DArray(
                    new float[, ] {
                    { 1, 2, 3, 4 },
                    { 9, 8, 7, 6 },
                    { 3, 6, 12, 24 },
                    { 5, 25, 125, 625 }
                });

                yield return(new TestCaseData(matrix, new Predicate <float>(o => o < 2))
                             .Returns(new ItemRequestResult <float>(1)));

                yield return(new TestCaseData(matrix, new Predicate <float>(o => o == 10))
                             .Returns(ItemRequestResult <float> .Fail));
            }
            private static IEnumerable <TestCaseData> IPredicateTestCases()
            {
                var matrix = RefMatrix4x4.FromSystem2DArray(
                    new float[, ] {
                    { 1, 2, 3, 4 },
                    { 9, 8, 7, 6 },
                    { 3, 6, 12, 24 },
                    { 5, 25, 125, 625 }
                });

                yield return(new TestCaseData(matrix, new LessThanPredicate <float>(2))
                             .Returns(new ItemRequestResult <Index2D>((0, 0))));

                yield return(new TestCaseData(matrix, new EqualsPredicate <float>(10))
                             .Returns(ItemRequestResult <Index2D> .Fail));
            }
示例#7
0
            private static IEnumerable <TestCaseData> IndicesTestCases()
            {
                var matrix = RefMatrix4x4.FromSystem2DArray(
                    new float[, ] {
                    { 1, 2, 3, 4 },
                    { 9, 8, 7, 6 },
                    { 3, 6, 12, 24 },
                    { 5, 25, 125, 625 }
                });

                yield return(new TestCaseData(
                                 matrix,
                                 new Predicate <float>(o => o > 20),
                                 new List <Index2D>()
                {
                    (2, 3), (3, 1), (3, 2), (3, 3)
                }));
示例#8
0
            private static IEnumerable <TestCaseData> ItemsTestCases()
            {
                var matrix = RefMatrix4x4.FromSystem2DArray(
                    new float[, ] {
                    { 1, 2, 3, 4 },
                    { 9, 8, 7, 6 },
                    { 3, 6, 12, 24 },
                    { 5, 25, 125, 625 }
                });

                yield return(new TestCaseData(
                                 matrix,
                                 new Predicate <float>(o => o > 20),
                                 new List <float>()
                {
                    24, 25, 125, 625
                }));

                yield return(new TestCaseData(
                                 matrix, new Predicate <float>(o => o == 10), new List <float>()));
            }