Differencing\LongestCommonSubsequenceTests.cs (61)
84VerifyMatchingPairs(lcs.GetMatchingPairs(str1, str2), "");
86VerifyEdits(str1, str2, lcs.GetEdits(str1, str2));
88Assert.Equal(0.0, lcs.ComputeDistance(str1, str2));
97VerifyMatchingPairs(lcs.GetMatchingPairs(str1, str2), "");
99VerifyEdits(str1, str2, lcs.GetEdits(str1, str2));
101Assert.Equal(1.0, lcs.ComputeDistance(str1, str2));
110VerifyMatchingPairs(lcs.GetMatchingPairs(str1, str2), "[2,5][1,4][0,3]");
112VerifyEdits(str1, str2, lcs.GetEdits(str1, str2));
114Assert.Equal(0.5, lcs.ComputeDistance(str1, str2));
123VerifyMatchingPairs(lcs.GetMatchingPairs(str1, str2), "[2,2][1,1][0,0]");
125VerifyEdits(str1, str2, lcs.GetEdits(str1, str2));
127Assert.Equal(0.5, lcs.ComputeDistance(str1, str2));
136VerifyMatchingPairs(lcs.GetMatchingPairs(str1, str2), "[2,4][1,1][0,0]");
138VerifyEdits(str1, str2, lcs.GetEdits(str1, str2));
140Assert.Equal(0.4, lcs.ComputeDistance(str1, str2));
149VerifyMatchingPairs(lcs.GetMatchingPairs(str1, str2), "");
151VerifyEdits(str1, str2, lcs.GetEdits(str1, str2));
153Assert.Equal(1.0, lcs.ComputeDistance(str1, str2));
162VerifyMatchingPairs(lcs.GetMatchingPairs(str1, str2), "[2,0]");
164VerifyEdits(str1, str2, lcs.GetEdits(str1, str2));
166Assert.Equal(0.75, lcs.ComputeDistance(str1, str2));
175VerifyMatchingPairs(lcs.GetMatchingPairs(str1, str2), "[1,1][0,0]");
177VerifyEdits(str1, str2, lcs.GetEdits(str1, str2));
179Assert.Equal(0.5, lcs.ComputeDistance(str1, str2));
188VerifyMatchingPairs(lcs.GetMatchingPairs(str1, str2), "[4,2][3,1][0,0]");
190VerifyEdits(str1, str2, lcs.GetEdits(str1, str2));
192Assert.Equal(0.4, lcs.ComputeDistance(str1, str2));
201VerifyMatchingPairs(lcs.GetMatchingPairs(str1, str2), "");
203VerifyEdits(str1, str2, lcs.GetEdits(str1, str2));
205Assert.Equal(1.0, lcs.ComputeDistance(str1, str2));
214VerifyMatchingPairs(lcs.GetMatchingPairs(str1, str2), "[3,2]");
216VerifyEdits(str1, str2, lcs.GetEdits(str1, str2));
218Assert.Equal(0.75, lcs.ComputeDistance(str1, str2));
227VerifyMatchingPairs(lcs.GetMatchingPairs(str1, str2), "[1,1][0,0]");
229VerifyEdits(str1, str2, lcs.GetEdits(str1, str2));
231Assert.Equal(0.6, lcs.ComputeDistance(str1, str2));
240VerifyMatchingPairs(lcs.GetMatchingPairs(str1, str2), "[4,3][3,2][0,0]");
242VerifyEdits(str1, str2, lcs.GetEdits(str1, str2));
244Assert.Equal(0.4, lcs.ComputeDistance(str1, str2));
253VerifyMatchingPairs(lcs.GetMatchingPairs(str1, str2), "[5,4][4,3][1,2][0,0]");
255VerifyEdits(str1, str2, lcs.GetEdits(str1, str2));
257Assert.Equal(0.556, lcs.ComputeDistance(str1, str2), precision: 3);
266VerifyMatchingPairs(lcs.GetMatchingPairs(str1, str2), "[7,4][5,3][3,1][0,0]");
268VerifyEdits(str1, str2, lcs.GetEdits(str1, str2));
270Assert.Equal(0.6, lcs.ComputeDistance(str1, str2));
282VerifyMatchingPairs(lcs.GetMatchingPairs(str1, str2), "[6,4][4,3][3,2][1,1]");
284VerifyEdits(str1, str2, lcs.GetEdits(str1, str2));
286Assert.Equal(0.429, lcs.ComputeDistance(str1, str2), precision: 3);
298VerifyMatchingPairs(lcs.GetMatchingPairs(str1, str2), "[0,1]");
300VerifyEdits(str1, str2, lcs.GetEdits(str1, str2));
302Assert.Equal(0.5, lcs.ComputeDistance(str1, str2));
322Assert.Equal(0.900, lcs.ComputeDistance(s, sx9), precision: 3);
323Assert.Equal(0.990, lcs.ComputeDistance(s, sx99), precision: 3);
324Assert.Equal(1.000, lcs.ComputeDistance(s, sx1000), precision: 3);
325Assert.Equal(1.000, lcs.ComputeDistance(s, sx100000000), precision: 3);
327Assert.Equal(0.900, lcs.ComputeDistance(sx9, s), precision: 3);
328Assert.Equal(0.990, lcs.ComputeDistance(sx99, s), precision: 3);
329Assert.Equal(1.000, lcs.ComputeDistance(sx1000, s), precision: 3);
330Assert.Equal(1.000, lcs.ComputeDistance(sx100000000, s), precision: 3);
332Assert.Equal(1.000, lcs.ComputeDistance(x10 + y1000, x10), precision: 3);
333Assert.Equal(0.5, lcs.ComputeDistance(x1000 + y1000, x1000), precision: 3);