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(TestableComplexMatrixOperation <ComplexMatrixState> operation)
        {
            var result = operation.Expected;

            // (Dense)
            Succeed(
                operators: operation.OperandWritableOps,
                operand: operation.Operand.AsDense,
                expected: result);

            // (Sparse)
            Succeed(
                operators: operation.OperandWritableOps,
                operand: operation.Operand.AsSparse,
                expected: result);

            // (Dense.AsReadOnly())
            Succeed(
                operators: operation.OperandReadOnlyOps,
                operand: operation.Operand.AsDense.AsReadOnly(),
                expected: result);

            // (Sparse.AsReadOnly())
            Succeed(
                operators: operation.OperandReadOnlyOps,
                operand: operation.Operand.AsSparse.AsReadOnly(),
                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>(TestableComplexMatrixOperation <TException> operation)
            where TException : Exception
        {
            var exception = operation.Expected;

            // (Dense)
            Fail(
                operators: operation.OperandWritableOps,
                operand: operation.Operand.AsDense,
                exception: exception);

            // (Sparse)
            Fail(
                operators: operation.OperandWritableOps,
                operand: operation.Operand.AsSparse,
                exception: exception);

            // (Dense.AsReadOnly())
            Fail(
                operators: operation.OperandReadOnlyOps,
                operand: operation.Operand.AsDense.AsReadOnly(),
                exception: exception);

            // (Sparse.AsReadOnly())
            Fail(
                operators: operation.OperandReadOnlyOps,
                operand: operation.Operand.AsSparse.AsReadOnly(),
                exception: exception);
        }
Esempio n. 3
0
        /// <summary>
        /// Tests an operation
        /// whose 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 OperandIsNull(TestableComplexMatrixOperation <ArgumentNullException> operation)
        {
            var exception = operation.Expected;

            // Dense
            Fail(
                operators: operation.OperandWritableOps,
                operand: null,
                exception: exception);
            Fail(
                operators: operation.OperandReadOnlyOps,
                operand: null,
                exception: exception);
        }