~/talk

Using C++14 to mock C functions

Talkat CppCon 2016 · 2016-09-18..09-23· [testing, c-and-cpp]
links:none on file
slides:none on file

Uses C++14 macros and templates to mock C functions at test time, specifically replacing libc-style send(fd,buf,len,flags) with a test lambda or programmable mock; library called preach is header-only, scope-bound (RAII) so replacements last until block exit, and avoids singletons or stringly-typed expectations. Works with real socket signatures, enforces type-safe mocks, supports queued return values and call-count/argument expectations. Requires a simple build-time symbol remap (or compile switch) and the runtime macro implementation; demos show it working.

AI-written summary · about

~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.