Esempio n. 1
0
            /// <summary>
            /// Determines whether the specified operation terminates successfully as expected.
            /// </summary>
            /// <param name="operation">The operation.</param>
            public static void Succeed(
                AlongDimensionNotAdjustableForBiasSummaryOperation <DoubleMatrixState> operation)
            {
                var result = operation.Expected;

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

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

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

                // Sparse.AsReadOnly()
                Succeed(
                    operators: operation.DataReadOnlyOps,
                    data: operation.Data.AsSparse.AsReadOnly(),
                    dataOperation: operation.DataOperation,
                    expected: result);
            }
Esempio n. 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>(
                AlongDimensionNotAdjustableForBiasSummaryOperation <TException> operation)
                where TException : Exception
            {
                var exception = operation.Expected;

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

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

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

                // Sparse.AsReadOnly()
                Fail(
                    operators: operation.DataReadOnlyOps,
                    data: operation.Data.AsSparse.AsReadOnly(),
                    dataOperation: operation.DataOperation,
                    exception: exception);
            }
Esempio n. 3
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(
                AlongDimensionNotAdjustableForBiasSummaryOperation <ArgumentNullException> operation)
            {
                var exception = operation.Expected;

                Fail(
                    operators: operation.DataWritableOps,
                    data: null,
                    dataOperation: DataOperation.OnRows,
                    exception: exception);
                Fail(
                    operators: operation.DataReadOnlyOps,
                    data: null,
                    dataOperation: DataOperation.OnRows,
                    exception: exception);
            }