lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r805612 - /incubator/lucene.net/trunk/C#/src/Test/Util/Cache/TestSimpleLRUCache.cs
Date Tue, 18 Aug 2009 22:41:47 GMT
Author: digy
Date: Tue Aug 18 22:41:47 2009
New Revision: 805612

URL: http://svn.apache.org/viewvc?rev=805612&view=rev
Log:
LUCENENET-190 TestSimpleLRUCache

Modified:
    incubator/lucene.net/trunk/C#/src/Test/Util/Cache/TestSimpleLRUCache.cs

Modified: incubator/lucene.net/trunk/C#/src/Test/Util/Cache/TestSimpleLRUCache.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Util/Cache/TestSimpleLRUCache.cs?rev=805612&r1=805611&r2=805612&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Util/Cache/TestSimpleLRUCache.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Util/Cache/TestSimpleLRUCache.cs Tue Aug 18 22:41:47
2009
@@ -67,5 +67,25 @@
                 Assert.IsNotNull(cache.Get(i));
             }
         }
+
+        [Test]
+        public void TestLRUCache2()
+        {
+            SimpleLRUCache cache = new SimpleLRUCache(3);
+                                                        //Item=>LastAccessTime
+            cache.Put("a", "a");                        //a=>1
+            cache.Put("b", "b");                        //b=>2
+            cache.Put("c", "c");                        //c=>3
+            Assert.IsNotNull(cache.Get("a"), "DBG1");   //a=>4
+            Assert.IsNotNull(cache.Get("b"), "DBG2");   //b=>5
+            Assert.IsNotNull(cache.Get("c"), "DBG3");   //c=>6
+            cache.Put("d", "d");                        //d=>7 ,remove a
+            Assert.IsNull(cache.Get("a"), "DBG4");      //a is removed already
+            Assert.IsNotNull(cache.Get("c"), "DBG5");   //c=>8
+            cache.Put("e", "e");                        //e=>9 ,remove b
+            cache.Put("f", "f");                        //f=>10 ,remove d
+            Assert.IsNotNull(cache.Get("c"), "DBG6");   //c=>11
+                                                        //final cache: e=>9,f=>10,c=>11
+        }
     }
 }



Mime
View raw message