Esempio n. 1
0
 public void Test()
 {
     m  = new TestVector3();
     m2 = TestVector3NoBinding.zero;
     UnitTest_10039Sub(m);
     UnitTest_10039Sub2(m2);
 }
Esempio n. 2
0
        public static void UnitTest_10022()
        {
            TestVector3 pos = TestVector3.One;

            pos.X += 1;
            pos.Y += 2;

            if (pos.X > 10)
            {
                pos.X = 10;
            }
            if (pos.X < -10)
            {
                pos.X = -10;
            }
            if (pos.Y > 10)
            {
                pos.Y = 10;
            }
            if (pos.Y < -10)
            {
                pos.Y = -10;
            }

            var pos2 = tttt(pos);

            Console.WriteLine("pos.x = " + pos.X);
            Console.WriteLine("pos2.x = " + pos2.X);

            if (pos.X == pos2.X)
            {
                throw new Exception("Value Type Violation");
            }
        }
Esempio n. 3
0
        public static void UnitTest_10023()
        {
            TestVectorStruct a;

            a = Sub10023();
            TestVector3 pos = a.C;

            pos.X += 123;

            TestVector3 pos2 = a.B.Vector;

            pos2.X -= 120;

            Console.WriteLine("pos.x=" + pos.X);
            Console.WriteLine("a.C.x=" + a.C.X);
            if (pos.X == a.C.X)
            {
                throw new Exception("Value Type Violation");
            }
            Console.WriteLine("pos2.x=" + pos2.X);
            Console.WriteLine("a.B.Vector.x=" + a.B.Vector.X);
            if (pos2.X == a.B.Vector.X)
            {
                throw new Exception("Value Type Violation");
            }
        }
Esempio n. 4
0
        public static void Test01()
        {
            TestVector3 vec = new TestVector3(100, 1, 0);

            TestVector3.One.X += vec.X;

            Console.WriteLine(TestVector3.One.ToString());
        }
Esempio n. 5
0
        public static void Test02()
        {
            TestVector3 vec = new TestVector3(100, 1, 0);

            vec += TestVector3.One;

            Console.WriteLine(vec.ToString());
        }
Esempio n. 6
0
 static void UnitTest_10046Sub(TestVector3 a)
 {
     a = a + TestVector3.One2;
     Console.WriteLine(a);
     if (a.X != 2)
     {
         throw new Exception();
     }
 }
Esempio n. 7
0
        public static void UnitTest_10028()
        {
            TestVector3 a = TestVector3.One;
            float       b = 1f;

            TestVector3 c = new TestVector3();

            a.Test(out c, out b);
        }
Esempio n. 8
0
        public static void UnitTest_10042()
        {
            TestVector3 pos = GetVector3Func?.Invoke() ?? TestVector3.One2;

            if (pos.X != 123)
            {
                throw new Exception();
            }
        }
Esempio n. 9
0
            void UnitTest_10039Sub(TestVector3 arg)
            {
                arg = TestVector3.One2;

                if (arg.X != 1)
                {
                    throw new Exception();
                }
            }
Esempio n. 10
0
        public static void UnitTest_10029()
        {
            TestVector3 c = new TestVector3();

            UnitTest_10029Sub2(out c);
            Console.WriteLine(c.ToString());
            c = new TestVector3();
            UnitTest_10029Sub(out c);
            Console.WriteLine(c.ToString());
        }
Esempio n. 11
0
 public static void UnitTest_10035()
 {
     TestVector3[] FuncBtnsPos1 = new TestVector3[3] {
         TestVector3.One, TestVector3.One, TestVector3.One
     };
     foreach (var i in FuncBtnsPos1)
     {
         Console.WriteLine(i.ToString());
     }
 }
Esempio n. 12
0
        public static object Test03()
        {
            TestVector3[] a = new TestVector3[10000];
            for (int i = 0; i < 10000; i++)
            {
                a[i] = TestVector3.One;
            }

            return(a);
        }
Esempio n. 13
0
        public static void UnitTest_10028()
        {
            TestVector3 a = TestVector3.One;
            float       b = 1f;

#if COMPILE_BUG
            TestVector3 c = new TestVector3();
            a.Test(out c, out b);
#endif
        }
Esempio n. 14
0
        public static void UnitTest_10047()
        {
            TestVector3[] arr2 = new TestVector3[10];
            arr2[0].X = 1243;
            arr2[0]  += TestVector3.One;

            if (Math.Abs(arr2[0].X - 1244) > 0.001f)
            {
                throw new Exception();
            }
        }
Esempio n. 15
0
        public static void UnitTest_10032()
        {
            TestVectorClass VTest = new TestVectorClass();

            TestVector3 value = VTest.vector;

            value.Normalize();
            VTest.vector.Normalize();
            Console.WriteLine("Vector3BindingTest local Vector3 normalized = " + value);
            Console.WriteLine("Vector3BindingTest Vector3 normalized = " + VTest.vector);
        }
Esempio n. 16
0
        public static void UnitTest_10033()
        {
            TestVector3[] arr2 = new TestVector3[10];
            arr2[0].X = 1243;

            Vector3[] arr3 = new Vector3[10];
            arr3[0].x = 3143;

            Console.WriteLine(arr2[0].X);
            Console.WriteLine(arr3[0].x);
        }
Esempio n. 17
0
        public static void Test01()
        {
            TestVector3 vec = new TestVector3(100, 1, 0);

            TestVector3.One.X += vec.X;

            Console.WriteLine(TestVector3.One.ToString());
            if (TestVector3.One.X == 1)
            {
                throw new Exception();
            }
        }
Esempio n. 18
0
        public static object Test03()
        {
            TestVector3[] a = new TestVector3[10000];
            Vector3[]     b = new Vector3[100];
            Console.WriteLine(b[0]);
            for (int i = 0; i < 10000; i++)
            {
                a[i] = TestVector3.One;
            }

            return(a);
        }
Esempio n. 19
0
        public static void UnitTest_Performance13()
        {
            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();
            TestVector3 vec  = default;
            TestVector3 vec2 = TestVector3.One2;

            for (int i = 0; i < 1000000; i++)
            {
                vec += vec2 * 2 + TestVector3.One2;
            }
            sw.Stop();
            Console.WriteLine(string.Format("res=" + vec + ",time = " + sw.ElapsedMilliseconds + ", cps:{0:0}", (1000000 * 1000 / sw.ElapsedMilliseconds)));
        }
Esempio n. 20
0
        public static void UnitTest_10037()
        {
            TestVector3 rawPos = new TestVector3(1, 2, 3);
            TestVector3 tmpPos = rawPos;

            m_curPos2 = rawPos;
            Console.WriteLine("before raw:" + rawPos + " tmp:" + tmpPos + " cur:" + m_curPos2);
            ChangePosY2(tmpPos);
            ChangePosY2(m_curPos2);
            Console.WriteLine("after raw:" + rawPos + " tmp:" + tmpPos + " cur:" + m_curPos2);
            if (tmpPos.Y == 0 || m_curPos2.Y == 0)
            {
                throw new AccessViolationException();
            }
        }
Esempio n. 21
0
        public static void UnitTest_10040()
        {
            TestVector3 dot = new TestVector3();

            dot.X = 10;
            dot.Y = 10;

            for (int i = 0; i < 50; i++)
            {
                dot.X++;
            }

            Console.WriteLine("dot.X == " + dot.X);
            if (dot.X != 60)
            {
                throw new AccessViolationException();
            }
        }
Esempio n. 22
0
        public static void UnitTest_10031()
        {
            TestVector3 pos     = TestVector3.One2;
            float       offsetX = pos.X - 0.1f;
            float       offsetY = pos.Y - 0.1f;//报错行数在这里

            if (offsetX > 1)
            {
                Console.WriteLine("1");
            }
            else if (offsetX < -1)
            {
                Console.WriteLine("2");
            }
            //注释下面的代码就不会出错了
            else if (offsetY > 1)
            {
                Console.WriteLine("3");
            }
            else if (offsetY < -1)
            {
                Console.WriteLine("4");
            }
        }
Esempio n. 23
0
 static TestVector3 tttt(TestVector3 a)
 {
     a.X = 12345;
     return(a);
 }
Esempio n. 24
0
 static void ChangePosY2(TestVector3 pos)
 {
     pos.Y = 0;
 }
Esempio n. 25
0
 static void UnitTest_10029Sub2(out TestVector3 v3)
 {
     v3 = TestVector3.One2;//
 }
Esempio n. 26
0
 public static void UnitTest_10046()
 {
     TestVector3.TestDelegate2 = UnitTest_10046Sub;
     TestVector3.DoTest2();
 }