public void Difference(char[] expected, char from1, char to1, char from2, char to2) { var range1 = Range <char> .Create(from1, to1); RangeSet <char> set1 = range1; var range2 = Range <char> .Create(from2, to2); RangeSet <char> set2 = range2; Assert.Equal(expected, RangeOperations <char> .Difference(set1, set2).Expand()); Assert.Equal(expected, (set1 ^ set2).Expand()); Assert.Equal(expected, (range1 ^ range2).Expand()); Assert.Equal(expected, (set1 ^ range2).Expand()); Assert.Equal(expected, (range1 ^ set2).Expand()); }
public static RangeSet <T> operator ^(RangeSet <T> left, T right) { return(RangeOperations <T> .Difference(left, new RangeSet <T>(right))); }
public static RangeSet <T> operator ^(T left, RangeSet <T> right) { return(RangeOperations <T> .Difference(new RangeSet <T>(left), right)); }