Show HN: MiniMock, a minimalist, header-only, C/C++ mock library https://ift.tt/L0TCbaK
Show HN: MiniMock, a minimalist, header-only, C/C++ mock library Hello HN! Here is MiniMock : a minimalist, header-only, C/C++ mock library. It's a side project of my current side project. MiniMock is a tentative to create a mock library that is : - quick and easy to integrate, - quick and easy to learn, - quick and easy to use. In short, MiniMock offers basic mock features by providing only 9 macros : - 3 macros to structure tests : BEGIN_TESTS, TEST, END_TESTS. - 4 macros to compare things : EXPECT, EXPECT_MSG, ASSERT_MSG, NEAR. - 2 macros to mock functions : MINI_MOCK_FUNCTION, MINI_MOCK_ON_CALL. And it relies on native C++ language to do everything else. The repo contains a readme and a minimal example to have an idea. Currently it's a quick-and-dirty-proof-of-concept but I'm interested to know if this approach seems appealing to you. Also let me know if something similar exists, I would be happy to use it instead of reinventing the wheel. A little more context on why I started MiniMock : - All mock frameworks that I know are full-featured, heavy and complex, they require a lot of time and energy to learn and use. - However my needs for mocks are really basic, mocking a function or comparing two variables are conceptually very simple things. - So I naively believe that doing a simple thing could be simple. - So I started MiniMock even if (or because) I'm not a mocking-guru. English is not my native language, please let me know if something isn't clear in the readme or in the discussion. Thanks https://ift.tt/YV1Psfb March 1, 2023 at 05:33PM
No comments