diff options
author | Chris Aniszczyk <caniszczyk@gmail.com> | 2011-03-19 12:32:19 -0400 |
---|---|---|
committer | Code Review <codereview-daemon@eclipse.org> | 2011-03-19 12:32:19 -0400 |
commit | 9cde331c2b707a0a30296ac36ddc0875db254dd6 (patch) | |
tree | 661ed0523541a89ff325adb6c27d668a3da30377 /org.eclipse.jgit.test | |
parent | 817d1a334bf158ffcb2c4248813196dfdd578215 (diff) | |
parent | 62fe7c7313e4e7a4339fe9df3a9dc2335461df29 (diff) | |
download | jgit-9cde331c2b707a0a30296ac36ddc0875db254dd6.tar.gz jgit-9cde331c2b707a0a30296ac36ddc0875db254dd6.zip |
Merge "BlockList: Micro-optimize appending from another BlockList"
Diffstat (limited to 'org.eclipse.jgit.test')
-rw-r--r-- | org.eclipse.jgit.test/tst/org/eclipse/jgit/util/BlockListTest.java | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/BlockListTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/BlockListTest.java index 7151af156a..8b042bd67c 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/BlockListTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/BlockListTest.java @@ -282,6 +282,24 @@ public class BlockListTest { } @Test + public void testAddAllFromOtherList() { + BlockList<Integer> src = new BlockList<Integer>(4); + int cnt = BlockList.BLOCK_SIZE * 2; + + for (int i = 0; i < cnt; i++) + src.add(Integer.valueOf(42 + i)); + src.add(Integer.valueOf(1)); + + BlockList<Integer> dst = new BlockList<Integer>(4); + dst.add(Integer.valueOf(255)); + dst.addAll(src); + assertEquals(cnt + 2, dst.size()); + for (int i = 0; i < cnt; i++) + assertEquals(Integer.valueOf(42 + i), dst.get(i + 1)); + assertEquals(Integer.valueOf(1), dst.get(dst.size() - 1)); + } + + @Test public void testFastIterator() { BlockList<Integer> list = new BlockList<Integer>(4); int cnt = BlockList.BLOCK_SIZE * 3; |