MCPcopy Create free account
hub / github.com/codereader/DarkRadiant / verifyAllocation

Function verifyAllocation

test/GeometryStore.cpp:19–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17TestBufferObjectProvider _testBufferObjectProvider;
18
19inline void verifyAllocation(render::IGeometryStore& store, render::IGeometryStore::Slot slot,
20 const std::vector<render::RenderVertex>& vertices, const std::vector<unsigned int>& indices)
21{
22 auto renderParms = store.getBufferAddresses(slot);
23
24 auto expectedIndex = indices.begin();
25 auto firstVertex = renderParms.clientBufferStart + renderParms.firstVertex;
26
27 EXPECT_EQ(renderParms.indexCount, indices.size()) << "Index count mismatch";
28
29 for (auto idxPtr = renderParms.clientFirstIndex; idxPtr < renderParms.clientFirstIndex + renderParms.indexCount; ++idxPtr)
30 {
31 auto index = *idxPtr;
32 EXPECT_EQ(index, *expectedIndex) << "Index disorder";
33
34 // Pick the vertex from our local expectation
35 const auto& expectedVertex = vertices.at(index);
36
37 // Pick the vertex from the stored set
38 const auto& vertex = *(firstVertex + index);
39
40 EXPECT_TRUE(math::isNear(vertex.vertex, expectedVertex.vertex, 0.01)) << "Vertex data mismatch";
41 EXPECT_TRUE(math::isNear(vertex.texcoord, expectedVertex.texcoord, 0.01)) << "Texcoord data mismatch";
42 EXPECT_TRUE(math::isNear(vertex.normal, expectedVertex.normal, 0.01)) << "Normal data mismatch";
43
44 ++expectedIndex;
45 }
46}
47
48struct Allocation
49{

Callers 2

verifyAllAllocationsFunction · 0.85
TESTFunction · 0.85

Calls 4

getBufferAddressesMethod · 0.80
isNearFunction · 0.50
beginMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected