Skip to content

Commit

Permalink
added test for resize()
Browse files Browse the repository at this point in the history
  • Loading branch information
belaban committed Dec 16, 2010
1 parent 767b88b commit b7c4cfa
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/org/jgroups/util/RetransmitTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}


Expand Down
12 changes: 12 additions & 0 deletions tests/junit-functional/org/jgroups/tests/RetransmitTableTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}


Expand Down

0 comments on commit b7c4cfa

Please sign in to comment.