TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Show HN: MiniMock, a minimalist, header-only, C/C++ mock library

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

暂无评论

暂无评论