Beispiel #1
0
 public SvnData(string str, AprPool pool)
 {
     byte[] utf8str = Encoder.GetBytes(str);
     mString = pool.Alloc(utf8str.Length+1);
     Marshal.Copy(utf8str,0,mString,utf8str.Length);
     Marshal.WriteByte(mString,utf8str.Length,0);
 }
Beispiel #2
0
        public void Alloc()
        {
            AprPool p = new AprPool();
            Assert.IsTrue(p.IsNull,"#E01");

            p = AprPool.Create();
            Assert.IsFalse(p.IsNull,"#E02");

            Assert.IsTrue(p.Alloc(128).ToInt32() != 0,"#E03");
            Assert.IsTrue(p.Alloc(256).ToInt32() != 0,"#E04");
            Assert.IsTrue(p.Alloc(512).ToInt32() != 0,"#E05");
            Assert.IsTrue(p.Alloc(1024).ToInt32() != 0,"#E06");
            Assert.IsTrue(p.Alloc(2048).ToInt32() != 0,"#E07");
            Assert.IsTrue(p.Alloc(4096).ToInt32() != 0,"#E08");
            Assert.IsTrue(p.Alloc(6148).ToInt32() != 0,"#E09");
            Assert.IsTrue(p.Alloc(9216).ToInt32() != 0,"#E10");
            Assert.IsTrue(p.Alloc(12265).ToInt32() != 0,"#E11");
            Assert.IsTrue(p.Alloc(16384).ToInt32() != 0,"#E12");

            p.Destroy();
            Assert.IsTrue(p.IsNull,"#E13");
        }
Beispiel #3
0
        public void AllocLoop()
        {
            AprPool p = new AprPool();
            Assert.IsTrue(p.IsNull,"#G000001");

            p = AprPool.Create();
            Assert.IsFalse(p.IsNull,"#G000002");

            for(int i=24;i<4096;i+=24)
            {
                Assert.IsTrue(p.Alloc(i).ToInt32() != 0,String.Format("#G{0,6}",i));
            }

            p.Destroy();
            Assert.IsTrue(p.IsNull,"#G000004");
        }
Beispiel #4
0
        public void CAllocLoop()
        {
            AprPool p = new AprPool();
            Assert.IsTrue(p.IsNull,"#H000001");

            p = AprPool.Create();
            Assert.IsFalse(p.IsNull,"#H000002");

            for(int i=24;i<4096;i+=24)
            {
                IntPtr m = p.CAlloc(i);
                Assert.IsTrue(m.ToInt32() != 0,String.Format("#H{0,6}a",i));
                Assert.IsTrue(Marshal.ReadInt32(m) == 0,String.Format("#H{0,6}b",i));
                Assert.IsTrue(p.Alloc(i).ToInt32() != 0,String.Format("#H{0,6}c",i));
            }

            p.Destroy();
            Assert.IsTrue(p.IsNull,"#H000004");
        }