scaffold  1.0.0
Generates files and directories based on templates and user input
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
diff_match_patch_test_original.h
1 /*
2  * Copyright 2008 Google Inc. All Rights Reserved.
3  * Author: fraser@google.com (Neil Fraser)
4  * Author: mikeslemmer@gmail.com (Mike Slemmer)
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  * Diff Match and Patch -- Test Harness
19  * http://code.google.com/p/google-diff-match-patch/
20  */
21 
22 #ifndef DIFF_MATCH_PATCH_TEST_H
23 #define DIFF_MATCH_PATCH_TEST_H
24 
26  public:
28  void run_all_tests();
29 
30  // DIFF TEST FUNCTIONS
31  void testDiffCommonPrefix();
32  void testDiffCommonSuffix();
33  void testDiffCommonOverlap();
34  void testDiffHalfmatch();
35  void testDiffLinesToChars();
36  void testDiffCharsToLines();
37  void testDiffCleanupMerge();
38  void testDiffCleanupSemanticLossless();
39  void testDiffCleanupSemantic();
40  void testDiffCleanupEfficiency();
41  void testDiffPrettyHtml();
42  void testDiffText();
43  void testDiffDelta();
44  void testDiffXIndex();
45  void testDiffLevenshtein();
46  void testDiffBisect();
47  void testDiffMain();
48 
49  // MATCH TEST FUNCTIONS
50  void testMatchAlphabet();
51  void testMatchBitap();
52  void testMatchMain();
53 
54  // PATCH TEST FUNCTIONS
55  void testPatchObj();
56  void testPatchFromText();
57  void testPatchToText();
58  void testPatchAddContext();
59  void testPatchMake();
60  void testPatchSplitMax();
61  void testPatchAddPadding();
62  void testPatchApply();
63 
64  private:
65  diff_match_patch dmp;
66 
67  // Define equality.
68  void assertEquals(const QString &strCase, int n1, int n2);
69  void assertEquals(const QString &strCase, const QString &s1, const QString &s2);
70  void assertEquals(const QString &strCase, const Diff &d1, const Diff &d2);
71  void assertEquals(const QString &strCase, const QList<Diff> &list1, const QList<Diff> &list2);
72  void assertEquals(const QString &strCase, const QList<QVariant> &list1, const QList<QVariant> &list2);
73  void assertEquals(const QString &strCase, const QVariant &var1, const QVariant &var2);
74  void assertEquals(const QString &strCase, const QMap<QChar, int> &m1, const QMap<QChar, int> &m2);
75  void assertEquals(const QString &strCase, const QStringList &list1, const QStringList &list2);
76  void assertTrue(const QString &strCase, bool value);
77  void assertFalse(const QString &strCase, bool value);
78  void assertEmpty(const QString &strCase, const QStringList &list);
79 
80  // Construct the two texts which made up the diff originally.
81  QStringList diff_rebuildtexts(QList<Diff> diffs);
82  // Private function for quickly building lists of diffs.
83  QList<Diff> diffList(
84  // Diff(INSERT, NULL) is invalid and thus is used as the default argument.
85  Diff d1 = Diff(INSERT, NULL), Diff d2 = Diff(INSERT, NULL),
86  Diff d3 = Diff(INSERT, NULL), Diff d4 = Diff(INSERT, NULL),
87  Diff d5 = Diff(INSERT, NULL), Diff d6 = Diff(INSERT, NULL),
88  Diff d7 = Diff(INSERT, NULL), Diff d8 = Diff(INSERT, NULL),
89  Diff d9 = Diff(INSERT, NULL), Diff d10 = Diff(INSERT, NULL));
90 };
91 
92 #endif // DIFF_MATCH_PATCH_TEST_H