Beispiel #1
0
        public void FirstStringEmptyTest()
        {
            var s              = "12345678";
            var correlater     = new HuntSzymanskiCorrelater <char>();
            var expectedResult = new CorrelaterResult <char>(s.Length, "\0\0\0\0\0\0\0\0".ToCharArray(), s.ToCharArray());

            correlater.AssertComparision(string.Empty, s, expectedResult);
        }
Beispiel #2
0
        public void SameStringTest()
        {
            var s              = "abcdefg";
            var correlater     = new HuntSzymanskiCorrelater <char>();
            var expectedResult = new CorrelaterResult <char>(0, s.ToCharArray(), s.ToCharArray());

            correlater.AssertComparision(s, s, expectedResult);
        }
Beispiel #3
0
        public void TotallyDifferentStringsTest()
        {
            var s1             = "abcdefghij";
            var s2             = "12345678";
            var correlater     = new HuntSzymanskiCorrelater <char>();
            var expectedResult = new CorrelaterResult <char>(s1.Length + s2.Length, "\0\0\0\0\0\0\0\0abcdefghij".ToCharArray(), "12345678\0\0\0\0\0\0\0\0\0\0".ToCharArray());

            correlater.AssertComparision(s1, s2, expectedResult);
        }
Beispiel #4
0
        public void DoubleCharTest2()
        {
            var s = "123421";

            var correlater     = new HuntSzymanskiCorrelater <char>();
            var expectedResult = new CorrelaterResult <char>(0, s.ToCharArray(), s.ToCharArray());

            correlater.AssertComparision(s, s, expectedResult);
        }
Beispiel #5
0
        public void OnProgressUpdatesHappensRightNumberOfTimes()
        {
            var s1 = "abcdefghij";
            var s2 = "abcd6fghij";

            var correlater = new HuntSzymanskiCorrelater <char>();

            correlater.AssertProgressUpdateWasCalledRightNumberOfTimes(s1.ToCharArray(), s2.ToCharArray(), 10);
        }
Beispiel #6
0
        public void DifferentStartCharTest()
        {
            var s1 = "12ab";
            var s2 = "34ab";

            var correlater     = new HuntSzymanskiCorrelater <char>();
            var expectedResult = new CorrelaterResult <char>(4, "\0\012ab".ToCharArray(), "34\0\0ab".ToCharArray());

            correlater.AssertComparision(s1, s2, expectedResult);
        }
Beispiel #7
0
        public void OneDifferentCharTest()
        {
            var s1 = "abc1efg";
            var s2 = "abc2efg";

            var correlater     = new HuntSzymanskiCorrelater <char>();
            var expectedResult = new CorrelaterResult <char>(2, "abc\01efg".ToCharArray(), "abc2\0efg".ToCharArray());

            correlater.AssertComparision(s1, s2, expectedResult);
        }
Beispiel #8
0
        private void SetCorrelator()
        {
            ICorrelater <char> correlator;

            switch (selectCorrelatorComboBox.Text)
            {
            case nameof(DamerauLevenshteinCorrelater <char>):
                correlator = new DamerauLevenshteinCorrelater <char>(10, 12, 7, 7);
                break;

            case nameof(DynamicLcsCorrelater <char>):
                correlator = new DynamicLcsCorrelater <char>();
                break;

            case nameof(MyersAlgorithmCorrelater <char>):
                correlator = new MyersAlgorithmCorrelater <char>();
                break;

            case nameof(PatienceDiffCorrelater <char>):
                correlator = new PatienceDiffCorrelater <char>();
                break;

            case nameof(HuntSzymanskiCorrelater <char>):
                correlator = new HuntSzymanskiCorrelater <char>();
                break;

            case nameof(NullCorrelator <char>):
                correlator = new NullCorrelator <char>();
                break;

            case nameof(LevenshteinCorrelater <char>):
            default:
                correlator = new LevenshteinCorrelater <char>(10, 7, 7);
                break;
            }

            if (slowCompareCheclCheckBox.Checked)
            {
                correlator = new SlowCorrelater <char>(correlator, 500);
            }
            if (splitToChunksCheckBox.Checked)
            {
                correlator = new SplitToChunksCorrelaterWrapper <char>(correlator, 10);
            }
            if (IgnoreIdenticalBeginningAndEndCorrelaterWrapperCheckBox.Checked)
            {
                correlator = new IgnoreIdenticalBeginningAndEndCorrelaterWrapper <char>(correlator);
            }
            if (SplitByPatienceWrapperCheckBox.Checked)
            {
                correlator = new SplitByPatienceAlgorithmWrapper <char>(correlator);
            }

            stringCorrelatorUserControl1.Correlater = correlator;
        }
Beispiel #9
0
        public void CancellationToeknWorks()
        {
            var correlater = new HuntSzymanskiCorrelater <char>();

            correlater.AsseertCancellationTokenWorks();
        }