Changeset 9
- Timestamp:
- 06/19/04 02:05:09 (4 years ago)
- Files:
-
- trunk/AprSharp/dev/src/AprAllocator.cs (modified) (1 diff)
- trunk/AprSharp/dev/src/AprArray.cs (modified) (1 diff)
- trunk/AprSharp/dev/src/AprHash.cs (modified) (4 diffs)
- trunk/AprSharp/dev/src/AprHashIndex.cs (modified) (1 diff)
- trunk/AprSharp/dev/src/AprMemNode.cs (modified) (1 diff)
- trunk/AprSharp/dev/src/AprPool.cs (modified) (1 diff)
- trunk/AprSharp/dev/src/AprString.cs (modified) (1 diff)
- trunk/AprSharp/dev/src/AprThreadMutex.cs (modified) (1 diff)
- trunk/AprSharp/dev/src/AprTimeExp.cs (modified) (1 diff)
- trunk/AprSharp/test/src/AprAllocatorTest.cs (modified) (10 diffs)
- trunk/AprSharp/test/src/AprMutexTest.cs (modified) (6 diffs)
- trunk/AprSharp/test/src/AprPoolTest.cs (modified) (16 diffs)
- trunk/AprSharp/test/src/AprTest.prjx (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/AprSharp/dev/src/AprAllocator.cs
r6 r9 26 26 } 27 27 28 public bool IsNull ()28 public bool IsNull 29 29 { 30 return( mAllocator == IntPtr.Zero ); 30 get 31 { 32 return( mAllocator == IntPtr.Zero ); 33 } 31 34 } 32 35 33 36 private void CheckPtr() 34 37 { 35 if( IsNull ())38 if( IsNull ) 36 39 throw new AprNullReferenceException(); 37 40 } trunk/AprSharp/dev/src/AprArray.cs
r6 r9 41 41 } 42 42 43 public bool IsNull() 44 { 45 return( mArray == null ); 43 public bool IsNull 44 { 45 get 46 { 47 return( mArray == null ); 48 } 46 49 } 47 50 trunk/AprSharp/dev/src/AprHash.cs
r6 r9 26 26 } 27 27 28 public bool IsNull() 29 { 30 return( mHash == IntPtr.Zero ); 28 public bool IsNull 29 { 30 get 31 { 32 return( mHash == IntPtr.Zero ); 33 } 31 34 } 32 35 33 36 private void CheckPtr() 34 37 { 35 if( IsNull ())38 if( IsNull ) 36 39 throw new AprNullReferenceException(); 37 40 } … … 329 332 set 330 333 { 331 if( mPool.IsNull ())334 if( mPool.IsNull ) 332 335 throw new AprNullReferenceException(); 333 336 mKey = AprString.Duplicate(mPool, value); … … 344 347 set 345 348 { 346 if( mPool.IsNull ())349 if( mPool.IsNull ) 347 350 throw new AprNullReferenceException(); 348 351 mValue = AprString.Duplicate(mPool, value); … … 381 384 reset = false; 382 385 } 383 else if(!mHashIndex.IsNull ())386 else if(!mHashIndex.IsNull) 384 387 { 385 388 mHashIndex.Next(); 386 389 } 387 return(!mHashIndex.IsNull ());390 return(!mHashIndex.IsNull); 388 391 } 389 392 trunk/AprSharp/dev/src/AprHashIndex.cs
r6 r9 26 26 } 27 27 28 public bool IsNull ()28 public bool IsNull 29 29 { 30 return( mHashIndex == IntPtr.Zero ); 30 get 31 { 32 return( mHashIndex == IntPtr.Zero ); 33 } 31 34 } 32 35 33 36 private void CheckPtr() 34 37 { 35 if( IsNull ())38 if( IsNull ) 36 39 throw new AprNullReferenceException(); 37 40 } trunk/AprSharp/dev/src/AprMemNode.cs
r1 r9 41 41 } 42 42 43 public bool IsNull() 44 { 45 return( mMemNode == null ); 43 public bool IsNull 44 { 45 get 46 { 47 return( mMemNode == null ); 48 } 46 49 } 47 50 trunk/AprSharp/dev/src/AprPool.cs
r6 r9 25 25 } 26 26 27 public bool IsNull ()27 public bool IsNull 28 28 { 29 return( mPool == IntPtr.Zero ); 29 get 30 { 31 return( mPool == IntPtr.Zero ); 32 } 30 33 } 31 34 32 35 private void CheckPtr() 33 36 { 34 if( IsNull ())37 if( IsNull ) 35 38 throw new AprNullReferenceException(); 36 39 } trunk/AprSharp/dev/src/AprString.cs
r1 r9 25 25 } 26 26 27 public bool IsNull ()27 public bool IsNull 28 28 { 29 return( mString == IntPtr.Zero ); 29 get 30 { 31 return( mString == IntPtr.Zero ); 32 } 30 33 } 31 34 32 35 private void CheckPtr() 33 36 { 34 if( IsNull ())37 if( IsNull ) 35 38 throw new AprNullReferenceException(); 36 39 } trunk/AprSharp/dev/src/AprThreadMutex.cs
r1 r9 32 32 } 33 33 34 public bool IsNull ()34 public bool IsNull 35 35 { 36 return( mThreadMutex == IntPtr.Zero ); 36 get 37 { 38 return( mThreadMutex == IntPtr.Zero ); 39 } 37 40 } 38 41 39 42 private void CheckPtr() 40 43 { 41 if( IsNull ())44 if( IsNull ) 42 45 throw new AprNullReferenceException(); 43 46 } trunk/AprSharp/dev/src/AprTimeExp.cs
r1 r9 53 53 } 54 54 55 public bool IsNull() 56 { 57 return( mTimeExp == null ); 55 public bool IsNull 56 { 57 get 58 { 59 return( mTimeExp == null ); 60 } 58 61 } 59 62 trunk/AprSharp/test/src/AprAllocatorTest.cs
r5 r9 29 29 { 30 30 AprAllocator a = new AprAllocator(); 31 Assert.IsTrue(a.IsNull (),"#A01");31 Assert.IsTrue(a.IsNull,"#A01"); 32 32 33 33 a = AprAllocator.Create(); 34 Assert.IsFalse(a.IsNull (),"#A02");34 Assert.IsFalse(a.IsNull,"#A02"); 35 35 36 36 a.Destroy(); 37 Assert.IsTrue(a.IsNull (),"#A03");37 Assert.IsTrue(a.IsNull,"#A03"); 38 38 } 39 39 … … 41 41 { 42 42 AprMemNode m = a.Alloc(size); 43 Assert.IsFalse(m.IsNull (),test+"a");43 Assert.IsFalse(m.IsNull,test+"a"); 44 44 if( (size+24) <= 8192 ) { 45 45 Assert.AreEqual(1,m.NativeIndex,test+"c"); … … 56 56 { 57 57 AprAllocator a = AprAllocator.Create(); 58 Assert.IsFalse(a.IsNull (),"#B01");58 Assert.IsFalse(a.IsNull,"#B01"); 59 59 60 60 AprMemNode m = AllocHelper(a,256,"#B02"); … … 62 62 63 63 a.Destroy(); 64 Assert.IsTrue(a.IsNull (),"#B03");64 Assert.IsTrue(a.IsNull,"#B03"); 65 65 } 66 66 … … 70 70 { 71 71 AprAllocator a = AprAllocator.Create(); 72 Assert.IsFalse(a.IsNull (),"#C01");72 Assert.IsFalse(a.IsNull,"#C01"); 73 73 74 74 AprMemNode m = AllocHelper(a,256,"#C02"); … … 96 96 97 97 a.Destroy(); 98 Assert.IsTrue(a.IsNull (),"#C08");98 Assert.IsTrue(a.IsNull,"#C08"); 99 99 } 100 100 … … 103 103 { 104 104 AprAllocator a = AprAllocator.Create(); 105 Assert.IsFalse(a.IsNull (),"#D000001");105 Assert.IsFalse(a.IsNull,"#D000001"); 106 106 107 107 int adrChange = 0; … … 123 123 124 124 a.Destroy(); 125 Assert.IsTrue(a.IsNull (),"#D000003");125 Assert.IsTrue(a.IsNull,"#D000003"); 126 126 } 127 127 … … 130 130 { 131 131 AprAllocator a = AprAllocator.Create(); 132 Assert.IsFalse(a.IsNull (),"#E000001");132 Assert.IsFalse(a.IsNull,"#E000001"); 133 133 a.MaxFree = 81920; 134 134 … … 151 151 152 152 a.Destroy(); 153 Assert.IsTrue(a.IsNull (),"#E000003");153 Assert.IsTrue(a.IsNull,"#E000003"); 154 154 } 155 155 } trunk/AprSharp/test/src/AprMutexTest.cs
r5 r9 29 29 { 30 30 AprPool p = AprPool.Create(); 31 Assert.IsFalse(p.IsNull (),"#A01");31 Assert.IsFalse(p.IsNull,"#A01"); 32 32 33 33 AprThreadMutex m = new AprThreadMutex(); 34 Assert.IsTrue(m.IsNull (),"#A02");34 Assert.IsTrue(m.IsNull,"#A02"); 35 35 36 36 m = AprThreadMutex.Create(p); 37 Assert.IsFalse(m.IsNull (),"#A03");37 Assert.IsFalse(m.IsNull,"#A03"); 38 38 Assert.AreEqual(((IntPtr)p).ToInt32(),((IntPtr)(m.Pool)).ToInt32(),"#A04"); 39 39 40 40 m.Destroy(); 41 Assert.IsTrue(m.IsNull (),"#A05");41 Assert.IsTrue(m.IsNull,"#A05"); 42 42 43 43 p.Destroy(); 44 Assert.IsTrue(p.IsNull (),"#A06");44 Assert.IsTrue(p.IsNull,"#A06"); 45 45 } 46 46 … … 49 49 { 50 50 AprPool p = AprPool.Create(); 51 Assert.IsFalse(p.IsNull (),"#B01");51 Assert.IsFalse(p.IsNull,"#B01"); 52 52 53 53 AprThreadMutex m = AprThreadMutex.Create(p); 54 Assert.IsFalse(m.IsNull (),"#B02");54 Assert.IsFalse(m.IsNull,"#B02"); 55 55 Assert.AreEqual(((IntPtr)p).ToInt32(),((IntPtr)(m.Pool)).ToInt32(),"#B03"); 56 56 … … 67 67 68 68 p.Destroy(); 69 Assert.IsTrue(p.IsNull (),"#A06");69 Assert.IsTrue(p.IsNull,"#A06"); 70 70 } 71 71 … … 74 74 { 75 75 AprAllocator a = AprAllocator.Create(); 76 Assert.IsFalse(a.IsNull (),"#C01");76 Assert.IsFalse(a.IsNull,"#C01"); 77 77 78 78 AprPool p = AprPool.Create(a); 79 Assert.IsFalse(p.IsNull (),"#C02");79 Assert.IsFalse(p.IsNull,"#C02"); 80 80 Assert.AreEqual(((IntPtr)a).ToInt32(),((IntPtr)(p.Allocator)).ToInt32(),"#C03"); 81 81 … … 84 84 85 85 AprThreadMutex m = AprThreadMutex.Create(p); 86 Assert.IsFalse(m.IsNull (),"#C05");86 Assert.IsFalse(m.IsNull,"#C05"); 87 87 Assert.AreEqual(((IntPtr)p).ToInt32(),((IntPtr)(m.Pool)).ToInt32(),"#C06"); 88 88 … … 91 91 92 92 p.Destroy(); 93 Assert.IsTrue(p.IsNull (),"#C08");93 Assert.IsTrue(p.IsNull,"#C08"); 94 94 } 95 95 } trunk/AprSharp/test/src/AprPoolTest.cs
r5 r9 30 30 { 31 31 AprPool p = new AprPool(); 32 Assert.IsTrue(p.IsNull (),"#A01");33 34 p = AprPool.Create(); 35 Assert.IsFalse(p.IsNull (),"#A02");36 37 p.Destroy(); 38 Assert.IsTrue(p.IsNull (),"#A03");32 Assert.IsTrue(p.IsNull,"#A01"); 33 34 p = AprPool.Create(); 35 Assert.IsFalse(p.IsNull,"#A02"); 36 37 p.Destroy(); 38 Assert.IsTrue(p.IsNull,"#A03"); 39 39 } 40 40 … … 43 43 { 44 44 AprPool p = new AprPool(); 45 Assert.IsTrue(p.IsNull (),"#B01");46 47 p = AprPool.Create(); 48 Assert.IsFalse(p.IsNull (),"#B02");45 Assert.IsTrue(p.IsNull,"#B01"); 46 47 p = AprPool.Create(); 48 Assert.IsFalse(p.IsNull,"#B02"); 49 49 50 50 AprPool sp = AprPool.Create(p); 51 Assert.IsFalse(sp.IsNull (),"#B03");51 Assert.IsFalse(sp.IsNull,"#B03"); 52 52 Assert.AreEqual(((IntPtr)p).ToInt32(),((IntPtr)(sp.Parent)).ToInt32(),"#B04"); 53 53 54 54 sp.Destroy(); 55 Assert.IsTrue(sp.IsNull (),"#B05");56 57 p.Destroy(); 58 Assert.IsTrue(p.IsNull (),"#B06");55 Assert.IsTrue(sp.IsNull,"#B05"); 56 57 p.Destroy(); 58 Assert.IsTrue(p.IsNull,"#B06"); 59 59 } 60 60 … … 63 63 { 64 64 AprAllocator a = AprAllocator.Create(); 65 Assert.IsFalse(a.IsNull (),"#C01");65 Assert.IsFalse(a.IsNull,"#C01"); 66 66 67 67 AprPool p = AprPool.Create(a); 68 Assert.IsFalse(p.IsNull (),"#C02");68 Assert.IsFalse(p.IsNull,"#C02"); 69 69 Assert.AreEqual(((IntPtr)a).ToInt32(),((IntPtr)(p.Allocator)).ToInt32(),"#C03"); 70 70 … … 73 73 74 74 p.Destroy(); 75 Assert.IsTrue(p.IsNull (),"#C05");75 Assert.IsTrue(p.IsNull,"#C05"); 76 76 } 77 77 … … 80 80 { 81 81 AprPool p = new AprPool(); 82 Assert.IsTrue(p.IsNull (),"#D01");83 84 p = AprPool.Create(); 85 Assert.IsFalse(p.IsNull (),"#D02");82 Assert.IsTrue(p.IsNull,"#D01"); 83 84 p = AprPool.Create(); 85 Assert.IsFalse(p.IsNull,"#D02"); 86 86 87 87 AprAllocator a = AprAllocator.Create(); 88 Assert.IsFalse(a.IsNull (),"#D03");88 Assert.IsFalse(a.IsNull,"#D03"); 89 89 90 90 AprPool sp = AprPool.Create(p,a); 91 Assert.IsFalse(sp.IsNull (),"#D04");91 Assert.IsFalse(sp.IsNull,"#D04"); 92 92 Assert.AreEqual(((IntPtr)p).ToInt32(),((IntPtr)(sp.Parent)).ToInt32(),"#D05"); 93 93 Assert.AreEqual(((IntPtr)a).ToInt32(),((IntPtr)(sp.Allocator)).ToInt32(),"#D06"); … … 97 97 98 98 sp.Destroy(); 99 Assert.IsTrue(sp.IsNull (),"#D08");100 101 p.Destroy(); 102 Assert.IsTrue(p.IsNull (),"#D09");99 Assert.IsTrue(sp.IsNull,"#D08"); 100 101 p.Destroy(); 102 Assert.IsTrue(p.IsNull,"#D09"); 103 103 } 104 104 … … 107 107 { 108 108 AprPool p = new AprPool(); 109 Assert.IsTrue(p.IsNull (),"#E01");110 111 p = AprPool.Create(); 112 Assert.IsFalse(p.IsNull (),"#E02");109 Assert.IsTrue(p.IsNull,"#E01"); 110 111 p = AprPool.Create(); 112 Assert.IsFalse(p.IsNull,"#E02"); 113 113 114 114 Assert.IsTrue(p.Alloc(128).ToInt32() != 0,"#E03"); … … 124 124 125 125 p.Destroy(); 126 Assert.IsTrue(p.IsNull (),"#E13");126 Assert.IsTrue(p.IsNull,"#E13"); 127 127 } 128 128 … … 131 131 { 132 132 AprPool p = new AprPool(); 133 Assert.IsTrue(p.IsNull (),"#F01");134 135 p = AprPool.Create(); 136 Assert.IsFalse(p.IsNull (),"#F02");133 Assert.IsTrue(p.IsNull,"#F01"); 134 135 p = AprPool.Create(); 136 Assert.IsFalse(p.IsNull,"#F02"); 137 137 138 138 IntPtr m = p.CAlloc(256); … … 141 141 142 142 p.Destroy(); 143 Assert.IsTrue(p.IsNull (),"#F04");143 Assert.IsTrue(p.IsNull,"#F04"); 144 144 } 145 145 … … 148 148 { 149 149 AprPool p = new AprPool(); 150 Assert.IsTrue(p.IsNull (),"#G000001");151 152 p = AprPool.Create(); 153 Assert.IsFalse(p.IsNull (),"#G000002");150 Assert.IsTrue(p.IsNull,"#G000001"); 151 152 p = AprPool.Create(); 153 Assert.IsFalse(p.IsNull,"#G000002"); 154 154 155 155 for(int i=24;i<4096;i+=24) … … 159 159 160 160 p.Destroy(); 161 Assert.IsTrue(p.IsNull (),"#G000004");161 Assert.IsTrue(p.IsNull,"#G000004"); 162 162 } 163 163 … … 166 166 { 167 167 AprPool p = new AprPool(); 168 Assert.IsTrue(p.IsNull (),"#H000001");169 170 p = AprPool.Create(); 171 Assert.IsFalse(p.IsNull (),"#H000002");168 Assert.IsTrue(p.IsNull,"#H000001"); 169 170 p = AprPool.Create(); 171 Assert.IsFalse(p.IsNull,"#H000002"); 172 172 173 173 for(int i=24;i<4096;i+=24) … … 180 180 181 181 p.Destroy(); 182 Assert.IsTrue(p.IsNull (),"#H000004");182 Assert.IsTrue(p.IsNull,"#H000004"); 183 183 } 184 184 … … 187 187 { 188 188 AprPool p = AprPool.Create(); 189 Assert.IsFalse(p.IsNull (),"#I01");189 Assert.IsFalse(p.IsNull,"#I01"); 190 190 191 191 AprPool sp = AprPool.Create(p); 192 Assert.IsFalse(sp.IsNull (),"#I02");192 Assert.IsFalse(sp.IsNull,"#I02"); 193 193 Assert.AreEqual(((IntPtr)p).ToInt32(),((IntPtr)(sp.Parent)).ToInt32(),"#I03"); 194 194 195 195 AprPool ssp = AprPool.Create(sp); 196 Assert.IsFalse(ssp.IsNull (),"#I05");196 Assert.IsFalse(ssp.IsNull,"#I05"); 197 197 Assert.AreEqual(((IntPtr)sp).ToInt32(),((IntPtr)(ssp.Parent)).ToInt32(),"#I06"); 198 198 … … 205 205 206 206 p.Destroy(); 207 Assert.IsTrue(p.IsNull (),"#I14");207 Assert.IsTrue(p.IsNull,"#I14"); 208 208 } 209 209 trunk/AprSharp/test/src/AprTest.prjx
r5 r9 5 5 <File name="./AprAllocatorTest.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> 6 6 <File name="./AprMutexTest.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> 7 <File name="./AprTimeTest.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> 7 8 </Contents> 8 9 <References>