diff test/org/tmatesoft/hg/test/TestAuxUtilities.java @ 558:154718ae23ed

Annotate: refactor/reuse range handling code
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Mon, 25 Feb 2013 18:41:44 +0100
parents 45751456b471
children 88afffd39899
line wrap: on
line diff
--- a/test/org/tmatesoft/hg/test/TestAuxUtilities.java	Sun Feb 24 00:11:40 2013 +0100
+++ b/test/org/tmatesoft/hg/test/TestAuxUtilities.java	Mon Feb 25 18:41:44 2013 +0100
@@ -33,6 +33,7 @@
 import org.tmatesoft.hg.internal.ArrayHelper;
 import org.tmatesoft.hg.internal.IntVector;
 import org.tmatesoft.hg.internal.PathScope;
+import org.tmatesoft.hg.internal.RangeSeq;
 import org.tmatesoft.hg.internal.RevisionDescendants;
 import org.tmatesoft.hg.repo.HgChangelog;
 import org.tmatesoft.hg.repo.HgChangelog.RawChangeset;
@@ -528,6 +529,20 @@
 		}
 	}
 	
+	@Test
+	public void testRangeSequence() {
+		RangeSeq rs = new RangeSeq();
+		rs.add(-1, 5, 3);
+		rs.add(-1, 10, 2);
+		rs.add(-1, 15, 3);
+		rs.add(-1, 20, 3);
+		errorCollector.assertFalse(rs.includesTargetLine(4));
+		errorCollector.assertTrue(rs.includesTargetLine(7));
+		errorCollector.assertFalse(rs.includesTargetLine(8));
+		errorCollector.assertTrue(rs.includesTargetLine(10));
+		errorCollector.assertFalse(rs.includesTargetLine(12));
+	}
+	
 	
 	public static void main(String[] args) throws Exception {
 		new TestAuxUtilities().testRepositoryConfig();