Mercurial > dedupe
diff TestDBCache.cpp @ 16:06166d6c083b
Add configuration processing.
Cache DB values
Add a custom RBTree to save space.
Track multiple DB connections properly.
More testing.
Add ValueExistsException.
| author | Tom Fredrik Blenning Klaussen <bfg@blenning.no> |
|---|---|
| date | Tue, 28 Aug 2012 18:58:02 +0200 |
| parents | |
| children | 1334d1417c0b |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TestDBCache.cpp Tue Aug 28 18:58:02 2012 +0200 @@ -0,0 +1,29 @@ +#include "DBCache.hpp" +#include "OrderedPair.hpp" +#include "TestFramework.hpp" + +#include <QtCore/QTemporaryFile> + +BOOST_AUTO_TEST_CASE( TestCache ) +{ + QTemporaryFile sqlfile("XXXXXX.sqlite"); + sqlfile.setAutoRemove(false); + 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); + +}
