コード例 #1
0
        internal static void AssertArrayObject <T>(ref T[] arr, ArrayObject **ao)
        {
            Debug.Assert((**ao).Length == arr.Length);
            Debug.Assert((**ao).Header == Runtime.ReadObjHeader(ref arr));
            Debug.Assert((**ao).MethodTable == Runtime.ReadMethodTable(ref arr));
            //Debug.Assert((**ao).Handle.Value == typeof(T).TypeHandle.Value);

            /*if ((**ao).Handle.Value != IntPtr.Zero) {
             *      Debug.Assert((**ao).Handle.Value == typeof(T).TypeHandle.Value);
             * }*/
        }
コード例 #2
0
ファイル: HeapObjectTests.cs プロジェクト: lulzzz/RazorSharp
        public void Test()
        {
            object       x = "foo";
            HeapObject **h = Runtime.GetHeapObject(ref x);

            TestingAssertion.AssertHeapObject(ref x, h);

            string         s      = "foo";
            StringObject **strObj = Runtime.GetStringObject(ref s);

            TestingAssertion.AssertStringObject(ref s, strObj);

            int[]         arr    = { 1, 2, 3 };
            ArrayObject **arrObj = Runtime.GetArrayObject(ref arr);

            TestingAssertion.AssertArrayObject(ref arr, arrObj);

            s += " bar";
            Assert.That(s.Length, Is.EqualTo((**strObj).Length));
        }