Esempio n. 1
0
        public void CreateNestClass()
        {
            var actual      = faker.Create <NestClass>();
            var notExpected = new NestClass();

            Assert.AreNotEqual(notExpected.a, actual.a);
            Assert.AreNotEqual(notExpected.c, actual.c);
            CollectionAssert.AreNotEqual(notExpected.s, actual.s);
        }
Esempio n. 2
0
        public void TestListNest()
        {
            for (int i = 0; i < 10000; i++)
            {
                var x1x = new MemMap();
            }

            MapFileList <NestClass> mfList = null;
            int iLoop = 0;

            try
            {
                var  bigstr = new string('a', 10000);
                uint nInst  = 1 << 25; // 2^26 = 67,108,864
                nInst = 16777214;
                nInst = 10000;
                using (mfList = new MapFileList <NestClass>())
                {
                    var xx = new NestClass()
                    {
                        _nNum = 1, _stack = null
                    };
                    mfList.Add(xx);
                    var ret = mfList[mfList.Count - 1];
                    Assert.AreEqual(ret._nNum, mfList.Count);
                    Assert.IsNull(ret._stack, "ret stack should be null");
                    mfList.Clear();
                    for (int i = 1; i < nInst; i++)
                    {
                        var testInstance = DataClass.MakeInstance((ulong)i);
                        testInstance.str5 = bigstr;
                        var x = new NestClass()
                        {
                            _nNum = i, _stack = testInstance
                        };
                        mfList.Add(x);
                        var retrievedInstance = mfList[(int)i - 1];
                        Assert.AreEqual(bigstr, retrievedInstance._stack.str5, "objects not equal Count=" + mfList.Count.ToString());
                        //                        Assert.AreEqual(testInstance, retrievedInstance, "objects not equal Count=" + mfList.Count.ToString());
                    }
                    mfList.VerifyNoLeaks();
                }
            }
            catch (Exception ex)
            {
                Assert.Fail("exception lp={0} cnt={1} {2}\r\n{3}", iLoop, mfList.Count, mfList._MemMap._stats.ToString(), ex.ToString());
                throw;
            }
        }
Esempio n. 3
0
 // クラスはダメ
 //            [MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.Struct, SizeConst = 1)]
 //            public NestClass[] nstructclass;
 public Nest()
 {
     nclass = new NestClass();
     nstruct = new NestStruct();
     nstructarray = new NestStruct[1];
     //                nstructclass = new NestClass[1];
 }
Esempio n. 4
0
 public Nest(int m)
 {
     u16 = (ushort)0x8899;
     u32 = (uint)0x8899aabb;
     nclass = new NestClass(m);
     nstruct = new NestStruct(m);
     nstructarray = new NestStruct[1] { new NestStruct(m) };
     //                nstructclass = new NestClass[1] { new NestClass(m) };
 }