first thoughts about cache

This commit is contained in:
Blue 2022-09-20 20:16:48 +03:00
parent 2f34fa69e8
commit a613eaed27
Signed by: blue
GPG key ID: 9B203B252A63EE38
6 changed files with 205 additions and 7 deletions

View file

@ -2,6 +2,7 @@
#include "database.h"
#include "table.h"
#include "cache.h"
#include <QString>
@ -10,7 +11,8 @@ protected:
DataBaseTest():
::testing::Test(),
t1(db->getTable<uint32_t, uint32_t>("table1")),
t2(db->getTable<QString, QString>("table2")) {}
t2(db->getTable<QString, QString>("table2")),
c1(db->getCache<int8_t, std::string>("cache1")) {}
~DataBaseTest() {}
@ -19,6 +21,7 @@ protected:
db = new DataBase("testBase");
db->addTable<uint32_t, uint32_t>("table1");
db->addTable<QString, QString>("table2");
db->addCache<int8_t, std::string>("cache1");
}
}
@ -33,6 +36,7 @@ protected:
DataBase::Table<uint32_t, uint32_t>* t1;
DataBase::Table<QString, QString>* t2;
DataBase::Cache<int8_t, std::string>* c1;
};
@ -120,6 +124,7 @@ TEST_F(DataBaseTest, Persistence) {
db = new DataBase("testBase");
t1 = db->addTable<uint32_t, uint32_t>("table1");
t2 = db->addTable<QString, QString>("table2");
c1 = db->addCache<int8_t, std::string>("cache1");
db->open();
EXPECT_EQ(t1->getRecord(3), 15);