1 #include "elog_entry.hpp" 2 #include "elog_serialize.hpp" 3 #include "serialization_tests.hpp" 4 5 namespace phosphor 6 { 7 namespace logging 8 { 9 namespace test 10 { 11 12 TEST_F(TestSerialization, testProperties) 13 { 14 auto id = 99; 15 phosphor::logging::AssociationList assocations{}; 16 std::vector<std::string> testData{"additional", "data"}; 17 uint64_t timestamp{100}; 18 std::string message{"test error"}; 19 std::string fwLevel{"level42"}; 20 auto input = std::make_unique<Entry>( 21 bus, std::string(OBJ_ENTRY) + '/' + std::to_string(id), id, timestamp, 22 Entry::Level::Informational, std::move(message), std::move(testData), 23 std::move(assocations), fwLevel, manager); 24 auto path = serialize(*input, TestSerialization::dir); 25 26 auto idStr = path.filename(); 27 id = std::stol(idStr.c_str()); 28 auto output = std::make_unique<Entry>( 29 bus, std::filesystem::path(OBJ_ENTRY) / idStr, id, manager); 30 deserialize(path, *output); 31 32 EXPECT_EQ(input->id(), output->id()); 33 EXPECT_EQ(input->severity(), output->severity()); 34 EXPECT_EQ(input->timestamp(), output->timestamp()); 35 EXPECT_EQ(input->message(), output->message()); 36 EXPECT_EQ(input->additionalData(), output->additionalData()); 37 EXPECT_EQ(input->resolved(), output->resolved()); 38 EXPECT_EQ(input->associations(), output->associations()); 39 EXPECT_EQ(input->version(), output->version()); 40 EXPECT_EQ(input->purpose(), output->purpose()); 41 EXPECT_EQ(input->updateTimestamp(), output->updateTimestamp()); 42 } 43 44 } // namespace test 45 } // namespace logging 46 } // namespace phosphor 47