Mercurial > hg4j
diff test/org/tmatesoft/hg/test/TestAuxUtilities.java @ 448:2e402c12ebc6 smartgit3
Issue 31: Revlog#walk() fails with AIOOBE when start > 0
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Wed, 06 Jun 2012 21:23:57 +0200 |
parents | d0e5dc3cae6e |
children | 7bcfbc255f48 |
line wrap: on
line diff
--- a/test/org/tmatesoft/hg/test/TestAuxUtilities.java Wed Jun 06 20:11:17 2012 +0200 +++ b/test/org/tmatesoft/hg/test/TestAuxUtilities.java Wed Jun 06 21:23:57 2012 +0200 @@ -245,28 +245,35 @@ } }); class ParentInspectorCheck implements HgDataFile.ParentInspector { - private int i; + private int i, c; private Nodeid[] all; + private final int start; public ParentInspectorCheck(int start, int total) { - i = start; + this.start = start; + i = start; // revision index being iterated + c = 0; // index/counter of visited revisions all = new Nodeid[total]; } public void next(int localRevision, Nodeid revision, int parent1, int parent2, Nodeid nidParent1, Nodeid nidParent2) { Assert.assertEquals(i++, localRevision); - all[localRevision] = revision; + all[c++] = revision; Assert.assertNotNull(revision); Assert.assertFalse(localRevision == 0 && (parent1 != -1 || parent2 != -1)); Assert.assertFalse(localRevision > 0 && parent1 == -1 && parent2 == -1); if (parent1 != -1) { Assert.assertNotNull(nidParent1); - // deliberately ==, not asserEquals to ensure same instance - Assert.assertTrue(nidParent1 == all[parent1]); + if (parent1 >= start) { + // deliberately ==, not asserEquals to ensure same instance + Assert.assertTrue(nidParent1 == all[parent1-start]); + } } if (parent2 != -1) { Assert.assertNotNull(nidParent2); - Assert.assertTrue(nidParent2 == all[parent2]); + if (parent2 >= start) { + Assert.assertTrue(nidParent2 == all[parent2-start]); + } } } };