Permalink
Browse files

added test for resize()

  • Loading branch information...
1 parent 767b88b commit b7c4cfa5a83a056a5d52c6d3f4b30d0adf405b98 Bela Ban committed Dec 16, 2010
@@ -420,7 +420,7 @@ protected int computeIndex(long seqno) {
int diff=(int)(seqno - offset);
if(diff < 0)
return diff;
- return (int)(seqno - offset) % msgs_per_row;
+ return diff % msgs_per_row;
}
@@ -175,6 +175,18 @@ public void testResizeWithPurge2() {
table.purge(43);
addAndGet(table, 52, "hello-52");
+ assert table.get(43) == null;
+
+ for(long i=44; i < 50; i++) {
+ Message msg=table.get(i);
+ assert msg != null && msg.getObject().equals("hello-" + i);
+ }
+
+ assert table.get(50) == null;
+ assert table.get(51) == null;
+ Message msg=table.get(52);
+ assert msg != null && msg.getObject().equals("hello-52");
+ assert table.get(53) == null;
}

0 comments on commit b7c4cfa

Please sign in to comment.