Mercurial > dedupe
comparison TestMemoryDBLink.cpp @ 73:c9447697609f
Fixed some issues with raise.
100% function code coverage for Exceptions.
| author | Tom Fredrik Blenning Klaussen <bfg@bfgconsult.no> |
|---|---|
| date | Thu, 31 Jan 2013 20:33:01 +0100 |
| parents | |
| children | 8136057988bc |
comparison
equal
deleted
inserted
replaced
| 72:b4185273c14a | 73:c9447697609f |
|---|---|
| 1 #include "MemoryDBLink.hpp" | |
| 2 #include "Exception/ValueExistsException.hpp" | |
| 3 #include "TestFramework.hpp" | |
| 4 | |
| 5 BOOST_AUTO_TEST_CASE( AddUpdateDeleteFile ) | |
| 6 { | |
| 7 MemoryDBLink link; | |
| 8 | |
| 9 QDateTime time1; | |
| 10 QDateTime time2 = time1.addSecs(1); | |
| 11 | |
| 12 BOOST_REQUIRE_EQUAL(link.existsWithMtime("test", time1), FileDBLink::NONE); | |
| 13 link.addFile("test", 1, time1, "a"); | |
| 14 BOOST_REQUIRE_EQUAL(link.existsWithMtime("test", time1), FileDBLink::SAME); | |
| 15 BOOST_REQUIRE_THROW(link.addFile("test", 1, time1, "a"), | |
| 16 ValueExistsException); | |
| 17 | |
| 18 link.updateFile("test", 1, time2, "a"); | |
| 19 BOOST_REQUIRE_EQUAL(link.existsWithMtime("test", time1), FileDBLink::MTIME_DIFFERENT); | |
| 20 BOOST_REQUIRE_THROW(link.addFile("test", 1, time1, "a"), | |
| 21 ValueExistsException); | |
| 22 | |
| 23 /* | |
| 24 BOOST_REQUIRE(!map.find(k4)); | |
| 25 map.insert(k4); | |
| 26 BOOST_WARN_EQUAL(map.depth(), 2u); | |
| 27 BOOST_WARN_EQUAL(map.total_depth(), 8u); | |
| 28 BOOST_REQUIRE_EQUAL(map.size(), 4u); | |
| 29 BOOST_REQUIRE_EQUAL(map.optimal_depth(), 3u); | |
| 30 BOOST_REQUIRE_THROW(map.insert(k4), ValueExistsException); | |
| 31 BOOST_REQUIRE(map.find(k1)); | |
| 32 BOOST_REQUIRE_EQUAL(*map.find(k1), k1); | |
| 33 BOOST_REQUIRE(map.find(k2)); | |
| 34 BOOST_REQUIRE_EQUAL(*map.find(k2), k2); | |
| 35 BOOST_REQUIRE(map.find(k4)); | |
| 36 BOOST_REQUIRE_EQUAL(*map.find(k4), k4); | |
| 37 */ | |
| 38 } |
