Exemple #1
0
            /// <summary>
            /// Tests an operation
            /// whose data operand is set through a value represented by a <b>null</b> instance.
            /// </summary>
            /// <param name="operation">The operation to test.</param>
            public static void DataIsNull(
                AlongDimensionAdjustableForBiasSummaryOperation <ArgumentNullException> operation)
            {
                var exception = operation.Expected;

                Fail(
                    operators: operation.DataWritableOps,
                    data: null,
                    adjustForBias: operation.AdjustForBias,
                    dataOperation: operation.DataOperation,
                    exception: exception);
                Fail(
                    operators: operation.DataReadOnlyOps,
                    data: null,
                    adjustForBias: operation.AdjustForBias,
                    dataOperation: operation.DataOperation,
                    exception: exception);
            }
Exemple #2
0
            /// <summary>
            /// Determines whether the specified operation fails as expected.
            /// </summary>
            /// <param name="operation">The operation to test.</param>
            public static void Fail <TException>(
                AlongDimensionAdjustableForBiasSummaryOperation <TException> operation)
                where TException : Exception
            {
                var exception = operation.Expected;

                // Dense
                Fail(
                    operators: operation.DataWritableOps,
                    data: operation.Data.AsDense,
                    adjustForBias: operation.AdjustForBias,
                    dataOperation: operation.DataOperation,
                    exception: exception);

                // Sparse
                Fail(
                    operators: operation.DataWritableOps,
                    data: operation.Data.AsSparse,
                    adjustForBias: operation.AdjustForBias,
                    dataOperation: operation.DataOperation,
                    exception: exception);

                // Dense.AsReadOnly()
                Fail(
                    operators: operation.DataReadOnlyOps,
                    data: operation.Data.AsDense.AsReadOnly(),
                    adjustForBias: operation.AdjustForBias,
                    dataOperation: operation.DataOperation,
                    exception: exception);

                // Sparse.AsReadOnly()
                Fail(
                    operators: operation.DataReadOnlyOps,
                    data: operation.Data.AsSparse.AsReadOnly(),
                    adjustForBias: operation.AdjustForBias,
                    dataOperation: operation.DataOperation,
                    exception: exception);
            }
Exemple #3
0
            /// <summary>
            /// Determines whether the specified operation terminates successfully as expected.
            /// </summary>
            /// <param name="operation">The operation.</param>
            public static void Succeed(
                AlongDimensionAdjustableForBiasSummaryOperation <DoubleMatrixState> operation)
            {
                var result = operation.Expected;

                // Dense
                Succeed(
                    operators: operation.DataWritableOps,
                    data: operation.Data.AsDense,
                    adjustForBias: operation.AdjustForBias,
                    dataOperation: operation.DataOperation,
                    expected: result);

                // Sparse
                Succeed(
                    operators: operation.DataWritableOps,
                    data: operation.Data.AsSparse,
                    adjustForBias: operation.AdjustForBias,
                    dataOperation: operation.DataOperation,
                    expected: result);

                // Dense.AsReadOnly()
                Succeed(
                    operators: operation.DataReadOnlyOps,
                    data: operation.Data.AsDense.AsReadOnly(),
                    adjustForBias: operation.AdjustForBias,
                    dataOperation: operation.DataOperation,
                    expected: result);

                // Sparse.AsReadOnly()
                Succeed(
                    operators: operation.DataReadOnlyOps,
                    data: operation.Data.AsSparse.AsReadOnly(),
                    adjustForBias: operation.AdjustForBias,
                    dataOperation: operation.DataOperation,
                    expected: result);
            }