Mercurial > dedupe
comparison TestFileDBLink.cpp @ 76:8136057988bc
Fixes to automatic report generating system.
A lot of new unittests.
| author | Tom Fredrik Blenning Klaussen <bfg@bfgconsult.no> |
|---|---|
| date | Sat, 16 Feb 2013 15:32:20 +0100 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 75:aaf0a2878f67 | 76:8136057988bc |
|---|---|
| 1 #include "FileDBLink.hpp" | |
| 2 #include "TestFramework.hpp" | |
| 3 | |
| 4 BOOST_AUTO_TEST_CASE( DBInfoSerialize ) | |
| 5 { | |
| 6 QString dir("de"); | |
| 7 QString name("cd"); | |
| 8 QString path(QString("%1/%2").arg(dir).arg(name)); | |
| 9 int size = 64; | |
| 10 QDateTime time1 = QDateTime::currentDateTime(); | |
| 11 QByteArray hash = QByteArray::fromHex("ab"); | |
| 12 FileDBLink::DBInfo info(path, size, time1, hash); | |
| 13 | |
| 14 BOOST_REQUIRE_EQUAL(info.path(), path); | |
| 15 BOOST_REQUIRE_EQUAL(info.name(), name); | |
| 16 BOOST_REQUIRE_EQUAL(info.size(), size); | |
| 17 BOOST_REQUIRE_EQUAL(info.mtime(), time1); | |
| 18 BOOST_REQUIRE_EQUAL(info.checksum(), hash); | |
| 19 | |
| 20 BOOST_REQUIRE_EQUAL(info.serialize(), | |
| 21 QString("%1, %2, %3, %4") | |
| 22 .arg(info.path()) | |
| 23 .arg(size) | |
| 24 .arg(time1.toString()) | |
| 25 .arg(QString(hash.toHex())) | |
| 26 ); | |
| 27 } | |
| 28 | |
| 29 BOOST_AUTO_TEST_CASE( ExtendedDBInfoSerialize ) | |
| 30 { | |
| 31 QString dir("de"); | |
| 32 QString name("cd"); | |
| 33 QString path(QString("%1/%2").arg(dir).arg(name)); | |
| 34 int size = 64; | |
| 35 QDateTime time1 = QDateTime::currentDateTime(); | |
| 36 QByteArray hash = QByteArray::fromHex("ab"); | |
| 37 QString closestEditPath = "aa"; | |
| 38 int editDistance = 1; | |
| 39 FileDBLink::ExtendedDBInfo info(FileDBLink::DBInfo(path, size, time1, hash), | |
| 40 closestEditPath, | |
| 41 editDistance | |
| 42 ); | |
| 43 | |
| 44 BOOST_REQUIRE_EQUAL(info.path(), path); | |
| 45 BOOST_REQUIRE_EQUAL(info.name(), name); | |
| 46 BOOST_REQUIRE_EQUAL(info.size(), size); | |
| 47 BOOST_REQUIRE_EQUAL(info.mtime(), time1); | |
| 48 BOOST_REQUIRE_EQUAL(info.checksum(), hash); | |
| 49 BOOST_REQUIRE_EQUAL(info.editDistance(), editDistance); | |
| 50 | |
| 51 BOOST_REQUIRE_EQUAL(info.serialize(), | |
| 52 QString("%1, %2, %3, %4, %5, %6") | |
| 53 .arg(info.path()) | |
| 54 .arg(size) | |
| 55 .arg(time1.toString()) | |
| 56 .arg(QString(hash.toHex())) | |
| 57 .arg(closestEditPath) | |
| 58 .arg(editDistance) | |
| 59 ); | |
| 60 } |
