Exemplo n.º 1
0
 static Matrix2Facts() {
     _identity = new Matrix2(
         1, 0,
         0, 1);
     _incremented = new Matrix2(
         0, 1,
         2, 3);
     _determinant34 = new Matrix2(
         3, -8,
         5, -2);
     _priorInvert = new Matrix2(
         1, 3,
         2, 4);
     _postInvert = new Matrix2(
         -2, 1.5,
         1, -0.5);
     _trans = new Matrix2(
         0, 2,
         1, 3);
     _a = new Matrix2(
         3, 1,
         -10, -2);
     _b = new Matrix2(
         2, 3,
         -4, 5);
     _product = new Matrix2(
         2, 14,
         -12, -40);
     _sum = new Matrix2(
         5, 4,
         -14, 3);
 }
Exemplo n.º 2
0
        public void RunTests()
        {
            Matrix2 a, b;
            DXMtx dxa, dxb;

            a = new Matrix2(1, 2, 2, 1);
            b = new Matrix2(3, 1, 4, 2);
            dxa = new DXMtx();
            dxb = new DXMtx();
            dxa.M11 = 1;
            dxa.M12 = 2;
            dxa.M21 = 2;
            dxa.M22 = 1;
            dxa.M33 = 1;
            dxa.M44 = 1;
            dxb.M11 = 3;
            dxb.M12 = 1;
            dxb.M21 = 4;
            dxb.M22 = 2;
            RotationAngle = (float)(30 * Math.PI / 180);

            TestAdd(a, b, dxa, dxb);
            TestSub(a, b, dxa, dxb);
            TestMul(a, b, dxa, dxb);
            TestTranspose(a, dxa);
            TestInvert(a, dxa);
            TestRotation();

            PrintResults(a, b);
        }
Exemplo n.º 3
0
        public static void set_identity() {
            var m = new Matrix2(_incremented);

            m.SetIdentity();

            m.Should().Be(_identity);
        }
Exemplo n.º 4
0
        public static void elements_set_batch() {
            var m = new Matrix2();

            m.SetElements(0, 1, 2, 3);

            m.Should().Be(_incremented);
        }
Exemplo n.º 5
0
        public void Construct1()
        {
            Matrix2<double> m = new Matrix2<double>(1.0);

            for (int i = 0; i < m.NumberOfComponents; ++i)
            {
                Assert.AreEqual(1.0, m.ReadOnlyColumnMajorValues[0], 1e-14);
            }
        }
Exemplo n.º 6
0
 public void PrintResults(Matrix2 a, Matrix2 b)
 {
     Console.WriteLine("Matrix 2 Tests:");
     Console.WriteLine("A: {0}\nB: {1}", a, b);
     Console.WriteLine("A + B: {0} ({1}) -- {2}", AdditionResults[0], AdditionResults[1], Passed(AdditionResults[0] == AdditionResults[1]));
     Console.WriteLine("A - B: {0} ({1}) -- {2}", SubtractionResults[0], SubtractionResults[1], Passed(SubtractionResults[0] == SubtractionResults[1]));
     Console.WriteLine("A * B: {0} ({1}) -- {2}", MultiplyResults[0], MultiplyResults[1], Passed(MultiplyResults[0] == MultiplyResults[1]));
     Console.WriteLine("A^T: {0} ({1}) -- {2}", TransposeResults[0], TransposeResults[1], Passed(TransposeResults[0] == TransposeResults[1]));
     Console.WriteLine("A^-1: {0} ({1}) -- {2}", InverseResults[0], InverseResults[1], Passed(InverseResults[0] == InverseResults[1]));
     Console.WriteLine("Rotation: {0} ({1}) -- {2}", RotationResults[0], RotationResults[1], Passed(RotationResults[0] == RotationResults[1]));
 }
Exemplo n.º 7
0
        public static void TransformPoints(ref Matrix2 matrix, IList <IPointShape> points)
        {
            if (points == null || points.Count == 0)
            {
                return;
            }

            for (int i = 0; i < points.Count; i++)
            {
                TransformPoint(ref matrix, points[i]);
            }
        }
Exemplo n.º 8
0
        public void MatrixSetMatrix()
        {
            Vector2 v1 = new Vector2(4, 5);
            Vector2 v2 = new Vector2(6, 7);

            Matrix2 matrix = new Matrix2(new double[] { 0, 1, 2, 3 });

            matrix.SetMatrix(v1, v2);

            Assert.AreEqual(matrix[0], v1);
            Assert.AreEqual(matrix[1], v2);
        }
Exemplo n.º 9
0
        public void NegateMatrix2(float m11, float m12,
                                  float m21, float m22)
        {
            var matrix = new Matrix2(m11, m12,
                                     m21, m22);
            var result   = matrix.Negate().Matrix;
            var expected = new[, ] {
                { -m11, -m12 }, { -m21, -m22 }
            };;

            Assert.Equal(expected, result);
        }
Exemplo n.º 10
0
        public void CreateWithFourValues(
            float m11, float m12,
            float m21, float m22)
        {
            var result = new Matrix2(m11, m12,
                                     m21, m22).Matrix;
            var expected = new[, ] {
                { m11, m12 }, { m21, m22 }
            };

            Assert.Equal(expected, result);
        }
Exemplo n.º 11
0
        public void TransposeMatrix2(float m11, float m12,
                                     float m21, float m22)
        {
            var matrix = new Matrix2(m11, m12,
                                     m21, m22);
            var result   = matrix.Transpose().Matrix;
            var expected = new[, ] {
                { m11, m21 }, { m12, m22 }
            };;

            Assert.Equal(expected, result);
        }
Exemplo n.º 12
0
        public bool ContainsRotated(Vector2 pt, Vector2 rotationCenter, float angle)
        {
            if (angle == 0)
            {
                return(Contains(pt));
            }

            Matrix2 rotationMatrix = Matrix2.CreateRotation(-angle);
            Vector2 rotatedPt      = (pt - rotationCenter) * rotationMatrix + rotationCenter;

            return(Contains(rotatedPt.X, rotatedPt.Y));
        }
Exemplo n.º 13
0
 public void SetVariable(string name, Matrix2 matrix)
 {
     if (ProgramId > 0)
     {
         GLStates.UseProgram(ProgramId);
         int location = GetUniformLocation(name);
         if (location != -1)
         {
             GL.UniformMatrix2(location, false, ref matrix);
         }
     }
 }
        public void TransposeStatic_ByRef()
        {
            var input     = GetTestMatrix();
            var inputSimd = (MatrixFloat2x2)input;

            Matrix2        expected;
            MatrixFloat2x2 actual;

            Matrix2.Transpose(ref input, out expected);
            MatrixFloat2x2.Transpose(ref inputSimd, out actual);
            Asserts.AreEqual(expected, actual, "transpose out/ref");
        }
Exemplo n.º 15
0
        public bool OnScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY)
        {
            //Debug.WriteLine("Control_ManipulationDelta");

            // UWP delta とは逆値
            Element.ViewPoint = Element.ViewPoint.Offset(distanceX / Element.ViewScale, distanceY / Element.ViewScale);

            DrawImage = Element.DrawImmageRequest(Element.ViewPoint, Matrix2.Enlargement(ViewSize, 1 / Element.ViewScale, 1 / Element.ViewScale));

            Invalidate();
            return(true);
        }
        public void IdentityMultMatrix2()
        {
            Matrix2 m1 = new Matrix2(1, 7,
                                     2, -4);
            Matrix2 identityM = new Matrix2();

            Matrix2 result = m1 * identityM;
            Matrix2 answer = new Matrix2(1, 7,
                                         2, -4);

            Assert.True(answer == result);
        }
Exemplo n.º 17
0
 /// <summary>
 /// Transforms a point from the agent's local space into world space.
 /// </summary>
 public static Vector2 PointToWorldSpace(
     Vector2 point,
     Vector2 agentHeading,
     Vector2 agentSide,
     Vector2 agentPosition)
 {
     Vector2 transformPoint = new Vector2(point);
     Matrix2 matrix = new Matrix2();
     matrix.Rotate(agentHeading, agentSide);
     matrix.Translate(agentPosition.X, agentPosition.Y);
     Vector2 result = matrix.Transform(transformPoint);
     return result;
 }
Exemplo n.º 18
0
        public void SubtractTwoMatrices(float m11, float m12, float m21, float m22)
        {
            var matrix1 = new Matrix2(m11, m12,
                                      m21, m22);
            var matrix2 = new Matrix2(m11, m12,
                                      m21, m22);
            var expected = new[, ] {
                { m11 - m11, m12 - m12 }, { m21 - m21, m22 - m22 }
            };
            var result = (matrix1 - matrix2).Matrix;

            Assert.Equal(expected, result);
        }
Exemplo n.º 19
0
        public void AddTwoMatrices(float m11, float m12, float m21, float m22)
        {
            var matrix1 = new Matrix2(m11, m12,
                                      m21, m22);
            var matrix2 = new Matrix2(m11, m12,
                                      m21, m22);
            var expected = new[, ] {
                { m11 + m11, m12 + m12 }, { m21 + m21, m22 + m22 }
            };
            var result = (matrix1 + matrix2).Matrix;

            Assert.Equal(expected, result);
        }
Exemplo n.º 20
0
        public void DoubleToFloat()
        {
            Matrix2<double> m = new Matrix2<double>(
                1.0, 2.0,
                3.0, 4.0);

            Matrix2<float> mf = Matrix2<double>.DoubleToFloat(m);

            Assert.AreEqual(1.0f, mf.Column0Row0, 1e-7);
            Assert.AreEqual(2.0f, mf.Column1Row0, 1e-7);
            Assert.AreEqual(3.0f, mf.Column0Row1, 1e-7);
            Assert.AreEqual(4.0f, mf.Column1Row1, 1e-7);
        }
Exemplo n.º 21
0
    public static Matrix2 ZeroMatrix()
    {
        Matrix2 matrix = new Matrix2();

        for (int i = 0; i < 2; i++)
        {
            for (int j = 0; j < 2; j++)
            {
                matrix[i, j] = 0;
            }
        }
        return(matrix);
    }
Exemplo n.º 22
0
    public static Matrix2 Transpose(Matrix2 m)
    {
        Matrix2 t = new Matrix2();

        for (int i = 0; i < 2; i++)
        {
            for (int j = 0; j < 2; j++)
            {
                t[j, i] = m[i, j];
            }
        }
        return(t);
    }
Exemplo n.º 23
0
    private static Matrix2 Multiply(float n, Matrix2 m)
    {
        Matrix2 r = new Matrix2();

        for (int i = 0; i < 2; i++)
        {
            for (int j = 0; j < 2; j++)
            {
                r[i, j] = m[i, j] * n;
            }
        }
        return(r);
    }
Exemplo n.º 24
0
        public void Determinant_ShouldReturnExpectedValue()
        {
            // arrange
            var sut = new Matrix2(new[, ] {
                { 1f, 5f }, { -3f, 2f }
            });

            // act
            var result = sut.Determinant();

            // assert
            result.Should().Be(17);
        }
Exemplo n.º 25
0
    private static Matrix2 Add(Matrix2 m1, Matrix2 m2)
    {
        Matrix2 r = new Matrix2();

        for (int i = 0; i < 2; i++)
        {
            for (int j = 0; j < 2; j++)
            {
                r[i, j] = m1[i, j] + m2[i, j];
            }
        }
        return(r);
    }
Exemplo n.º 26
0
        public void MatrixCreateRotation()
        {
            Matrix2 rot0deg   = new Matrix2(1, 0, 0, 1);
            Matrix2 rot90deg  = new Matrix2(0, -1, 1, 0);
            Matrix2 rot180deg = new Matrix2(-1, 0, 0, -1);
            Matrix2 rot270deg = new Matrix2(0, 1, -1, 0);

            CompareMatrices(Matrix2.CreateRotation((float)Math.PI * 0.0f), rot0deg, 10e-7f);
            CompareMatrices(Matrix2.CreateRotation((float)Math.PI * 0.5f), rot90deg, 10e-7f);
            CompareMatrices(Matrix2.CreateRotation((float)Math.PI * 1.0f), rot180deg, 10e-7f);
            CompareMatrices(Matrix2.CreateRotation((float)Math.PI * 1.5f), rot270deg, 10e-7f);
            CompareMatrices(Matrix2.CreateRotation((float)Math.PI * 2.0f), rot0deg, 10e-7f);
        }
Exemplo n.º 27
0
        public void Rotate(float deg)
        {
            float turn = deg * MathHelper.DEG_RAD;

            r += turn;
            Matrix2 temp = References.matrix;

            temp.SetRotation(turn);
            p[0].MulMatrix2(temp);
            p[1].MulMatrix2(temp);
            p[2].MulMatrix2(temp);
            p[3].MulMatrix2(temp);
        }
Exemplo n.º 28
0
        public void SetMatrix(string name, Matrix2 data)
        {
            if (disposed)
            {
                throw new ObjectDisposedException("Shader: " + name);
            }

            if (_uniformLocations.ContainsKey(name))
            {
                GL.UseProgram(Handle);
                GL.UniformMatrix2(_uniformLocations[name], true, ref data);
            }
        }
Exemplo n.º 29
0
        public void SubMatrix_ShouldReturnExpectedMatrix2(int row, int column, Matrix2 expected)
        {
            // arrange
            var sut = new Matrix3(new[, ] {
                { 1f, 2f, 3f }, { 4f, 5f, 6f }, { 7f, 8f, 9f }
            });

            // act
            var actual = sut.SubMatrix(row, column);

            // assert
            actual.Should().Be(expected);
        }
Exemplo n.º 30
0
        public void SetRotation(float deg)
        {
            float prevr = r;

            r = deg * MathHelper.DEG_RAD;
            Matrix2 temp = References.matrix;

            temp.SetRotation(-prevr + r);
            p[0].MulMatrix2(temp);
            p[1].MulMatrix2(temp);
            p[2].MulMatrix2(temp);
            p[3].MulMatrix2(temp);
        }
Exemplo n.º 31
0
        public void MatrixToFloat()
        {
            float[] array  = new float[] { 10, 20, 30, 40 };
            Matrix2 matrix = new Matrix2(array);

            float[] comparison = matrix.ToFloat();

            Assert.AreEqual(comparison.Length, array.Length);
            for (int i = 0; i < array.Length; i++)
            {
                Assert.AreEqual(comparison[i], array[i]);
            }
        }
Exemplo n.º 32
0
        private Line RotateLine(Line stick, float rotationAngle)
        {
            var     mtxRotation = Matrix2.CreateRotation(rotationAngle);
            Vector2 a;

            a.X = Vector2.Dot(mtxRotation.Column0, stick.Item1);
            a.Y = Vector2.Dot(mtxRotation.Column1, stick.Item1);
            Vector2 b;

            b.X = Vector2.Dot(mtxRotation.Column0, stick.Item2);
            b.Y = Vector2.Dot(mtxRotation.Column1, stick.Item2);
            return(new Line(a, b));
        }
        public void Multiply_Operator()
        {
            var     inputL     = GetTestMatrix();
            var     inputR     = GetTestMatrix();
            var     inputSimdL = (MatrixFloat2x2)inputL;
            var     inputSimdR = (MatrixFloat2x2)inputR;
            Matrix2 expected;

            Matrix2.Multiply(ref inputR, ref inputL, out expected);              // OpenTK.Matrix2 got left/right mixed up...
            var actual = inputSimdL * inputSimdR;

            Asserts.AreEqual(expected, actual, "multiply");
        }
Exemplo n.º 34
0
        public static Vector2 GetRotatedVector(Vector2 vector, float angle, bool clockwise)
        {
            if (clockwise)
            {
                angle *= -1;
            }

            Matrix2 rotationMatrix = Matrix2.CreateRotation(angle);

            float x = rotationMatrix.M11 * vector.X + rotationMatrix.M12 * vector.Y;
            float y = rotationMatrix.M21 * vector.X + rotationMatrix.M22 * vector.Y;

            return(new Vector2(x, y));
        }
Exemplo n.º 35
0
        public static Matrix2 operator *(Matrix2 a, int b)
        {
            Matrix2 ret = new Matrix2(0);

            for (int i = 0; i < 2; i++)
            {
                for (int j = 0; j < 2; j++)
                {
                    ret[i, j] = a[i, j] * b;
                }
            }

            return(ret);
        }
Exemplo n.º 36
0
        public static Matrix2 operator -(Matrix2 a)
        {
            Matrix2 ret = new Matrix2(0);

            for (int i = 0; i < 2; i++)
            {
                for (int j = 0; j < 2; j++)
                {
                    ret[i, j] = 0 - a[i, j];
                }
            }

            return(ret);
        }
Exemplo n.º 37
0
        public static Matrix2 Inverse(this Matrix2 m)
        {
            float OneOverDeterminant = (1f) / (
                +m[0][0] * m[1][1]
                - m[1][0] * m[0][1]);

            Matrix2 Inverse = new Matrix2(
                +m[1][1] * OneOverDeterminant,
                -m[0][1] * OneOverDeterminant,
                -m[1][0] * OneOverDeterminant,
                +m[0][0] * OneOverDeterminant);

            return(Inverse);
        }
Exemplo n.º 38
0
        public static void equality_typed()
        {
            var a = new Matrix2(_a);
            var b = new Matrix2(_b);
            var c = new Matrix2(_b);

            a.Equals(a).Should().BeTrue();
            b.Equals(b).Should().BeTrue();
            b.Equals(c).Should().BeTrue();
            a.Equals(b).Should().BeFalse();
            b.Equals(a).Should().BeFalse();
            a.Equals(c).Should().BeFalse();
            a.Equals(null).Should().BeFalse();
        }
Exemplo n.º 39
0
        public void Construct2()
        {
            Matrix2<double> m = new Matrix2<double>(
                1.0, 2.0,
                3.0, 4.0);

            Assert.AreEqual(1.0, m.Column0Row0);
            Assert.AreEqual(2.0, m.Column1Row0);
            Assert.AreEqual(3.0, m.Column0Row1);
            Assert.AreEqual(4.0, m.Column1Row1);

            Assert.AreEqual(1.0, m.ReadOnlyColumnMajorValues[0]);
            Assert.AreEqual(3.0, m.ReadOnlyColumnMajorValues[1]);
            Assert.AreEqual(2.0, m.ReadOnlyColumnMajorValues[2]);
            Assert.AreEqual(4.0, m.ReadOnlyColumnMajorValues[3]);
        }
Exemplo n.º 40
0
        public void Equals()
        {
            Matrix2<double> a = new Matrix2<double>(
                1.0, 2.0,
                3.0, 4.0);
            Matrix2<double> b = new Matrix2<double>(0.0);
            Matrix2<double> c = new Matrix2<double>(
                1.0, 2.0,
                3.0, 4.0);

            Assert.IsTrue(a.Equals(c));
            Assert.IsTrue(c.Equals(a));
            Assert.IsTrue(a == c);
            Assert.IsTrue(c == a);
            Assert.IsFalse(c != a);
            Assert.IsFalse(c != a);
            Assert.IsFalse(a.Equals(b));
            Assert.IsFalse(b.Equals(a));
            Assert.IsFalse(a == b);
            Assert.IsFalse(b == a);
            Assert.IsTrue(a != b);
            Assert.IsTrue(b != a);

            object objA = a;
            object objB = b;
            object objC = c;

            Assert.IsTrue(a.Equals(objA));
            Assert.IsTrue(a.Equals(objC));
            Assert.IsFalse(a.Equals(objB));

            Assert.IsTrue(objA.Equals(objC));
            Assert.IsFalse(objA.Equals(objB));

            Assert.IsFalse(a.Equals(null));
            Assert.IsFalse(a.Equals(5));
        }
Exemplo n.º 41
0
        public static void elements_set() {
            var m = new Matrix2();

            m.Set(0, 0, 0);
            m.Set(0, 1, 1);
            m.Set(1, 0, 2);
            m.Set(1, 1, 3);

            m.Should().Be(_incremented);
        }
Exemplo n.º 42
0
        public static void constructor_element() {
            var m = new Matrix2(0, 1, 2, 3);

            m.Should().Be(_incremented);
        }
Exemplo n.º 43
0
        public static void element_field_set() {
            var m = new Matrix2();

            m.E00 = 0;
            m.E01 = 1;
            m.E10 = 2;
            m.E11 = 3;

            m.Should().Be(_incremented);
        }
Exemplo n.º 44
0
        public static void add_assign_op() {
            var d = new Matrix2(_a);

            d += _b;

            d.Should().Be(_sum);
        }
Exemplo n.º 45
0
        public static void constructor_default() {
            var m = new Matrix2();

            m.Should().Be(_identity);
        }
Exemplo n.º 46
0
        public static void transpose() {
            var a = new Matrix2(_incremented);

            a.Transpose();

            a.Should().Be(_trans);
        }
Exemplo n.º 47
0
        public static void add_assign() {
            var d = new Matrix2(_a);

            d.AddAssign(_b);

            d.Should().Be(_sum);
        }
Exemplo n.º 48
0
        public static void equality_typed() {
            var a = new Matrix2(_a);
            var b = new Matrix2(_b);
            var c = new Matrix2(_b);

            a.Equals(a).Should().BeTrue();
            b.Equals(b).Should().BeTrue();
            b.Equals(c).Should().BeTrue();
            a.Equals(b).Should().BeFalse();
            b.Equals(a).Should().BeFalse();
            a.Equals(c).Should().BeFalse();
            a.Equals(null).Should().BeFalse();
        }
Exemplo n.º 49
0
        public static void equality_op() {
            var a = new Matrix2(_a);
            var a2 = a;
            var b = new Matrix2(_b);
            var b2 = b;
            var c = new Matrix2(_b);
            var d = (Matrix2)null;

            Assert.False(a == b);
            Assert.False(b == a);
            Assert.True(a == a2);
            Assert.True(b == b2);
            Assert.False(a == c);
            Assert.True(b == c);
            Assert.False(a == null);
            Assert.False(null == a);
            Assert.False(b == d);
            Assert.False(d == b);
            Assert.True(null == d);
        }
Exemplo n.º 50
0
        public static void multiply_assign() {
            var d = new Matrix2(_a);

            d.MultiplyAssign(_b);

            d.Should().Be(_product);
        }
Exemplo n.º 51
0
        public static void multiply_assign_op() {
            var d = new Matrix2(_a);

            d *= _b;

            d.Should().Be(_product);
        }
Exemplo n.º 52
0
        public static void determinants(double expectedDeterminant, Matrix2 m) {
            var determinant = m.CalculateDeterminant();

            determinant.Should().Be(expectedDeterminant);
        }
Exemplo n.º 53
0
        public static void invert_basic() {
            var a = new Matrix2(_priorInvert);

            a.Invert();

            a.Should().Be(_postInvert);
        }
Exemplo n.º 54
0
        public static void inverse_safety() {
            var a = new Matrix2(_priorInvert);

            var b = a.GetInverse();

            a.Should().Be(_priorInvert, "Source matrix should not be mutated.");
            b.Should().Be(_postInvert);
        }
Exemplo n.º 55
0
        public static void elements_get() {
            var m = new Matrix2(_incremented);

            m.Get(0, 0).Should().Be(0);
            m.Get(0, 1).Should().Be(1);
            m.Get(1, 0).Should().Be(2);
            m.Get(1, 1).Should().Be(3);
        }
Exemplo n.º 56
0
        public static void inequality_op() {
            var a = new Matrix2(_a);
            var a2 = a;
            var b = new Matrix2(_b);
            var b2 = b;
            var c = new Matrix2(_b);
            var d = (Matrix2)null;

            Assert.True(a != b);
            Assert.True(b != a);
            Assert.False(a != a2);
            Assert.False(b != b2);
            Assert.True(a != c);
            Assert.False(b != c);
            Assert.True(a != null);
            Assert.True(null != a);
            Assert.True(b != d);
            Assert.True(d != b);
            Assert.False(null != d);
        }
Exemplo n.º 57
0
        public static void transposed_get() {
            var a = new Matrix2(_incremented);

            var b = a.GetTransposed();

            a.Should().Be(_incremented, "Source matrix should not be mutated.");
            b.Should().Be(_trans);
        }
Exemplo n.º 58
0
 private static void Equal(Matrix2 a, Matrix2 b, int precision) {
     Assert.Equal(a.E00, b.E00, precision);
     Assert.Equal(a.E01, b.E01, precision);
     Assert.Equal(a.E10, b.E10, precision);
     Assert.Equal(a.E11, b.E11, precision);
 }
Exemplo n.º 59
0
 public static void UniformMatrix2(int location, bool transpose, ref Matrix2 matrix)
 {
     unsafe
     {
         fixed (float* matrix_ptr = &matrix.Row0.X)
         {
             GL.UniformMatrix2(location, 1, transpose, matrix_ptr);
         }
     }
 }
Exemplo n.º 60
0
        public static void multiply_op() {
            var a = new Matrix2(_a);
            var b = new Matrix2(_b);

            var product = a * b;

            product.Should().Be(_product);
            a.Should().Be(_a, "No argument mutation is allowed.");
            b.Should().Be(_b, "No argument mutation is allowed.");
        }