MCPcopy Create free account
hub / github.com/ddnet/ddnet / TEST

Function TEST

src/test/snapshot_test.cpp:9–27  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7#include <gtest/gtest.h>
8
9TEST(Snapshot, CrcOneInt)
10{
11 CSnapshotBuilder Builder;
12 Builder.Init();
13
14 CNetObj_Flag Flag;
15 void *pItem = Builder.NewItem(CNetObj_Flag::ms_MsgId, 0, sizeof(Flag));
16 ASSERT_FALSE(pItem == nullptr);
17 Flag.m_X = 4;
18 Flag.m_Y = 0;
19 Flag.m_Team = 0;
20 mem_copy(pItem, &Flag, sizeof(Flag));
21
22 char aData[CSnapshot::MAX_SIZE];
23 CSnapshot *pSnapshot = (CSnapshot *)aData;
24 Builder.Finish(pSnapshot);
25
26 ASSERT_EQ(pSnapshot->Crc(), 4);
27}
28
29TEST(Snapshot, CrcTwoInts)
30{

Callers

nothing calls this directly

Calls 5

mem_copyFunction · 0.85
NewItemMethod · 0.80
InitMethod · 0.45
FinishMethod · 0.45
CrcMethod · 0.45

Tested by

no test coverage detected