예제 #1
0
        public void allocFreeTest1()
        {
            var managed = new TVer(0, 32, 1024);

            UnmanagedStructure uv;

            using (uv = new UnmanagedStructure(managed))
            {
                Assert.NotEqual(0, uv.SizeOf);
                Assert.NotNull(uv.Managed);
            }

            Assert.Equal(IntPtr.Zero, (IntPtr)uv);
        }
예제 #2
0
        public void chkTypeRefTVerTest1()
        {
            using (var l = new ConariL(UNLIB_DLL))
            {
                TVer v = new TVer(5, 0, 1024);

                using (var uv = new UnmanagedStructure(v))
                {
                    IntPtr ptr = uv;

                    Assert.AreEqual(true, l.DLR.chkTypeRefTVer <bool>(ptr, 5, 0, 1024));
                    Assert.AreEqual(false, l.DLR.chkTypeRefTVer <bool>(ptr, 5, 1, 1024));
                }
            }
        }
예제 #3
0
        public void chkTypeRefTVerTest1()
        {
            using (dynamic l = new ConariX(gCfgUnlib))
            {
                TVer v = new TVer(5, 0, 1024);

                using (var uv = new UnmanagedStructure(v))
                {
                    IntPtr ptr = uv;

                    Assert.Equal(true, l.chkTypeRefTVer <bool>(ptr, 5, 0, 1024));
                    Assert.Equal(false, l.chkTypeRefTVer <bool>(ptr, 5, 1, 1024));
                }
            }
        }
예제 #4
0
        public void allocFreeTest2()
        {
            var managed = new TVer(0, 32, 1024);

            UnmanagedStructure uv;

            using (uv = new UnmanagedStructure(managed))
            {
                IntPtr ptr = uv;

                var uv2 = new UnmanagedStructure(ptr, typeof(TVer));

                TVer managed2 = (TVer)uv2.Managed;

                Assert.AreEqual(((TVer)uv.Managed).major, managed2.major);
                Assert.AreEqual(((TVer)uv.Managed).minor, managed2.minor);
                Assert.AreEqual(((TVer)uv.Managed).patch, managed2.patch);
            }

            Assert.AreEqual(IntPtr.Zero, (IntPtr)uv);
        }