Luanti 5.16.0-dev
Loading...
Searching...
No Matches
TestSerialization Class Reference
Inheritance diagram for TestSerialization:
Collaboration diagram for TestSerialization:

Public Member Functions

 TestSerialization ()
const char * getName ()
void runTests (IGameDef *gamedef)
void buildTestStrings ()
void testSerializeString ()
void testSerializeLongString ()
void testSerializeJsonString ()
void testDeSerializeString ()
void testDeSerializeLongString ()
void testStreamRead ()
void testStreamWrite ()
void testFloatFormat ()
Public Member Functions inherited from TestBase
bool testModule (IGameDef *gamedef)
std::string getTestTempDirectory ()
std::string getTestTempFile ()
void runTest (const char *name, std::function< void()> &&test)

Public Attributes

std::string teststring2
std::wstring teststring2_w
std::string teststring2_w_encoded
Public Attributes inherited from TestBase
u32 num_tests_failed
u32 num_tests_run

Static Public Attributes

static const u8 test_serialized_data [12 *11 - 2]

Constructor & Destructor Documentation

◆ TestSerialization()

TestSerialization::TestSerialization ( )
inline

References TestManager::registerTestModule().

Here is the call graph for this function:

Member Function Documentation

◆ buildTestStrings()

void TestSerialization::buildTestStrings ( )

References teststring2, teststring2_w, and teststring2_w_encoded.

Referenced by runTests().

Here is the caller graph for this function:

◆ getName()

const char * TestSerialization::getName ( )
inlinevirtual

Implements TestBase.

◆ runTests()

void TestSerialization::runTests ( IGameDef * gamedef)
virtual

Implements TestBase.

References buildTestStrings(), TEST, testDeSerializeLongString(), testDeSerializeString(), testFloatFormat(), testSerializeJsonString(), testSerializeLongString(), testSerializeString(), testStreamRead(), and testStreamWrite().

Here is the call graph for this function:

◆ testDeSerializeLongString()

void TestSerialization::testDeSerializeLongString ( )

References deSerializeString32(), EXCEPTION_CHECK, mkstr(), serializeString32(), teststring2, and UASSERT.

Referenced by runTests().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ testDeSerializeString()

void TestSerialization::testDeSerializeString ( )

References canRead(), deSerializeString16(), EXCEPTION_CHECK, mkstr(), readU16(), readU8(), serializeString16(), teststring2, and UASSERT.

Referenced by runTests().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ testFloatFormat()

void TestSerialization::testFloatFormat ( )

References f32Tou32Slow(), FLOATTYPE_SLOW, getFloatSerializationType(), u32Tof32Slow(), and UASSERT.

Referenced by runTests().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ testSerializeJsonString()

void TestSerialization::testSerializeJsonString ( )

References deSerializeJsonString(), deSerializeJsonStringIfNeeded(), mkstr(), serializeJsonString(), serializeJsonStringIfNeeded(), teststring2, UASSERT, and UASSERTEQ.

Referenced by runTests().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ testSerializeLongString()

void TestSerialization::testSerializeLongString ( )

References mkstr(), serializeString32(), teststring2, and UASSERT.

Referenced by runTests().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ testSerializeString()

void TestSerialization::testSerializeString ( )

References mkstr(), serializeString16(), teststring2, and UASSERT.

Referenced by runTests().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ testStreamRead()

void TestSerialization::testStreamRead ( )

References deSerializeString16(), deSerializeString32(), F1000_MAX, F1000_MIN, readARGB8(), readF1000(), readS16(), readS32(), readS64(), readS8(), readU16(), readU32(), readU64(), readU8(), readV2S16(), readV2S32(), readV3F1000(), readV3S16(), readV3S32(), test_serialized_data, and UASSERT.

Referenced by runTests().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ testStreamWrite()

void TestSerialization::testStreamWrite ( )

References F1000_MAX, F1000_MIN, serializeString16(), serializeString32(), test_serialized_data, UASSERT, writeARGB8(), writeF1000(), writeS16(), writeS32(), writeS64(), writeS8(), writeU16(), writeU32(), writeU64(), writeU8(), writeV2S16(), writeV2S32(), writeV3F1000(), writeV3S16(), and writeV3S32().

Referenced by runTests().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ test_serialized_data

const u8 TestSerialization::test_serialized_data
static
Initial value:
= {
0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc,
0xdd, 0xee, 0xff, 0x80, 0x75, 0x30, 0xff, 0xff, 0xff, 0xfa, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xd5, 0x00, 0x00, 0xd1, 0x1e, 0xee, 0x1e,
0x5b, 0xc0, 0x80, 0x00, 0x02, 0x80, 0x7F, 0xFF, 0xFD, 0x80, 0x00, 0x07,
0x66, 0x6f, 0x6f, 0x62, 0x61, 0x72, 0x21, 0x01, 0xf4, 0x01, 0xf4, 0x10,
0x6f, 0x02, 0x5c, 0xff, 0xe2, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0x04,
0x38, 0xff, 0xff, 0xfe, 0x70, 0x00, 0x61, 0xa8, 0x36, 0x11, 0x51, 0x70,
0x5f, 0x00, 0x07, 0xa1, 0x20, 0x00, 0x98, 0xf5, 0x08, 0xff,
0xfd, 0x0f, 0xe4, 0xff, 0x80, 0x32, 0x80, 0x00, 0x00, 0x00, 0x17, 0x73,
0x6f, 0x6d, 0x65, 0x20, 0x6c, 0x6f, 0x6e, 0x67, 0x65, 0x72, 0x20, 0x73,
0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x68, 0x65, 0x72, 0x65, 0xF0, 0x0D,
}

Referenced by testStreamRead(), and testStreamWrite().

◆ teststring2

◆ teststring2_w

std::wstring TestSerialization::teststring2_w

Referenced by buildTestStrings().

◆ teststring2_w_encoded

std::string TestSerialization::teststring2_w_encoded

Referenced by buildTestStrings().


The documentation for this class was generated from the following file: