Changeset View
Changeset View
Standalone View
Standalone View
source/simulation2/tests/test_SerializeTemplates.h
Show All 29 Lines | |||||
{ | { | ||||
public: | public: | ||||
void test_Debug_array() | void test_Debug_array() | ||||
{ | { | ||||
ScriptInterface script("Test", "Test", g_ScriptRuntime); | ScriptInterface script("Test", "Test", g_ScriptRuntime); | ||||
std::stringstream stream; | std::stringstream stream; | ||||
CDebugSerializer serialize(script, stream); | CDebugSerializer serialize(script, stream); | ||||
std::array<u32, 6> value = { | std::array<u32, 6> value = { { | ||||
3, 0, 1, 4, 1, 5 | 3, 0, 1, 4, 1, 5 | ||||
}; | } }; | ||||
SerializeArray<SerializeU32_Unbounded>()(serialize, "E", value); | SerializeArray<SerializeU32_Unbounded>()(serialize, "E", value); | ||||
TS_ASSERT_STR_EQUALS(stream.str(), "E: 3\nE: 0\nE: 1\nE: 4\nE: 1\nE: 5\n"); | TS_ASSERT_STR_EQUALS(stream.str(), "E: 3\nE: 0\nE: 1\nE: 4\nE: 1\nE: 5\n"); | ||||
} | } | ||||
void test_Debug_vector() | void test_Debug_vector() | ||||
{ | { | ||||
ScriptInterface script("Test", "Test", g_ScriptRuntime); | ScriptInterface script("Test", "Test", g_ScriptRuntime); | ||||
std::stringstream stream; | std::stringstream stream; | ||||
CDebugSerializer serialize(script, stream); | CDebugSerializer serialize(script, stream); | ||||
std::vector<u32> value = { | std::vector<u32> value = { { | ||||
3, 0, 1, 4, 1, 5 | 3, 0, 1, 4, 1, 5 | ||||
}; | } }; | ||||
SerializeVector<SerializeU32_Unbounded>()(serialize, "E", value); | SerializeVector<SerializeU32_Unbounded>()(serialize, "E", value); | ||||
TS_ASSERT_STR_EQUALS(stream.str(), "length: 6\nE: 3\nE: 0\nE: 1\nE: 4\nE: 1\nE: 5\n"); | TS_ASSERT_STR_EQUALS(stream.str(), "length: 6\nE: 3\nE: 0\nE: 1\nE: 4\nE: 1\nE: 5\n"); | ||||
} | } | ||||
void test_Debug_set() | void test_Debug_set() | ||||
{ | { | ||||
ScriptInterface script("Test", "Test", g_ScriptRuntime); | ScriptInterface script("Test", "Test", g_ScriptRuntime); | ||||
std::stringstream stream; | std::stringstream stream; | ||||
CDebugSerializer serialize(script, stream); | CDebugSerializer serialize(script, stream); | ||||
std::set<u32> value = { | std::set<u32> value = { { | ||||
vladislavbelov: Are you sure that you got warnings for `std::set` as well? | |||||
StanAuthorUnsubmitted Done Inline ActionsActually it seems not. Stan: Actually it seems not. | |||||
3, 0, 1, 4, 1, 5 | 3, 0, 1, 4, 1, 5 | ||||
}; | } }; | ||||
SerializeSet<SerializeU32_Unbounded>()(serialize, "E", value); | SerializeSet<SerializeU32_Unbounded>()(serialize, "E", value); | ||||
TS_ASSERT_STR_EQUALS(stream.str(), "size: 5\nE: 0\nE: 1\nE: 3\nE: 4\nE: 5\n"); | TS_ASSERT_STR_EQUALS(stream.str(), "size: 5\nE: 0\nE: 1\nE: 3\nE: 4\nE: 5\n"); | ||||
} | } | ||||
void test_Debug_grid() | void test_Debug_grid() | ||||
{ | { | ||||
ScriptInterface script("Test", "Test", g_ScriptRuntime); | ScriptInterface script("Test", "Test", g_ScriptRuntime); | ||||
std::stringstream stream; | std::stringstream stream; | ||||
Show All 15 Lines |
Wildfire Games · Phabricator
Are you sure that you got warnings for std::set as well?