2022-01-03 15:00:21 +00:00
|
|
|
#include "LDFFormat.h"
|
2022-11-07 08:12:35 +00:00
|
|
|
#include <gtest/gtest.h>
|
2022-01-03 15:00:21 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Test parsing an LDF value
|
|
|
|
*/
|
2022-11-07 08:12:35 +00:00
|
|
|
TEST(dCommonTests, LDFTest) {
|
2022-01-03 15:00:21 +00:00
|
|
|
// Create
|
|
|
|
auto* data = LDFBaseData::DataFromString("KEY=0:VALUE");
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2022-01-03 15:00:21 +00:00
|
|
|
// Check that the data type is correct
|
|
|
|
ASSERT_EQ(data->GetValueType(), eLDFType::LDF_TYPE_UTF_16);
|
|
|
|
|
|
|
|
// Check that the key is correct
|
|
|
|
ASSERT_EQ(data->GetKey(), u"KEY");
|
|
|
|
|
|
|
|
// Check that the value is correct
|
2022-07-28 13:39:57 +00:00
|
|
|
ASSERT_EQ(((LDFData<std::u16string>*)data)->GetValue(), u"VALUE");
|
2022-01-03 15:00:21 +00:00
|
|
|
|
|
|
|
// Check that the serialization is correct
|
|
|
|
ASSERT_EQ(data->GetString(), "KEY=0:VALUE");
|
|
|
|
|
|
|
|
// Cleanup the object
|
|
|
|
delete data;
|
|
|
|
}
|