Few small changes.
[qshowdiff.git] / tests / snippet.cpp
blob708f427e512e3dd1e473a7dffc547a33e0983b49
1 #include <cppu.h>
2 #include <QString>
3 #include "snippet.h"
6 TEST_CASE(TestCaseSnippet);
7 Text text;
8 Text text2;
9 void setUp()
11 text.addLine(new QString("Line1"));
12 text.addLine(new QString("Line2"));
13 text.addLine(new QString("Line3"));
14 text.addLine(new QString("Line4"));
15 text.addLine(new QString("Line5"));
17 text2.addLine(new QString("L1"));
18 text2.addLine(new QString("L2"));
19 text2.addLine(new QString("L3"));
20 text2.addLine(new QString("L4"));
21 text2.addLine(new QString("L5"));
24 void testConstructors()
26 Context context(new Text(text));
27 Context context2(context);
28 assertEquals(context.original(), context.modified());
29 assertEquals(context.original(), context2.original());
31 Added added(new Text(text));
32 Added added2(added);
33 assertEquals(added.original().numLines(), 0);
34 assertEquals(added.modified(), added2.modified());
36 Deleted deleted(new Text(text));
37 Deleted deleted2(deleted);
38 assertEquals(deleted.modified().numLines(), 0);
39 assertEquals(deleted.original(), deleted2.original());
41 Changed changed(new Text(text), new Text(text2));
42 Changed changed2(changed);
43 assertEquals(changed.original(), changed2.original());
44 assertEquals(changed.modified(), changed2.modified());
47 void testOperators()
49 Context context(new Text(text));
50 Context context2 = context;
51 assertEquals(context.original(), context2.original());
52 assertEquals(context.modified(), context2.modified());
53 assertEquals(context, context2);
55 Added added(new Text(text));
56 Added added2 = added;
57 assertEquals(added.original(), added2.original());
58 assertEquals(added.modified(), added2.modified());
59 assertNotEquals(added, context);
62 TESTS{
63 REG_TEST(testConstructors);
64 REG_TEST(testOperators);
67 TEST_CASE_END;