lib: unit tests: improve / better coverage

This commit is contained in:
Dirk-Jan C. Binnema
2023-09-13 23:02:53 +03:00
parent 7c16d080d2
commit 9dcbe1d96c
15 changed files with 304 additions and 147 deletions

View File

@ -111,6 +111,13 @@ struct MetadataIface {
/// In-memory db
struct MemDb: public MetadataIface {
/**
* Create a new memdb
*
* @param readonly read-only? (for testing)
*/
MemDb(bool readonly=false):read_only_{readonly} {}
/**
* Set some metadata
*
@ -141,7 +148,7 @@ struct MemDb: public MetadataIface {
*
* @return true or false
*/
bool read_only() const override { return false; }
bool read_only() const override { return read_only_; }
/**
@ -157,6 +164,7 @@ struct MemDb: public MetadataIface {
private:
std::unordered_map<std::string, std::string> map_;
const bool read_only_;
};
/**
@ -171,8 +179,8 @@ public:
*
*/
enum struct Flavor {
ReadOnly, /**< Read-only database */
Open, /**< Open existing read-write */
ReadOnly, /**< Read-only database */
Open, /**< Open existing read-write */
CreateOverwrite, /**< Create new or overwrite existing */
};