Mocking C++
summary
Creates mocks by overwriting vtable entries and filling a fake vtable with stub function pointers, uses reinterpret_cast hacks to plant member function pointers and a stub that throws exceptions from stubs to signal unexpected calls. Shows how expectations are recorded as argument tuples and validated in destructors, reports working on OS X Linux Windows and embedded ARM with MSVC valgrind and other dynamic checkers, claims cross‑platform reliability, and points to hip amongst and comply for safer C++14/11 implementations.
AI-written summary · about
chapters (7)
- 0:00Start
- 0:01Situation
- 0:32Does this work?
- 1:22Object layout in memory
- 1:48Virtual member function pointer layout
- 3:27And then to expect a call
- 5:58Mocking C++ made simple
related talks
01h 01m“Mocking Frameworks considered harmful”
04mUsing C++14 to mock C functions
01h 18mMocking Framworks considered, harmful?!
53mUsing Trompeloeil - a mocking framework for modern C++
53mC++ Unit testing - the good, the bad & the ugly
01h 01mAdvanced Unit Testing in C & C++
59mC++ Unit testing - the good, the bad & the ugly
30mMocks, Stubs, and Spies, Oh My
