MCPcopy Create free account
hub / github.com/chromium/crashpad / BadAlignmentTest

Function BadAlignmentTest

util/stdlib/aligned_allocator_test.cc:93–109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91}
92
93void BadAlignmentTest() {
94#if BUILDFLAG(IS_WIN)
95 // Suppress the assertion MessageBox() normally displayed by the CRT in debug
96 // mode. In release mode, _CrtSetReportMode() is #defined to ((int)0), so
97 // |previous| would appear unused, thus the [[maybe_unused]].
98 [[maybe_unused]] int previous =
99 _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_DEBUG);
100#endif
101
102 // Alignment constraints must be powers of 2. 7 is not valid.
103 AlignedVector<int, 7> bad_aligned_vector;
104 bad_aligned_vector.push_back(0);
105
106#if BUILDFLAG(IS_WIN)
107 _CrtSetReportMode(_CRT_ASSERT, previous);
108#endif
109}
110
111TEST(AlignedAllocatorDeathTest, BadAlignment) {
112 ASSERT_DEATH_CRASH(BadAlignmentTest(), "");

Callers 1

TESTFunction · 0.85

Calls 1

push_backMethod · 0.45

Tested by

no test coverage detected