mirror of
https://github.com/thunderbrewhq/common.git
synced 2025-12-12 03:02:29 +00:00
47 lines
1,023 B
C++
47 lines
1,023 B
C++
#include "common/DataStore.hpp"
|
|
#include "test/Test.hpp"
|
|
|
|
TEST_CASE("CDataStore::CDataStore", "[datastore]") {
|
|
SECTION("constructs new data store") {
|
|
CDataStore msg;
|
|
SUCCEED();
|
|
}
|
|
}
|
|
|
|
TEST_CASE("CDataStore::Get", "[datastore]") {
|
|
SECTION("gets uint8_t") {
|
|
uint8_t writeVal = 8;
|
|
uint8_t readVal = -1;
|
|
|
|
CDataStore msg;
|
|
msg.Put(writeVal);
|
|
msg.Finalize();
|
|
msg.Get(readVal);
|
|
|
|
REQUIRE(readVal == writeVal);
|
|
}
|
|
|
|
SECTION("gets uint32_t") {
|
|
uint32_t writeVal = 0x12345678;
|
|
uint32_t readVal = 0x12345678;
|
|
|
|
CDataStore msg;
|
|
msg.Put(writeVal);
|
|
msg.Finalize();
|
|
msg.Get(readVal);
|
|
|
|
REQUIRE(readVal == writeVal);
|
|
}
|
|
|
|
SECTION("gets uint64_t") {
|
|
uint64_t writeVal = 0x1122334455667788;
|
|
uint64_t readVal = 0x1122334455667788;
|
|
|
|
CDataStore msg;
|
|
msg.Put(writeVal);
|
|
msg.Finalize();
|
|
msg.Get(readVal);
|
|
|
|
REQUIRE(readVal == writeVal);
|
|
}
|
|
}
|