directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r637353 - /directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmDupsCursorTest.java
Date Sat, 15 Mar 2008 04:50:22 GMT
Author: akarasulu
Date: Fri Mar 14 21:50:19 2008
New Revision: 637353

URL: http://svn.apache.org/viewvc?rev=637353&view=rev
Log:
more tests

Modified:
    directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmDupsCursorTest.java

Modified: directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmDupsCursorTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmDupsCursorTest.java?rev=637353&r1=637352&r2=637353&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmDupsCursorTest.java
(original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmDupsCursorTest.java
Fri Mar 14 21:50:19 2008
@@ -206,9 +206,16 @@
     @Test
     public void testFirstLastUnderDupLimit() throws Exception
     {
-        for ( int ii = 0; ii < SIZE-1; ii++ )
+        for ( int ii = 0; ii < SIZE*2 - 1; ii++ )
         {
-            table.put( ii, ii );
+            if ( ii > 12 && ii < 17 )
+            {
+                table.put( 13, ii );
+            }
+            else
+            {
+                table.put( ii, ii );
+            }
         }
         Cursor<Tuple<Integer,Integer>> cursor = table.cursor();
 
@@ -216,68 +223,151 @@
         while ( cursor.next() )
         {
             Tuple<Integer,Integer> tuple = cursor.get();
-            assertEquals( ii, ( int ) tuple.getKey() );
-            assertEquals( ii, ( int ) tuple.getValue() );
+            if ( ii > 12 && ii < 17 )
+            {
+                assertEquals( 13, ( int ) tuple.getKey() );
+                assertEquals( ii, ( int ) tuple.getValue() );
+            }
+            else
+            {
+                assertEquals( ii, ( int ) tuple.getKey() );
+                assertEquals( ii, ( int ) tuple.getValue() );
+            }
             ii++;
         }
 
-        // now go back to first and traverse all over again
-        cursor.first();
+        cursor.beforeFirst();
         ii = 0;
-        do
+        while ( cursor.next() )
         {
             Tuple<Integer,Integer> tuple = cursor.get();
-            assertEquals( ii, ( int ) tuple.getKey() );
-            assertEquals( ii, ( int ) tuple.getValue() );
+            if ( ii > 12 && ii < 17 )
+            {
+                assertEquals( 13, ( int ) tuple.getKey() );
+                assertEquals( ii, ( int ) tuple.getValue() );
+            }
+            else
+            {
+                assertEquals( ii, ( int ) tuple.getKey() );
+                assertEquals( ii, ( int ) tuple.getValue() );
+            }
             ii++;
         }
-        while ( cursor.next() );
 
         // now go backwards
-        ii = SIZE-2;
+        ii = SIZE*2-2;
         while ( cursor.previous() )
         {
             Tuple<Integer,Integer> tuple = cursor.get();
-            assertEquals( ii, ( int ) tuple.getKey() );
-            assertEquals( ii, ( int ) tuple.getValue() );
+            if ( ii > 12 && ii < 17 )
+            {
+                assertEquals( 13, ( int ) tuple.getKey() );
+                assertEquals( ii, ( int ) tuple.getValue() );
+            }
+            else
+            {
+                assertEquals( ii, ( int ) tuple.getKey() );
+                assertEquals( ii, ( int ) tuple.getValue() );
+            }
             ii--;
         }
 
         // now advance to last and go backwards again
         cursor.afterLast();
-        ii = SIZE-2;
+        ii = SIZE*2-2;
         while ( cursor.previous() )
         {
             Tuple<Integer,Integer> tuple = cursor.get();
-            assertEquals( ii, ( int ) tuple.getKey() );
-            assertEquals( ii, ( int ) tuple.getValue() );
+            if ( ii > 12 && ii < 17 )
+            {
+                assertEquals( 13, ( int ) tuple.getKey() );
+                assertEquals( ii, ( int ) tuple.getValue() );
+            }
+            else
+            {
+                assertEquals( ii, ( int ) tuple.getKey() );
+                assertEquals( ii, ( int ) tuple.getValue() );
+            }
             ii--;
         }
 
         // advance to first then last and go backwards again
         cursor.beforeFirst();
         cursor.afterLast();
-        ii = SIZE-2;
+        ii = SIZE*2-2;
         while ( cursor.previous() )
         {
             Tuple<Integer,Integer> tuple = cursor.get();
-            assertEquals( ii, ( int ) tuple.getKey() );
-            assertEquals( ii, ( int ) tuple.getValue() );
+            if ( ii > 12 && ii < 17 )
+            {
+                assertEquals( 13, ( int ) tuple.getKey() );
+                assertEquals( ii, ( int ) tuple.getValue() );
+            }
+            else
+            {
+                assertEquals( ii, ( int ) tuple.getKey() );
+                assertEquals( ii, ( int ) tuple.getValue() );
+            }
             ii--;
         }
     }
 
 
     @Test
-    public void testLastUnderDupLimit() throws Exception
+    public void testFirstLastOverDupLimit() throws Exception
     {
-        for ( int ii = 0; ii < SIZE-1; ii++ )
+        for ( int ii = 0; ii < SIZE*3-1; ii++ )
         {
             table.put( ii, ii );
         }
         Cursor<Tuple<Integer,Integer>> cursor = table.cursor();
 
-        int ii = SIZE-2;
+        int ii = 0;
+        while ( cursor.next() )
+        {
+            Tuple<Integer,Integer> tuple = cursor.get();
+            assertEquals( ii, ( int ) tuple.getKey() );
+            assertEquals( ii, ( int ) tuple.getValue() );
+            ii++;
+        }
+
+        // now go back to first and traverse all over again
+        cursor.first();
+        ii = 0;
+        do
+        {
+            Tuple<Integer,Integer> tuple = cursor.get();
+            assertEquals( ii, ( int ) tuple.getKey() );
+            assertEquals( ii, ( int ) tuple.getValue() );
+            ii++;
+        }
+        while ( cursor.next() );
+
+        // now go backwards
+        ii = SIZE*3-2;
+        while ( cursor.previous() )
+        {
+            Tuple<Integer,Integer> tuple = cursor.get();
+            assertEquals( ii, ( int ) tuple.getKey() );
+            assertEquals( ii, ( int ) tuple.getValue() );
+            ii--;
+        }
+
+        // now advance to last and go backwards again
+        cursor.afterLast();
+        ii = SIZE*3-2;
+        while ( cursor.previous() )
+        {
+            Tuple<Integer,Integer> tuple = cursor.get();
+            assertEquals( ii, ( int ) tuple.getKey() );
+            assertEquals( ii, ( int ) tuple.getValue() );
+            ii--;
+        }
+
+        // advance to first then last and go backwards again
+        cursor.beforeFirst();
+        cursor.afterLast();
+        ii = SIZE*3-2;
         while ( cursor.previous() )
         {
             Tuple<Integer,Integer> tuple = cursor.get();



Mime
View raw message