Changeset View
Changeset View
Standalone View
Standalone View
source/network/tests/test_NetMessage.h
Show All 25 Lines | |||||
public: | public: | ||||
void test_sim() | void test_sim() | ||||
{ | { | ||||
ScriptInterface script("Test", "Test", g_ScriptRuntime); | ScriptInterface script("Test", "Test", g_ScriptRuntime); | ||||
JSContext* cx = script.GetContext(); | JSContext* cx = script.GetContext(); | ||||
JSAutoRequest rq(cx); | JSAutoRequest rq(cx); | ||||
JS::RootedValue val(cx); | JS::RootedValue val(cx); | ||||
script.CreateArray(&val); | ScriptInterface::CreateArray(cx, &val); | ||||
script.SetPropertyInt(val, 0, 4); | script.SetPropertyInt(val, 0, 4); | ||||
CSimulationMessage msg(script, 1, 2, 3, val); | CSimulationMessage msg(script, 1, 2, 3, val); | ||||
TS_ASSERT_STR_EQUALS(msg.ToString(), "CSimulationMessage { m_Client: 1, m_Player: 2, m_Turn: 3, m_Data: [4] }"); | TS_ASSERT_STR_EQUALS(msg.ToString(), "CSimulationMessage { m_Client: 1, m_Player: 2, m_Turn: 3, m_Data: [4] }"); | ||||
size_t len = msg.GetSerializedLength(); | size_t len = msg.GetSerializedLength(); | ||||
u8* buf = new u8[len+1]; | u8* buf = new u8[len+1]; | ||||
buf[len] = '!'; | buf[len] = '!'; | ||||
Show All 10 Lines |
Wildfire Games · Phabricator