MCPcopy Create free account
hub / github.com/MiniZinc/MiniZincIDE / testDiff

Method testDiff

tests/testdiff.cpp:8–33  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6#include "history.h"
7
8void TestIDE::testDiff()
9{
10 QString origText =
11 "foo\n"
12 "bar\n"
13 "qux\n"
14 "baz";
15 QString newText =
16 "foo\n"
17 "hello\n"
18 "bar\n"
19 "baz\n"
20 "world";
21 FileDiff diff(origText, newText);
22 auto result = diff.diff();
23 QCOMPARE(result.size(), 3);
24 QCOMPARE(result[0].kind, FileDiff::EntryType::Insertion);
25 QCOMPARE(result[0].line, 2);
26 QCOMPARE(result[0].text, "hello");
27 QCOMPARE(result[1].kind, FileDiff::EntryType::Deletion);
28 QCOMPARE(result[1].line, 3);
29 QCOMPARE(result[1].text, "qux");
30 QCOMPARE(result[2].kind, FileDiff::EntryType::Insertion);
31 QCOMPARE(result[2].line, 5);
32 QCOMPARE(result[2].text, "world");
33}
34
35void TestIDE::testDiffApply()
36{

Callers

nothing calls this directly

Calls 2

diffMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected