blob: 2d9f8416194963d9b8da6ea7abede17d8c602fae (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
/*
* This software is in the public domain, furnished "as is", without technical
* support, and with no warranty, express or implied, as to its usefulness for
* any purpose.
* */
#include <QtTest>
#include "syncfileitem.h"
using namespace OCC;
class TestSyncFileItem : public QObject
{
Q_OBJECT
private slots:
void initTestCase() {
}
void cleanupTestCase() {
}
SyncFileItem createItem( const QString& file ) {
SyncFileItem i;
i._file = file;
return i;
}
void testComparator_data() {
QTest::addColumn<SyncFileItem>("a");
QTest::addColumn<SyncFileItem>("b");
QTest::addColumn<SyncFileItem>("c");
QTest::newRow("a1") << createItem(QStringLiteral("client")) << createItem(QStringLiteral("client/build")) << createItem(QStringLiteral("client-build"));
QTest::newRow("a2") << createItem(QStringLiteral("test/t1")) << createItem(QStringLiteral("test/t2")) << createItem(QStringLiteral("test/t3"));
QTest::newRow("a3") << createItem(QStringLiteral("ABCD")) << createItem(QStringLiteral("abcd")) << createItem(QStringLiteral("zzzz"));
SyncFileItem movedItem1;
movedItem1._file = QLatin1String("folder/source/file.f");
movedItem1._renameTarget = QLatin1String("folder/destination/file.f");
movedItem1._instruction = CSYNC_INSTRUCTION_RENAME;
QTest::newRow("move1") << createItem(QStringLiteral("folder/destination")) << movedItem1 << createItem(QStringLiteral("folder/destination-2"));
QTest::newRow("move2") << createItem(QStringLiteral("folder/destination/1")) << movedItem1 << createItem(QStringLiteral("folder/source"));
QTest::newRow("move3") << createItem(QStringLiteral("abc")) << movedItem1 << createItem(QStringLiteral("ijk"));
}
void testComparator() {
QFETCH( SyncFileItem , a );
QFETCH( SyncFileItem , b );
QFETCH( SyncFileItem , c );
QVERIFY(a < b);
QVERIFY(b < c);
QVERIFY(a < c);
QVERIFY(!(b < a));
QVERIFY(!(c < b));
QVERIFY(!(c < a));
QVERIFY(!(a < a));
QVERIFY(!(b < b));
QVERIFY(!(c < c));
}
};
QTEST_APPLESS_MAIN(TestSyncFileItem)
#include "testsyncfileitem.moc"
|