DarkflameServer/tests/TestLDFFormat.cpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

32 lines
783 B
C++
Raw Permalink Normal View History

2022-01-03 15:00:21 +00:00
#include "LDFFormat.h"
#include "CommonCxxTests.h"
/**
* @brief Test parsing an LDF value
*
* @param argc Number of command line arguments for this test
* @param argv Command line arguments
* @return 0 on success, non-zero on failure
*/
2022-01-05 09:06:34 +00:00
int TestLDFFormat(int argc, char** const argv) {
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
ASSERT_EQ(((LDFData<std::u16string>*)data)->GetValue(), u"VALUE");
// Check that the serialization is correct
ASSERT_EQ(data->GetString(), "KEY=0:VALUE");
// Cleanup the object
delete data;
return 0;
}