nats.c
nats.c copied to clipboard
C++ wrapper and mock for gtest
Hi all. I have been using the C client for a C++ project and have written a C++ wrapper and mocked the wrapper functions using Google Test. I was wondering if my patch can be included in the Nats.c repository so I will create a pull request for it?
Regards,
Hanna
@HannaKraft Not sure what you are asking here. The NATS C client is already including the proper macro to be useable by C++ applications (actually I suspect most of users using this lib use it in the context of C++). So I am not sure what your PR would be about.
I think what Hanna means is that she has created a C++ wrapper to make NATS more suitable to be called in C++. The wrapper should be quite simple as it sounds. Using it the users should be able to create a class and use C++ types i.e. std::string to invoke NATS functions, but what is more important is that using this wrapper NATS will be testable using 3rd party test platforms e.g. gtest and it will be possible to mock NATS routines and trace back functions calls and stub the functions to simulate behavior in different situations. Today the test program utilizes some internal routines i.e. test, testCond, etc. Using gtest it will be possible to stub, mock, keep track of function calls under different circumstances, and of course verify the results in more robust way and this wrapper makes it possible or at least easier to do.