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
Tag: unit-testing
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
Host testing C program with hard coded memory addresses
We will write functional/unit tests for C code. This C program will be run as embedded software. However we need to run tests on a Linux environment. The problem is that parts of the code under test looks like this: my_addresses.h: my_code.c Obviously, this will not run so well on Linux host environment. Is there some way we can work