public void TestSingleElement() /*throws Exception*/ { IntervalSet s = IntervalSet.Of(99); string expecting = "99"; Assert.AreEqual(s.ToString(), expecting); }
public virtual string ToString(Grammar g) { if (tokenTypeSet == null) { return(""); } string r = tokenTypeSet.ToString(g); return(r); }
public void TestMixedRangesAndElements() /*throws Exception*/ { IntervalSet s = new IntervalSet(); s.Add(1); s.Add('a', 'z'); s.Add('0', '9'); string expecting = "{1, 48..57, 97..122}"; Assert.AreEqual(s.ToString(), expecting); }
public void TestIsolatedElements() /*throws Exception*/ { IntervalSet s = new IntervalSet(); s.Add(1); s.Add('z'); s.Add('\uFFF0'); string expecting = "{1, 122, 65520}"; Assert.AreEqual(s.ToString(), expecting); }
public void TestMergeWithDoubleOverlap() /*throws Exception*/ { IntervalSet s = IntervalSet.Of(1, 10); s.Add(20, 30); s.Add(5, 25); // overlaps two! string expecting = "1..30"; string result = s.ToString(); Assert.AreEqual(result, expecting); }
public void TestMergeOfRangesAndSingleValuesReverse() /*throws Exception*/ { IntervalSet s = IntervalSet.Of(43, 65534); s.Add(42); s.Add(0, 41); string expecting = "0..65534"; string result = s.ToString(); Assert.AreEqual(result, expecting); }
public void TestMergeOfRangesAndSingleValues() /*throws Exception*/ { // {0..41, 42, 43..65534} IntervalSet s = IntervalSet.Of(0, 41); s.Add(42); s.Add(43, 65534); string expecting = "0..65534"; string result = s.ToString(); assertEquals(result, expecting); }
public void TestMergeWhereAdditionMergesThreeExistingIntervals() { IntervalSet s = new IntervalSet(); s.Add(0); s.Add(3); s.Add(5); s.Add(0, 7); String expecting = "0..7"; String result = s.ToString(); Assert.AreEqual(expecting, result); }
public void TestMergeWhereAdditionMergesTwoExistingIntervals() /*throws Exception*/ { // 42, 10, {0..9, 11..41, 43..65534} IntervalSet s = IntervalSet.Of(42); s.Add(10); s.Add(0, 9); s.Add(43, 65534); s.Add(11, 41); string expecting = "0..65534"; string result = s.ToString(); Assert.AreEqual(result, expecting); }
public void TestMixedRangesAndElements() { IntervalSet s = new IntervalSet(); s.Add( 1 ); s.Add( 'a', 'z' ); s.Add( '0', '9' ); string expecting = "{1, 48..57, 97..122}"; Assert.AreEqual( s.ToString(), expecting ); }
public void TestIsolatedElements() { IntervalSet s = new IntervalSet(); s.Add( 1 ); s.Add( 'z' ); s.Add( '\uFFF0' ); string expecting = "{1, 122, 65520}"; Assert.AreEqual( s.ToString(), expecting ); }