Boost logo

Boost :

Subject: [boost] Preferred way to simulate system calls
From: James E. King, III (jking_at_[hidden])
Date: 2017-11-06 22:00:41


I like to test every branch, and I have a class that calls
open/read/close. It uses a hardcoded filename ("/dev/urandom"). It is a
template in a detail namespace. What's the "boost way" when it comes to
mocking these system calls? Should I make protected methods that normally
call open/read/close, then subclass in a test and override them with
different logic to force error paths?

- Jim


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk