mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-10-20 22:38:08 +00:00
Basic tests infrastructure
This commit is contained in:
31
tests/TestLDFFormat.cpp
Normal file
31
tests/TestLDFFormat.cpp
Normal file
@@ -0,0 +1,31 @@
|
||||
#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
|
||||
*/
|
||||
int TestLDFFormat(int argc, char** argv) {
|
||||
// Create
|
||||
auto* data = LDFBaseData::DataFromString("KEY=0:VALUE");
|
||||
|
||||
// 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;
|
||||
}
|
Reference in New Issue
Block a user