Mercurial > dedupe
view TestDBCache.cpp @ 85:1f9e27a0bd7f
Allow for lazy calculation of checksums, ignore them, if only one file of given size.
| author | Tom Fredrik Blenning Klaussen <bfg@bfgconsult.no> |
|---|---|
| date | Thu, 10 Oct 2013 15:55:30 +0200 |
| parents | 247adcbbaf8b |
| children |
line wrap: on
line source
#include "DBCache.hpp" #include "TestFramework.hpp" #include <QtCore/QTemporaryFile> BOOST_AUTO_TEST_CASE( TestCache ) { QTemporaryFile sqlfile("XXXXXX.sqlite"); sqlfile.setAutoRemove(true); sqlfile.open(); typedef OrderedPair<QString> key_t; DBCache<key_t, int> cache (sqlfile.fileName(), "SomeLUT"); key_t key1("hei", "hei"); key_t key2("S'turday", "Sunday"); bool exists = cache.value(key1); BOOST_REQUIRE_EQUAL(exists, false); cache.insert(key1, 321); BOOST_REQUIRE_EQUAL(cache.value(key1), 321); exists = cache.value(key2); BOOST_REQUIRE_EQUAL(exists, false); cache.insert(key2, 19); BOOST_REQUIRE_EQUAL(cache.value(key2), 19); }
