diff options
Diffstat (limited to 'tests/DBFixture.h')
-rw-r--r-- | tests/DBFixture.h | 72 |
1 files changed, 38 insertions, 34 deletions
diff --git a/tests/DBFixture.h b/tests/DBFixture.h index 2cd2cdc7..62f19a2a 100644 --- a/tests/DBFixture.h +++ b/tests/DBFixture.h @@ -27,44 +27,48 @@ #include <protocols.h> #include <chrono> -class DBFixture -{ - public: - DBFixture(); - DBFixture(const char *db_fname); +class DBFixture { +public: + DBFixture(); + DBFixture(const char *db_fname); - constexpr static const char* m_default_name = "name"; - constexpr static const char* m_default_label = "label"; + constexpr static const char *m_default_name = "name"; + constexpr static const char *m_default_label = "label"; - // ::::::::::::::::::::::::: helper methods ::::::::::::::::::::::::: - static void generate_name(unsigned int id, CKM::Name & output); - static void generate_label(unsigned int id, CKM::Label & output); - static CKM::DB::Row create_default_row(CKM::DataType type = CKM::DataType::BINARY_DATA); - static CKM::DB::Row create_default_row(const CKM::Name &name, - const CKM::Label &label, - CKM::DataType type = CKM::DataType::BINARY_DATA); - static void compare_row(const CKM::DB::Row &lhs, const CKM::DB::Row &rhs); + // ::::::::::::::::::::::::: helper methods ::::::::::::::::::::::::: + static void generate_name(unsigned int id, CKM::Name &output); + static void generate_label(unsigned int id, CKM::Label &output); + static CKM::DB::Row create_default_row(CKM::DataType type = + CKM::DataType::BINARY_DATA); + static CKM::DB::Row create_default_row(const CKM::Name &name, + const CKM::Label &label, + CKM::DataType type = CKM::DataType::BINARY_DATA); + static void compare_row(const CKM::DB::Row &lhs, const CKM::DB::Row &rhs); - // ::::::::::::::::::::::::: time measurement ::::::::::::::::::::::::: - void performance_start(const char *operation_name); - void performance_stop(long num_operations_performed); + // ::::::::::::::::::::::::: time measurement ::::::::::::::::::::::::: + void performance_start(const char *operation_name); + void performance_stop(long num_operations_performed); - // ::::::::::::::::::::::::: DB ::::::::::::::::::::::::: - void generate_perf_DB(unsigned int num_name, unsigned int num_label); - long add_full_access_rights(unsigned int num_name, unsigned int num_names_per_label); - void check_DB_integrity(const CKM::DB::Row &rowPattern); - void insert_row(); - void insert_row(const CKM::Name &name, const CKM::Label &owner_label); - void delete_row(const CKM::Name &name, const CKM::Label &owner_label); - void add_permission(const CKM::Name &name, const CKM::Label &owner_label, const CKM::Label &accessor_label); - void read_row_expect_success(const CKM::Name &name, const CKM::Label &owner_label); + // ::::::::::::::::::::::::: DB ::::::::::::::::::::::::: + void generate_perf_DB(unsigned int num_name, unsigned int num_label); + long add_full_access_rights(unsigned int num_name, + unsigned int num_names_per_label); + void check_DB_integrity(const CKM::DB::Row &rowPattern); + void insert_row(); + void insert_row(const CKM::Name &name, const CKM::Label &owner_label); + void delete_row(const CKM::Name &name, const CKM::Label &owner_label); + void add_permission(const CKM::Name &name, const CKM::Label &owner_label, + const CKM::Label &accessor_label); + void read_row_expect_success(const CKM::Name &name, + const CKM::Label &owner_label); - CKM::DB::Crypto m_db; - private: - void init(); - double performance_get_time_elapsed_ms(); + CKM::DB::Crypto m_db; - constexpr static const char* m_crypto_db_fname = "/tmp/testme.db"; - std::string m_operation; - std::chrono::high_resolution_clock::time_point m_start_time, m_end_time; +private: + void init(); + double performance_get_time_elapsed_ms(); + + constexpr static const char *m_crypto_db_fname = "/tmp/testme.db"; + std::string m_operation; + std::chrono::high_resolution_clock::time_point m_start_time, m_end_time; }; |