本文整理汇总了C#中nicTest.diff_match_patchTest类的典型用法代码示例。如果您正苦于以下问题:C# diff_match_patchTest类的具体用法?C# diff_match_patchTest怎么用?C# diff_match_patchTest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
diff_match_patchTest类属于nicTest命名空间,在下文中一共展示了diff_match_patchTest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: diff_charsToLinesTest
public void diff_charsToLinesTest()
{
var dmp = new diff_match_patchTest();
// Convert chars up to lines.
var diffs = new List<Diff>{
new Diff(Operation.Equal, "\u0001\u0002\u0001"),
new Diff(Operation.Insert, "\u0002\u0001\u0002")
};
var tmpVector = new List<string>{"", "alpha\n", "beta\n"};
dmp.diff_charsToLines(diffs, tmpVector);
CollectionAssert.AreEqual(new List<Diff>{
new Diff(Operation.Equal, "alpha\nbeta\nalpha\n"),
new Diff(Operation.Insert, "beta\nalpha\nbeta\n")
}, diffs);
// More than 256 to reveal any 8-bit limitations.
const int n = 300;
tmpVector.Clear();
var lineList = new StringBuilder();
var charList = new StringBuilder();
for (int x = 1; x < n + 1; x++) {
tmpVector.Add(x + "\n");
lineList.Append(x + "\n");
charList.Append(Convert.ToChar(x));
}
Assert.AreEqual(n, tmpVector.Count);
string lines = lineList.ToString();
string chars = charList.ToString();
Assert.AreEqual(n, chars.Length);
tmpVector.Insert(0, "");
diffs = new List<Diff>{new Diff(Operation.Delete, chars)};
dmp.diff_charsToLines(diffs, tmpVector);
CollectionAssert.AreEqual(new List<Diff>
{new Diff(Operation.Delete, lines)}, diffs);
}
示例2: diff_halfmatchTest
public void diff_halfmatchTest() {
diff_match_patchTest dmp = new diff_match_patchTest();
dmp.Diff_Timeout = 1;
// No match.
Assert.IsNull(dmp.diff_halfMatch("1234567890", "abcdef"));
Assert.IsNull(dmp.diff_halfMatch("12345", "23"));
// Single Match.
CollectionAssert.AreEqual(new string[] { "12", "90", "a", "z", "345678" }, dmp.diff_halfMatch("1234567890", "a345678z"));
CollectionAssert.AreEqual(new string[] { "a", "z", "12", "90", "345678" }, dmp.diff_halfMatch("a345678z", "1234567890"));
CollectionAssert.AreEqual(new string[] { "abc", "z", "1234", "0", "56789" }, dmp.diff_halfMatch("abc56789z", "1234567890"));
CollectionAssert.AreEqual(new string[] { "a", "xyz", "1", "7890", "23456" }, dmp.diff_halfMatch("a23456xyz", "1234567890"));
// Multiple Matches.
CollectionAssert.AreEqual(new string[] { "12123", "123121", "a", "z", "1234123451234" }, dmp.diff_halfMatch("121231234123451234123121", "a1234123451234z"));
CollectionAssert.AreEqual(new string[] { "", "-=-=-=-=-=", "x", "", "x-=-=-=-=-=-=-=" }, dmp.diff_halfMatch("x-=-=-=-=-=-=-=-=-=-=-=-=", "xx-=-=-=-=-=-=-="));
CollectionAssert.AreEqual(new string[] { "-=-=-=-=-=", "", "", "y", "-=-=-=-=-=-=-=y" }, dmp.diff_halfMatch("-=-=-=-=-=-=-=-=-=-=-=-=y", "-=-=-=-=-=-=-=yy"));
// Non-optimal halfmatch.
// Optimal diff would be -q+x=H-i+e=lloHe+Hu=llo-Hew+y not -qHillo+x=HelloHe-w+Hulloy
CollectionAssert.AreEqual(new string[] { "qHillo", "w", "x", "Hulloy", "HelloHe" }, dmp.diff_halfMatch("qHilloHelloHew", "xHelloHeHulloy"));
// Optimal no halfmatch.
dmp.Diff_Timeout = 0;
Assert.IsNull(dmp.diff_halfMatch("qHilloHelloHew", "xHelloHeHulloy"));
}
示例3: diff_commonSuffixTest
public void diff_commonSuffixTest()
{
diff_match_patchTest dmp = new diff_match_patchTest();
// Detect and remove any common suffix.
Assert.AreEqual(0, dmp.diff_commonSuffix("abc", "xyz"));
Assert.AreEqual(4, dmp.diff_commonSuffix("abcdef1234", "xyz1234"));
Assert.AreEqual(4, dmp.diff_commonSuffix("1234", "xyz1234"));
}
示例4: diff_commonSuffixTest
public void diff_commonSuffixTest() {
diff_match_patchTest dmp = new diff_match_patchTest();
// Detect any common suffix.
// Null case.
Assert.AreEqual(0, dmp.diff_commonSuffix("abc", "xyz"));
// Non-null case.
Assert.AreEqual(4, dmp.diff_commonSuffix("abcdef1234", "xyz1234"));
// Whole case.
Assert.AreEqual(4, dmp.diff_commonSuffix("1234", "xyz1234"));
}
示例5: diff_linesToCharsTest
public void diff_linesToCharsTest()
{
diff_match_patchTest dmp = new diff_match_patchTest();
// Convert lines down to characters.
List<string> tmpVector = new List<string>();
tmpVector.Add("");
tmpVector.Add("alpha\n");
tmpVector.Add("beta\n");
var result = dmp.diff_linesToChars("alpha\nbeta\nalpha\n", "beta\nalpha\nbeta\n");
Assert.AreEqual("\u0001\u0002\u0001", result[0]);
Assert.AreEqual("\u0002\u0001\u0002", result[1]);
CollectionAssert.AreEqual(tmpVector, (List<string>)result[2]);
tmpVector.Clear();
tmpVector.Add("");
tmpVector.Add("alpha\r\n");
tmpVector.Add("beta\r\n");
tmpVector.Add("\r\n");
result = dmp.diff_linesToChars("", "alpha\r\nbeta\r\n\r\n\r\n");
Assert.AreEqual("", result[0]);
Assert.AreEqual("\u0001\u0002\u0003\u0003", result[1]);
CollectionAssert.AreEqual(tmpVector, (List<string>)result[2]);
tmpVector.Clear();
tmpVector.Add("");
tmpVector.Add("a");
tmpVector.Add("b");
result = dmp.diff_linesToChars("a", "b");
Assert.AreEqual("\u0001", result[0]);
Assert.AreEqual("\u0002", result[1]);
CollectionAssert.AreEqual(tmpVector, (List<string>)result[2]);
// More than 256 to reveal any 8-bit limitations.
int n = 300;
tmpVector.Clear();
StringBuilder lineList = new StringBuilder();
StringBuilder charList = new StringBuilder();
for (int x = 1; x < n + 1; x++)
{
tmpVector.Add(x + "\n");
lineList.Append(x + "\n");
charList.Append(Convert.ToChar(x));
}
Assert.AreEqual(n, tmpVector.Count);
string lines = lineList.ToString();
string chars = charList.ToString();
Assert.AreEqual(n, chars.Length);
tmpVector.Insert(0, "");
result = dmp.diff_linesToChars(lines, "");
Assert.AreEqual(chars, result[0]);
Assert.AreEqual("", result[1]);
CollectionAssert.AreEqual(tmpVector, (List<string>)result[2]);
}
示例6: diff_halfmatchTest
public void diff_halfmatchTest()
{
diff_match_patchTest dmp = new diff_match_patchTest();
Assert.IsNull(dmp.diff_halfMatch("1234567890", "abcdef"));
CollectionAssert.AreEqual(new string[] { "12", "90", "a", "z", "345678" }, dmp.diff_halfMatch("1234567890", "a345678z"));
CollectionAssert.AreEqual(new string[] { "a", "z", "12", "90", "345678" }, dmp.diff_halfMatch("a345678z", "1234567890"));
CollectionAssert.AreEqual(new string[] { "12123", "123121", "a", "z", "1234123451234" }, dmp.diff_halfMatch("121231234123451234123121", "a1234123451234z"));
CollectionAssert.AreEqual(new string[] { "", "-=-=-=-=-=", "x", "", "x-=-=-=-=-=-=-=" }, dmp.diff_halfMatch("x-=-=-=-=-=-=-=-=-=-=-=-=", "xx-=-=-=-=-=-=-="));
CollectionAssert.AreEqual(new string[] { "-=-=-=-=-=", "", "", "y", "-=-=-=-=-=-=-=y" }, dmp.diff_halfMatch("-=-=-=-=-=-=-=-=-=-=-=-=y", "-=-=-=-=-=-=-=yy"));
}
示例7: diff_bisectTest
public void diff_bisectTest()
{
var dmp = new diff_match_patchTest();
// Normal.
const string a = "cat";
const string b = "map";
// Since the resulting diff hasn't been normalized, it would be ok if
// the insertion and deletion pairs are swapped.
// If the order changes, tweak this test as required.
var diffs = new List<Diff>{new Diff(Operation.Delete, "c"), new Diff(Operation.Insert, "m"), new Diff(Operation.Equal, "a"), new Diff(Operation.Delete, "t"), new Diff(Operation.Insert, "p")};
Assert.AreEqual(diffs, dmp.diff_bisect(a, b, DateTime.MaxValue));
// Timeout.
diffs = new List<Diff>{new Diff(Operation.Delete, "cat"), new Diff(Operation.Insert, "map")};
Assert.AreEqual(diffs, dmp.diff_bisect(a, b, DateTime.MinValue));
}
示例8: diff_commonOverlapTest
public void diff_commonOverlapTest() {
diff_match_patchTest dmp = new diff_match_patchTest();
// Detect any suffix/prefix overlap.
// Null case.
Assert.AreEqual(0, dmp.diff_commonOverlap("", "abcd"));
// Whole case.
Assert.AreEqual(3, dmp.diff_commonOverlap("abc", "abcd"));
// No overlap.
Assert.AreEqual(0, dmp.diff_commonOverlap("123456", "abcd"));
// Overlap.
Assert.AreEqual(3, dmp.diff_commonOverlap("123456xxx", "xxxabcd"));
// Unicode.
// Some overly clever languages (C#) may treat ligatures as equal to their
// component letters. E.g. U+FB01 == 'fi'
Assert.AreEqual(0, dmp.diff_commonOverlap("fi", "\ufb01i"));
}
示例9: diff_textTest
public void diff_textTest()
{
var dmp = new diff_match_patchTest();
// Compute the source and destination texts.
var diffs = new List<Diff>{
new Diff(Operation.Equal, "jump"),
new Diff(Operation.Delete, "s"),
new Diff(Operation.Insert, "ed"),
new Diff(Operation.Equal, " over "),
new Diff(Operation.Delete, "the"),
new Diff(Operation.Insert, "a"),
new Diff(Operation.Equal, " lazy")
};
Assert.AreEqual("jumps over the lazy", dmp.diff_text1(diffs));
Assert.AreEqual("jumped over a lazy", dmp.diff_text2(diffs));
}
示例10: diff_prettyHtmlTest
public void diff_prettyHtmlTest()
{
var dmp = new diff_match_patchTest();
// Pretty print.
var diffs = new List<Diff>{
new Diff(Operation.Equal, "a\n"),
new Diff(Operation.Delete, "<B>b</B>"),
new Diff(Operation.Insert, "c&d")
};
Assert.AreEqual("<span>a¶<br></span><del style=\"background:#ffe6e6;\"><B>b</B></del><ins style=\"background:#e6ffe6;\">c&d</ins>",
dmp.diff_prettyHtml(diffs));
}
示例11: diff_mainTest
public void diff_mainTest()
{
var dmp = new diff_match_patchTest();
// Perform a trivial diff.
var diffs = new List<Diff>();
CollectionAssert.AreEqual(diffs, dmp.diff_main("", "", false), "diff_main: Null case.");
diffs = new List<Diff>{new Diff(Operation.Equal, "abc")};
CollectionAssert.AreEqual(diffs, dmp.diff_main("abc", "abc", false), "diff_main: Equality.");
diffs = new List<Diff>{new Diff(Operation.Equal, "ab"), new Diff(Operation.Insert, "123"), new Diff(Operation.Equal, "c")};
CollectionAssert.AreEqual(diffs, dmp.diff_main("abc", "ab123c", false), "diff_main: Simple insertion.");
diffs = new List<Diff>{new Diff(Operation.Equal, "a"), new Diff(Operation.Delete, "123"), new Diff(Operation.Equal, "bc")};
CollectionAssert.AreEqual(diffs, dmp.diff_main("a123bc", "abc", false), "diff_main: Simple deletion.");
diffs = new List<Diff>{new Diff(Operation.Equal, "a"), new Diff(Operation.Insert, "123"), new Diff(Operation.Equal, "b"), new Diff(Operation.Insert, "456"), new Diff(Operation.Equal, "c")};
CollectionAssert.AreEqual(diffs, dmp.diff_main("abc", "a123b456c", false), "diff_main: Two insertions.");
diffs = new List<Diff>{new Diff(Operation.Equal, "a"), new Diff(Operation.Delete, "123"), new Diff(Operation.Equal, "b"), new Diff(Operation.Delete, "456"), new Diff(Operation.Equal, "c")};
CollectionAssert.AreEqual(diffs, dmp.diff_main("a123b456c", "abc", false), "diff_main: Two deletions.");
// Perform a real diff.
// Switch off the timeout.
dmp.Diff_Timeout = 0;
diffs = new List<Diff>{new Diff(Operation.Delete, "a"), new Diff(Operation.Insert, "b")};
CollectionAssert.AreEqual(diffs, dmp.diff_main("a", "b", false), "diff_main: Simple case #1.");
diffs = new List<Diff>{new Diff(Operation.Delete, "Apple"), new Diff(Operation.Insert, "Banana"), new Diff(Operation.Equal, "s are a"), new Diff(Operation.Insert, "lso"), new Diff(Operation.Equal, " fruit.")};
CollectionAssert.AreEqual(diffs, dmp.diff_main("Apples are a fruit.", "Bananas are also fruit.", false), "diff_main: Simple case #2.");
diffs = new List<Diff>{new Diff(Operation.Delete, "a"), new Diff(Operation.Insert, "\u0680"), new Diff(Operation.Equal, "x"), new Diff(Operation.Delete, "\t"), new Diff(Operation.Insert, new string(new[]{(char)0}))};
CollectionAssert.AreEqual(diffs, dmp.diff_main("ax\t", "\u0680x" + (char)0, false), "diff_main: Simple case #3.");
diffs = new List<Diff>{new Diff(Operation.Delete, "1"), new Diff(Operation.Equal, "a"), new Diff(Operation.Delete, "y"), new Diff(Operation.Equal, "b"), new Diff(Operation.Delete, "2"), new Diff(Operation.Insert, "xab")};
CollectionAssert.AreEqual(diffs, dmp.diff_main("1ayb2", "abxab", false), "diff_main: Overlap #1.");
diffs = new List<Diff>{new Diff(Operation.Insert, "xaxcx"), new Diff(Operation.Equal, "abc"), new Diff(Operation.Delete, "y")};
CollectionAssert.AreEqual(diffs, dmp.diff_main("abcy", "xaxcxabc", false), "diff_main: Overlap #2.");
diffs = new List<Diff>{new Diff(Operation.Delete, "ABCD"), new Diff(Operation.Equal, "a"), new Diff(Operation.Delete, "="), new Diff(Operation.Insert, "-"), new Diff(Operation.Equal, "bcd"), new Diff(Operation.Delete, "="), new Diff(Operation.Insert, "-"), new Diff(Operation.Equal, "efghijklmnopqrs"), new Diff(Operation.Delete, "EFGHIJKLMNOefg")};
CollectionAssert.AreEqual(diffs, dmp.diff_main("ABCDa=bcd=efghijklmnopqrsEFGHIJKLMNOefg", "a-bcd-efghijklmnopqrs", false), "diff_main: Overlap #3.");
diffs = new List<Diff>{new Diff(Operation.Insert, " "), new Diff(Operation.Equal, "a"), new Diff(Operation.Insert, "nd"), new Diff(Operation.Equal, " [[Pennsylvania]]"), new Diff(Operation.Delete, " and [[New")};
CollectionAssert.AreEqual(diffs, dmp.diff_main("a [[Pennsylvania]] and [[New", " and [[Pennsylvania]]", false), "diff_main: Large equality.");
dmp.Diff_Timeout = 0.1f; // 100ms
string a = "`Twas brillig, and the slithy toves\nDid gyre and gimble in the wabe:\nAll mimsy were the borogoves,\nAnd the mome raths outgrabe.\n";
string b = "I am the very model of a modern major general,\nI've information vegetable, animal, and mineral,\nI know the kings of England, and I quote the fights historical,\nFrom Marathon to Waterloo, in order categorical.\n";
// Increase the text lengths by 1024 times to ensure a timeout.
for (int x = 0; x < 10; x++) {
a = a + a;
b = b + b;
}
DateTime startTime = DateTime.Now;
dmp.diff_main(a, b);
DateTime endTime = DateTime.Now;
// Test that we took at least the timeout period.
Assert.IsTrue(new TimeSpan(((long)(dmp.Diff_Timeout * 1000)) * 10000) <= endTime - startTime);
// Test that we didn't take forever (be forgiving).
// Theoretically this test could fail very occasionally if the
// OS task swaps or locks up for a second at the wrong moment.
Assert.IsTrue(new TimeSpan(((long)(dmp.Diff_Timeout * 1000)) * 10000 * 2) > endTime - startTime);
dmp.Diff_Timeout = 0;
// Test the linemode speedup.
// Must be long to pass the 100 char cutoff.
a = "1234567890\n1234567890\n1234567890\n1234567890\n1234567890\n1234567890\n1234567890\n1234567890\n1234567890\n1234567890\n1234567890\n1234567890\n1234567890\n";
b = "abcdefghij\nabcdefghij\nabcdefghij\nabcdefghij\nabcdefghij\nabcdefghij\nabcdefghij\nabcdefghij\nabcdefghij\nabcdefghij\nabcdefghij\nabcdefghij\nabcdefghij\n";
CollectionAssert.AreEqual(dmp.diff_main(a, b, true), dmp.diff_main(a, b, false), "diff_main: Simple line-mode.");
a = "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890";
b = "abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij";
CollectionAssert.AreEqual(dmp.diff_main(a, b, true), dmp.diff_main(a, b, false), "diff_main: Single line-mode.");
a = "1234567890\n1234567890\n1234567890\n1234567890\n1234567890\n1234567890\n1234567890\n1234567890\n1234567890\n1234567890\n1234567890\n1234567890\n1234567890\n";
b = "abcdefghij\n1234567890\n1234567890\n1234567890\nabcdefghij\n1234567890\n1234567890\n1234567890\nabcdefghij\n1234567890\n1234567890\n1234567890\nabcdefghij\n";
IEnumerable<string> texts_linemode = diff_rebuildtexts(dmp.diff_main(a, b, true));
IEnumerable<string> texts_textmode = diff_rebuildtexts(dmp.diff_main(a, b, false));
CollectionAssert.AreEqual(texts_textmode, texts_linemode, "diff_main: Overlap line-mode.");
// Test null inputs -- not needed because nulls can't be passed in C#.
}
示例12: patch_fromTextTest
public void patch_fromTextTest()
{
var dmp = new diff_match_patchTest();
Assert.IsTrue(dmp.patch_fromText("").Count == 0, "patch_fromText: #0.");
const string strp = "@@ -21,18 +22,17 @@\n jump\n-s\n+ed\n over \n-the\n+a\n %0alaz\n";
Assert.AreEqual(strp, dmp.patch_fromText(strp)[0].ToString(), "patch_fromText: #1.");
Assert.AreEqual("@@ -1 +1 @@\n-a\n+b\n", dmp.patch_fromText("@@ -1 +1 @@\n-a\n+b\n")[0].ToString(), "patch_fromText: #2.");
Assert.AreEqual("@@ -1,3 +0,0 @@\n-abc\n", dmp.patch_fromText("@@ -1,3 +0,0 @@\n-abc\n")[0].ToString(), "patch_fromText: #3.");
Assert.AreEqual("@@ -0,0 +1,3 @@\n+abc\n", dmp.patch_fromText("@@ -0,0 +1,3 @@\n+abc\n")[0].ToString(), "patch_fromText: #4.");
// Generates error.
try {
dmp.patch_fromText("Bad\nPatch\n");
Assert.Fail("patch_fromText: #5.");
} catch (ArgumentException) {
// Exception expected.
}
}
示例13: patch_addPaddingTest
public void patch_addPaddingTest()
{
var dmp = new diff_match_patchTest();
List<Patch> patches = dmp.patch_make("", "test");
Assert.AreEqual("@@ -0,0 +1,4 @@\n+test\n",
dmp.patch_toText(patches),
"patch_addPadding: Both edges full.");
dmp.patch_addPadding(patches);
Assert.AreEqual("@@ -1,8 +1,12 @@\n %01%02%03%04\n+test\n %01%02%03%04\n",
dmp.patch_toText(patches),
"patch_addPadding: Both edges full.");
patches = dmp.patch_make("XY", "XtestY");
Assert.AreEqual("@@ -1,2 +1,6 @@\n X\n+test\n Y\n",
dmp.patch_toText(patches),
"patch_addPadding: Both edges partial.");
dmp.patch_addPadding(patches);
Assert.AreEqual("@@ -2,8 +2,12 @@\n %02%03%04X\n+test\n Y%01%02%03\n",
dmp.patch_toText(patches),
"patch_addPadding: Both edges partial.");
patches = dmp.patch_make("XXXXYYYY", "XXXXtestYYYY");
Assert.AreEqual("@@ -1,8 +1,12 @@\n XXXX\n+test\n YYYY\n",
dmp.patch_toText(patches),
"patch_addPadding: Both edges none.");
dmp.patch_addPadding(patches);
Assert.AreEqual("@@ -5,8 +5,12 @@\n XXXX\n+test\n YYYY\n",
dmp.patch_toText(patches),
"patch_addPadding: Both edges none.");
}
示例14: patch_addContextTest
public void patch_addContextTest()
{
var dmp = new diff_match_patchTest{Patch_Margin = 4};
Patch p = dmp.patch_fromText("@@ -21,4 +21,10 @@\n-jump\n+somersault\n")[0];
dmp.patch_addContext(p, "The quick brown fox jumps over the lazy dog.");
Assert.AreEqual("@@ -17,12 +17,18 @@\n fox \n-jump\n+somersault\n s ov\n", p.ToString(), "patch_addContext: Simple case.");
p = dmp.patch_fromText("@@ -21,4 +21,10 @@\n-jump\n+somersault\n")[0];
dmp.patch_addContext(p, "The quick brown fox jumps.");
Assert.AreEqual("@@ -17,10 +17,16 @@\n fox \n-jump\n+somersault\n s.\n", p.ToString(), "patch_addContext: Not enough trailing context.");
p = dmp.patch_fromText("@@ -3 +3,2 @@\n-e\n+at\n")[0];
dmp.patch_addContext(p, "The quick brown fox jumps.");
Assert.AreEqual("@@ -1,7 +1,8 @@\n Th\n-e\n+at\n qui\n", p.ToString(), "patch_addContext: Not enough leading context.");
p = dmp.patch_fromText("@@ -3 +3,2 @@\n-e\n+at\n")[0];
dmp.patch_addContext(p, "The quick brown fox jumps. The quick brown fox crashes.");
Assert.AreEqual("@@ -1,27 +1,28 @@\n Th\n-e\n+at\n quick brown fox jumps. \n", p.ToString(), "patch_addContext: Ambiguity.");
}
示例15: match_bitapTest
public void match_bitapTest()
{
var dmp = new diff_match_patchTest{Match_Distance = 100, Match_Threshold = 0.5f};
// Bitap algorithm.
Assert.AreEqual(5, dmp.match_bitap("abcdefghijk", "fgh", 5), "match_bitap: Exact match #1.");
Assert.AreEqual(5, dmp.match_bitap("abcdefghijk", "fgh", 0), "match_bitap: Exact match #2.");
Assert.AreEqual(4, dmp.match_bitap("abcdefghijk", "efxhi", 0), "match_bitap: Fuzzy match #1.");
Assert.AreEqual(2, dmp.match_bitap("abcdefghijk", "cdefxyhijk", 5), "match_bitap: Fuzzy match #2.");
Assert.AreEqual(-1, dmp.match_bitap("abcdefghijk", "bxy", 1), "match_bitap: Fuzzy match #3.");
Assert.AreEqual(2, dmp.match_bitap("123456789xx0", "3456789x0", 2), "match_bitap: Overflow.");
Assert.AreEqual(0, dmp.match_bitap("abcdef", "xxabc", 4), "match_bitap: Before start match.");
Assert.AreEqual(3, dmp.match_bitap("abcdef", "defyy", 4), "match_bitap: Beyond end match.");
Assert.AreEqual(0, dmp.match_bitap("abcdef", "xabcdefy", 0), "match_bitap: Oversized pattern.");
dmp.Match_Threshold = 0.4f;
Assert.AreEqual(4, dmp.match_bitap("abcdefghijk", "efxyhi", 1), "match_bitap: Threshold #1.");
dmp.Match_Threshold = 0.3f;
Assert.AreEqual(-1, dmp.match_bitap("abcdefghijk", "efxyhi", 1), "match_bitap: Threshold #2.");
dmp.Match_Threshold = 0.0f;
Assert.AreEqual(1, dmp.match_bitap("abcdefghijk", "bcdef", 1), "match_bitap: Threshold #3.");
dmp.Match_Threshold = 0.5f;
Assert.AreEqual(0, dmp.match_bitap("abcdexyzabcde", "abccde", 3), "match_bitap: Multiple select #1.");
Assert.AreEqual(8, dmp.match_bitap("abcdexyzabcde", "abccde", 5), "match_bitap: Multiple select #2.");
dmp.Match_Distance = 10; // Strict location.
Assert.AreEqual(-1, dmp.match_bitap("abcdefghijklmnopqrstuvwxyz", "abcdefg", 24), "match_bitap: Distance test #1.");
Assert.AreEqual(0, dmp.match_bitap("abcdefghijklmnopqrstuvwxyz", "abcdxxefg", 1), "match_bitap: Distance test #2.");
dmp.Match_Distance = 1000; // Loose location.
Assert.AreEqual(0, dmp.match_bitap("abcdefghijklmnopqrstuvwxyz", "abcdefg", 24), "match_bitap: Distance test #3.");
}