コード例 #1
0
        public void Matrix3x2EqualsTest()
        {
            Matrix3x2 a = GenerateIncrementalMatrixNumber();
            Matrix3x2 b = GenerateIncrementalMatrixNumber();

            // case 1: compare between same values
            object obj = b;

            bool expected = true;
            bool actual   = a.Equals(obj);

            Assert.Equal(expected, actual);

            // case 2: compare between different values
            b.M11    = 11.0f;
            obj      = b;
            expected = false;
            actual   = a.Equals(obj);
            Assert.Equal(expected, actual);

            // case 3: compare between different types.
            obj      = new Vector4();
            expected = false;
            actual   = a.Equals(obj);
            Assert.Equal(expected, actual);

            // case 3: compare against null.
            obj      = null;
            expected = false;
            actual   = a.Equals(obj);
            Assert.Equal(expected, actual);
        }
コード例 #2
0
ファイル: Matrix3x2Test.cs プロジェクト: truongascii/Win2D
        public void Matrix3x2EqualsTest()
        {
            Matrix3x2 a = GenerateMatrixNumberFrom1To6();
            Matrix3x2 b = GenerateMatrixNumberFrom1To6();

            // case 1: compare between same values
            object obj = b;

            bool expected = true;
            bool actual   = a.Equals(obj);

            Assert.AreEqual(expected, actual, "Matrix3x2.Equals did not return the expected value.");

            // case 2: compare between different values
            b.M11    = 11.0f;
            obj      = b;
            expected = false;
            actual   = a.Equals(obj);
            Assert.AreEqual(expected, actual, "Matrix3x2.Equals did not return the expected value.");

            // case 3: compare between different types.
            obj      = new Vector4();
            expected = false;
            actual   = a.Equals(obj);
            Assert.AreEqual(expected, actual, "Matrix3x2.Equals did not return the expected value.");

            // case 3: compare against null.
            obj      = null;
            expected = false;
            actual   = a.Equals(obj);
            Assert.AreEqual(expected, actual, "Matrix3x2.Equals did not return the expected value.");
        }
コード例 #3
0
        public void Matrix3x2EqualsTest1()
        {
            Matrix3x2 a = GenerateIncrementalMatrixNumber();
            Matrix3x2 b = GenerateIncrementalMatrixNumber();

            // case 1: compare between same values
            bool expected = true;
            bool actual   = a.Equals(b);

            Assert.Equal(expected, actual);

            // case 2: compare between different values
            b.M11    = 11.0f;
            expected = false;
            actual   = a.Equals(b);
            Assert.Equal(expected, actual);
        }
コード例 #4
0
ファイル: Matrix3x2Test.cs プロジェクト: truongascii/Win2D
        public void Matrix3x2EqualsTest1()
        {
            Matrix3x2 a = GenerateMatrixNumberFrom1To6();
            Matrix3x2 b = GenerateMatrixNumberFrom1To6();

            // case 1: compare between same values
            bool expected = true;
            bool actual   = a.Equals(b);

            Assert.AreEqual(expected, actual, "Matrix3x2.Equals did not return the expected value.");

            // case 2: compare between different values
            b.M11    = 11.0f;
            expected = false;
            actual   = a.Equals(b);
            Assert.AreEqual(expected, actual, "Matrix3x2.Equals did not return the expected value.");
        }
コード例 #5
0
        public void Matrix3x2EqualsNanTest()
        {
            Matrix3x2 a = new Matrix3x2(float.NaN, 0, 0, 0, 0, 0);
            Matrix3x2 b = new Matrix3x2(0, float.NaN, 0, 0, 0, 0);
            Matrix3x2 c = new Matrix3x2(0, 0, float.NaN, 0, 0, 0);
            Matrix3x2 d = new Matrix3x2(0, 0, 0, float.NaN, 0, 0);
            Matrix3x2 e = new Matrix3x2(0, 0, 0, 0, float.NaN, 0);
            Matrix3x2 f = new Matrix3x2(0, 0, 0, 0, 0, float.NaN);

            Assert.False(a == new Matrix3x2());
            Assert.False(b == new Matrix3x2());
            Assert.False(c == new Matrix3x2());
            Assert.False(d == new Matrix3x2());
            Assert.False(e == new Matrix3x2());
            Assert.False(f == new Matrix3x2());

            Assert.True(a != new Matrix3x2());
            Assert.True(b != new Matrix3x2());
            Assert.True(c != new Matrix3x2());
            Assert.True(d != new Matrix3x2());
            Assert.True(e != new Matrix3x2());
            Assert.True(f != new Matrix3x2());

            Assert.False(a.Equals(new Matrix3x2()));
            Assert.False(b.Equals(new Matrix3x2()));
            Assert.False(c.Equals(new Matrix3x2()));
            Assert.False(d.Equals(new Matrix3x2()));
            Assert.False(e.Equals(new Matrix3x2()));
            Assert.False(f.Equals(new Matrix3x2()));

            Assert.False(a.IsIdentity);
            Assert.False(b.IsIdentity);
            Assert.False(c.IsIdentity);
            Assert.False(d.IsIdentity);
            Assert.False(e.IsIdentity);
            Assert.False(f.IsIdentity);

            // Counterintuitive result - IEEE rules for NaN comparison are weird!
            Assert.False(a.Equals(a));
            Assert.False(b.Equals(b));
            Assert.False(c.Equals(c));
            Assert.False(d.Equals(d));
            Assert.False(e.Equals(e));
            Assert.False(f.Equals(f));
        }
コード例 #6
0
ファイル: Matrix3x2Tests.cs プロジェクト: naricc/runtime
        public void Matrix3x2EqualsNaNTest()
        {
            Matrix3x2 a = new Matrix3x2(float.NaN, 0, 0, 0, 0, 0);
            Matrix3x2 b = new Matrix3x2(0, float.NaN, 0, 0, 0, 0);
            Matrix3x2 c = new Matrix3x2(0, 0, float.NaN, 0, 0, 0);
            Matrix3x2 d = new Matrix3x2(0, 0, 0, float.NaN, 0, 0);
            Matrix3x2 e = new Matrix3x2(0, 0, 0, 0, float.NaN, 0);
            Matrix3x2 f = new Matrix3x2(0, 0, 0, 0, 0, float.NaN);

            Assert.False(a == new Matrix3x2());
            Assert.False(b == new Matrix3x2());
            Assert.False(c == new Matrix3x2());
            Assert.False(d == new Matrix3x2());
            Assert.False(e == new Matrix3x2());
            Assert.False(f == new Matrix3x2());

            Assert.True(a != new Matrix3x2());
            Assert.True(b != new Matrix3x2());
            Assert.True(c != new Matrix3x2());
            Assert.True(d != new Matrix3x2());
            Assert.True(e != new Matrix3x2());
            Assert.True(f != new Matrix3x2());

            Assert.False(a.Equals(new Matrix3x2()));
            Assert.False(b.Equals(new Matrix3x2()));
            Assert.False(c.Equals(new Matrix3x2()));
            Assert.False(d.Equals(new Matrix3x2()));
            Assert.False(e.Equals(new Matrix3x2()));
            Assert.False(f.Equals(new Matrix3x2()));

            Assert.False(a.IsIdentity);
            Assert.False(b.IsIdentity);
            Assert.False(c.IsIdentity);
            Assert.False(d.IsIdentity);
            Assert.False(e.IsIdentity);
            Assert.False(f.IsIdentity);

            Assert.True(a.Equals(a));
            Assert.True(b.Equals(b));
            Assert.True(c.Equals(c));
            Assert.True(d.Equals(d));
            Assert.True(e.Equals(e));
            Assert.True(f.Equals(f));
        }
コード例 #7
0
ファイル: Matrix3x2Tests.cs プロジェクト: noahfalk/corefx
        public void Matrix3x2EqualsNanTest()
        {
            Matrix3x2 a = new Matrix3x2(float.NaN, 0, 0, 0, 0, 0);
            Matrix3x2 b = new Matrix3x2(0, float.NaN, 0, 0, 0, 0);
            Matrix3x2 c = new Matrix3x2(0, 0, float.NaN, 0, 0, 0);
            Matrix3x2 d = new Matrix3x2(0, 0, 0, float.NaN, 0, 0);
            Matrix3x2 e = new Matrix3x2(0, 0, 0, 0, float.NaN, 0);
            Matrix3x2 f = new Matrix3x2(0, 0, 0, 0, 0, float.NaN);

            Assert.False(a == new Matrix3x2());
            Assert.False(b == new Matrix3x2());
            Assert.False(c == new Matrix3x2());
            Assert.False(d == new Matrix3x2());
            Assert.False(e == new Matrix3x2());
            Assert.False(f == new Matrix3x2());

            Assert.True(a != new Matrix3x2());
            Assert.True(b != new Matrix3x2());
            Assert.True(c != new Matrix3x2());
            Assert.True(d != new Matrix3x2());
            Assert.True(e != new Matrix3x2());
            Assert.True(f != new Matrix3x2());

            Assert.False(a.Equals(new Matrix3x2()));
            Assert.False(b.Equals(new Matrix3x2()));
            Assert.False(c.Equals(new Matrix3x2()));
            Assert.False(d.Equals(new Matrix3x2()));
            Assert.False(e.Equals(new Matrix3x2()));
            Assert.False(f.Equals(new Matrix3x2()));

            Assert.False(a.IsIdentity);
            Assert.False(b.IsIdentity);
            Assert.False(c.IsIdentity);
            Assert.False(d.IsIdentity);
            Assert.False(e.IsIdentity);
            Assert.False(f.IsIdentity);

            // Counterintuitive result - IEEE rules for NaN comparison are weird!
            Assert.False(a.Equals(a));
            Assert.False(b.Equals(b));
            Assert.False(c.Equals(c));
            Assert.False(d.Equals(d));
            Assert.False(e.Equals(e));
            Assert.False(f.Equals(f));
        }