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

Function TEST

CppCoverageTest/BreakPointTest.cpp:79–108  ·  view source on GitHub ↗

-------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

77
78 //-------------------------------------------------------------------------
79 TEST(BreakPointTest, SetBreakPoints)
80 {
81 BreakPoint breakPoint;
82
83 auto values = GenerateValues(20000, 100);
84 auto randomIndexes = GetRandomIndexes(100, static_cast<int>(values.size() - 1));
85
86 std::vector<DWORD64> addresses;
87 for (auto index : randomIndexes)
88 addresses.push_back(ToDWORD64(&values[index]));
89
90 auto oldInstructionCollection = breakPoint.SetBreakPoints(
91 GetCurrentProcess(), std::move(addresses));
92 auto oldInstructionsMap =
93 BuildOldInstructionsMap(oldInstructionCollection, addresses);
94
95 for (size_t i = 0; i < values.size(); ++i)
96 {
97 auto address = ToDWORD64(&values[i]);
98 auto it = oldInstructionsMap.find(address);
99
100 if (it != oldInstructionsMap.end())
101 {
102 ASSERT_EQ(BreakPoint::breakPointInstruction, values[i]);
103 ASSERT_EQ(i % 100, it->second);
104 }
105 else
106 ASSERT_EQ(i % 100, values[i]);
107 }
108 }
109
110 //-------------------------------------------------------------------------
111 TEST(BreakPointTest, SetBreakPointsSingle)

Callers

nothing calls this directly

Calls 5

GenerateValuesFunction · 0.85
GetRandomIndexesFunction · 0.85
ToDWORD64Function · 0.85
BuildOldInstructionsMapFunction · 0.85
SetBreakPointsMethod · 0.80

Tested by

no test coverage detected