comparison test/org/tmatesoft/hg/test/TestAuxUtilities.java @ 552:45751456b471

Annotate file changes through few revisions, walking either direction (old to new and vice versa)
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Wed, 20 Feb 2013 22:23:50 +0100
parents 1ee452f31187
children 154718ae23ed
comparison
equal deleted inserted replaced
551:4ea0351ca878 552:45751456b471
1 /* 1 /*
2 * Copyright (c) 2011-2012 TMate Software Ltd 2 * Copyright (c) 2011-2013 TMate Software Ltd
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by 5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 2 of the License. 6 * the Free Software Foundation; version 2 of the License.
7 * 7 *
29 import org.junit.Rule; 29 import org.junit.Rule;
30 import org.junit.Test; 30 import org.junit.Test;
31 import org.tmatesoft.hg.core.HgCatCommand; 31 import org.tmatesoft.hg.core.HgCatCommand;
32 import org.tmatesoft.hg.core.Nodeid; 32 import org.tmatesoft.hg.core.Nodeid;
33 import org.tmatesoft.hg.internal.ArrayHelper; 33 import org.tmatesoft.hg.internal.ArrayHelper;
34 import org.tmatesoft.hg.internal.IntVector;
34 import org.tmatesoft.hg.internal.PathScope; 35 import org.tmatesoft.hg.internal.PathScope;
35 import org.tmatesoft.hg.internal.RevisionDescendants; 36 import org.tmatesoft.hg.internal.RevisionDescendants;
36 import org.tmatesoft.hg.repo.HgChangelog; 37 import org.tmatesoft.hg.repo.HgChangelog;
37 import org.tmatesoft.hg.repo.HgChangelog.RawChangeset; 38 import org.tmatesoft.hg.repo.HgChangelog.RawChangeset;
38 import org.tmatesoft.hg.repo.HgDataFile; 39 import org.tmatesoft.hg.repo.HgDataFile;
495 // 496 //
496 errorCollector.assertEquals(Unrelated, p2.compareWith(p3)); 497 errorCollector.assertEquals(Unrelated, p2.compareWith(p3));
497 errorCollector.assertEquals(Unrelated, p3.compareWith(p2)); 498 errorCollector.assertEquals(Unrelated, p3.compareWith(p2));
498 } 499 }
499 500
501 @Test
502 public void testIntVector() {
503 IntVector v = new IntVector();
504 v.add(10, 9, 8);
505 v.add(7);
506 errorCollector.assertEquals(4, v.size());
507 v.clear();
508 errorCollector.assertEquals(0, v.size());
509
510 // vector that doesn't grow
511 v = new IntVector(3, 0);
512 v.add(1,2,3);
513 try {
514 v.add(4);
515 errorCollector.fail("This vector instance is not supposed to grow on demand");
516 } catch (UnsupportedOperationException ex) {
517 }
518 v = new IntVector(5, 2);
519 v.add(10,9,8);
520 v.add(7,6);
521 v.add(5,4,3,2,1);
522 errorCollector.assertEquals(10, v.size());
523 // so far so good - grow() works
524 // now, check reverse()
525 v.reverse();
526 for (int i = 0; i < v.size(); i++) {
527 errorCollector.assertEquals(i+1, v.get(i));
528 }
529 }
530
500 531
501 public static void main(String[] args) throws Exception { 532 public static void main(String[] args) throws Exception {
502 new TestAuxUtilities().testRepositoryConfig(); 533 new TestAuxUtilities().testRepositoryConfig();
503 } 534 }
504 } 535 }