vendredi 31 mai 2019

Is it possible to mock non member functions?

I am writing some for my c++ code. In my productive code, I am using functions to work with shared memory, in particular shm_open. As I see in the ForDumies.md of , the mock class should inherit from a class.

Well, the function shm_open is not a member function of any class, from which I can inherit.

Is it possible to mock such a function?

My objective is to control from my own test the expected return value from the shm_open function, so that I can test my error handling in my productive code.

Aucun commentaire:

Enregistrer un commentaire