private void Run(EqualityUnit <SearchData> equalityUnit) { EqualityUtil.RunAll( (x, y) => x == y, (x, y) => x != y, equalityUnit); }
public void Wrap() { Run(EqualityUnit .Create(new SearchData("world", Path.Forward, true)) .WithEqualValues(new SearchData("world", Path.Forward, true)) .WithNotEqualValues(new SearchData("world", Path.Forward, false))); }
public void Pattern() { Run(EqualityUnit .Create(new SearchData("world", Path.Forward, true)) .WithEqualValues(new SearchData("world", Path.Forward, true)) .WithNotEqualValues(new SearchData("hello", Path.Forward, true))); }
public void IgnoreCase() { Run(EqualityUnit .Create(new CharSpan("big dog", 0, 3, CharComparer.IgnoreCase)) .WithEqualValues(new CharSpan("a BIG dog", 2, 3, CharComparer.IgnoreCase)) .WithNotEqualValues(new CharSpan("other", CharComparer.IgnoreCase))); }
void Run(EqualityUnit <SnapshotLineRange> equalityUnit) { EqualityUtil.RunAll( (x, y) => x == y, (x, y) => x != y, equalityUnit); }
public void DifferentStringSameValue() { Run(EqualityUnit .Create(new CharSpan("big dog", 0, 3, CharComparer.Exact)) .WithEqualValues(new CharSpan("a big dog", 2, 3, CharComparer.Exact)) .WithNotEqualValues(new CharSpan("other", CharComparer.Exact))); }
public void Paths() { Run(EqualityUnit .Create(new SearchData("world", SearchPath.Forward, true)) .WithEqualValues(new SearchData("world", SearchPath.Forward, true)) .WithNotEqualValues(new SearchData("world", SearchPath.Backward, true))); }
public void SameString() { var data = "big dog"; Run(EqualityUnit .Create(new CharSpan(data, CharComparer.Exact)) .WithEqualValues(new CharSpan(data, CharComparer.Exact)) .WithNotEqualValues(new CharSpan("other", CharComparer.Exact))); }
public void Test2() { var equalityUnit = EqualityUnit .Create(new LineRange(2, 3)) .WithEqualValues(new LineRange(2, 3)) .WithNotEqualValues(new LineRange(2, 1), new LineRange(1, 3)); Run(equalityUnit); }
public void Simple() { Create("cat", "dog", "fish"); var equalityUnit = EqualityUnit .Create(_textBuffer.GetLineRange(1)) .WithEqualValues(_textBuffer.GetLineRange(1)) .WithNotEqualValues(_textBuffer.GetLineRange(1, 2), _textBuffer.GetLineRange(2)); Run(equalityUnit); }
public void DifferentSnapshots() { Create("cat", "dog", "fish"); var otherTextBuffer = CreateTextBuffer("cat", "dog", "fish"); var equalityUnit = EqualityUnit .Create(_textBuffer.GetLineRange(1)) .WithEqualValues(_textBuffer.GetLineRange(1)) .WithNotEqualValues(otherTextBuffer.GetLineRange(1)); Run(equalityUnit); }
public void Equality_AlternatesAreEqual() { foreach (var pair in KeyInputUtil.AlternateKeyInputPairList) { var unit = EqualityUnit.Create(pair.Item1).WithEqualValues(pair.Item2).WithNotEqualValues(KeyInputUtil.VimKeyToKeyInput(VimKey.Colon)); EqualityUtil.RunAll( (x, y) => x == y, (x, y) => x != y, values: unit); } }
public void Equality_ControlLetterIsCaseInsensitive() { var unit = EqualityUnit.Create(KeyInputUtil.CharWithControlToKeyInput('a')) .WithEqualValues(KeyInputUtil.CharWithControlToKeyInput('A')) .WithNotEqualValues(KeyInputUtil.CharToKeyInput('a')); EqualityUtil.RunAll( (x, y) => x == y, (x, y) => x != y, values: unit); }
public void Equality_Operator() { Create("cat", "dog"); EqualityUtil.RunAll( (left, right) => left == right, (left, right) => left != right, false, false, EqualityUnit.Create(new CharacterSpan(_textBuffer.GetPoint(0), 1, 2)) .WithEqualValues(new CharacterSpan(_textBuffer.GetPoint(0), 1, 2)) .WithNotEqualValues(new CharacterSpan(_textBuffer.GetPoint(1), 1, 2))); }
public void Equality() { EqualityUtil.RunAll( (left, right) => left == right, (left, right) => left != right, false, true, EqualityUnit.Create(CreateOne('a')).WithEqualValues(CreateOne('a')), EqualityUnit.Create(CreateOne('a')).WithNotEqualValues(CreateOne('b')), EqualityUnit.Create(CreateOne('a')).WithEqualValues(CreateMany('a')), EqualityUnit.Create(CreateOne('D')).WithEqualValues(KeyNotationUtil.StringToKeyInputSet("D")), EqualityUnit.Create(new KeyInputSet(KeyInputUtil.CharToKeyInput('D'))).WithEqualValues(KeyNotationUtil.StringToKeyInputSet("D"))); }
public void Equality5() { var values = EqualityUnit .Create(KeyInputUtil.CharToKeyInput('c')) .WithEqualValues(KeyInputUtil.CharToKeyInput('c')) .WithNotEqualValues(KeyInputUtil.CharToKeyInput('d')) .WithNotEqualValues(KeyInputUtil.CharWithControlToKeyInput('c')); EqualityUtil.RunAll( (x, y) => x == y, (x, y) => x != y, values: values); }
public void SameBuffer() { var textBuffer = CreateTextBuffer("cat", "dog"); EqualityUnit .Create(textBuffer.GetColumnFromPosition(0)) .WithEqualValues(textBuffer.GetColumnFromPosition(0)) .WithNotEqualValues( textBuffer.GetColumn(lineNumber: 1, columnNumber: 0), textBuffer.GetColumnFromPosition(1), textBuffer.GetColumnFromPosition(2)) .RunAll( compEqualsOperator: (x, y) => x == y, compNotEqualsOperator: (x, y) => x != y); }
public void DifferentBuffer() { var textBuffer1 = CreateTextBuffer("cat", "dog"); var textBuffer2 = CreateTextBuffer("cat", "dog"); EqualityUnit .Create(textBuffer1.GetColumnFromPosition(0)) .WithEqualValues(textBuffer1.GetColumnFromPosition(0)) .WithNotEqualValues( textBuffer2.GetColumnFromPosition(0), textBuffer1.GetColumnFromPosition(1), textBuffer1.GetColumnFromPosition(2)) .RunAll( compEqualsOperator: (x, y) => x == y, compNotEqualsOperator: (x, y) => x != y); }
public void SameBufferSurrogatePair() { const string alien = "\U0001F47D"; // 👽 var textBuffer = CreateTextBuffer($"{alien}{alien}cat", "dog"); EqualityUnit .Create(textBuffer.GetColumnFromPosition(0)) .WithEqualValues( textBuffer.GetColumnFromPosition(0), textBuffer.GetColumnFromPosition(1)) .WithNotEqualValues( textBuffer.GetColumnFromPosition(2), textBuffer.GetColumnFromPosition(3), textBuffer.GetColumnFromPosition(4)) .RunAll( compEqualsOperator: (x, y) => x == y, compNotEqualsOperator: (x, y) => x != y); }
private void Run(EqualityUnit <CharSpan> equalityUnit) { EqualityUtil.RunAll(equalityUnit); }
private void Run <T>(T value, T otherValue) { EqualityUtil.RunAll(EqualityUnit.Create(value) .WithEqualValues(value) .WithNotEqualValues(otherValue)); }