Skip to content
Advertisement

Tag: unit-testing

How to Mock Linux System Calls in C

When writing C modules that use linux system calls, what is the best practice to mock those calls in order to test the module? Are there maybe any libraries that offer mocks for linux system calls? “my-module.h” – The interface description “my-module.c” – The module to test. “my-module.test.cpp” – The unit test the way I would expect this to work

Unit test a variable for both true and false

I’m working on a C++ production code here with googletest/googlemock. I’ve stumble upon this idea when working with one of the function in A.cpp: where the header contains: I am stuck in a way that I can only test the function for an expected output of true or an input of false like so: Is there a way to test

Advertisement