示例#1
0
        public void MultivectorCopy()
        {
            var A = new Multivector(R3)
            {
                [E1] = 3.5,
                [E2] = 0.14,
                [E3] = -1 / 12d
            };

            Assert.AreEqual(A, M["Vector3B"]);
            Assert.IsTrue(A == M["Vector3B"]);
            Assert.IsFalse(A != M["Vector3B"]);
            Assert.IsTrue(A.Equals(M["Vector3B"]));


            A.Copy(M["Vector3A"]);

            Assert.AreEqual(A, M["Vector3A"]);
            Assert.IsTrue(A == M["Vector3A"]);
            Assert.IsFalse(A != M["Vector3A"]);
            Assert.IsTrue(A.Equals(M["Vector3A"]));

            Assert.AreNotEqual(A, M["Vector3B"]);
            Assert.IsFalse(A == M["Vector3B"]);
            Assert.IsTrue(A != M["Vector3B"]);
            Assert.IsTrue(A.Equals(M["Vector3A"]));

            Assert.AreEqual(A.GetHashCode(), M["Vector3A"].GetHashCode());
        }
示例#2
0
        public void MultivectorConstructor()
        {
            var A = new Multivector(R3)
            {
                [E1] = 3.5,
                [E2] = 0.14,
                [E3] = -1 / 12d
            };

            Assert.AreEqual(3.5, A[1]);
            Assert.AreEqual(0.14, A[2]);
            Assert.AreEqual(-1 / 12d, A[4]);

#pragma warning disable CS1718 // Comparison made to same variable

            Assert.IsTrue(A == A);
            Assert.IsTrue(A.Equals(A));
            Assert.IsFalse(A != A);

#pragma warning restore CS1718 // Comparison made to same variable
        }