示例#1
0
 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)));
 }
示例#2
0
 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)));
 }
示例#3
0
 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)));
 }
示例#4
0
 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)));
 }
示例#6
0
            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)));
            }
示例#7
0
            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);
            }
示例#8
0
            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);
            }
示例#9
0
            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);
            }
示例#10
0
 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);
     }
 }
示例#11
0
        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);
        }
示例#12
0
 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)));
 }
示例#13
0
 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")));
 }
示例#14
0
        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);
        }
示例#15
0
            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);
            }
示例#16
0
            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);
            }
示例#17
0
            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);
            }
示例#18
0
 private void Run <T>(T value, T otherValue)
 {
     EqualityUtil.RunAll(EqualityUnit.Create(value)
                         .WithEqualValues(value)
                         .WithNotEqualValues(otherValue));
 }