开源回归套件

发布于 2024-09-06 10:16:52 字数 1539 浏览 13 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

那一片橙海, 2024-09-13 10:16:52

查看 TAP 进行单元测试。 Perl 使用它来测试 Perl 的内部结构(特别是 CPAN 提交),CCAN 采用了它。我假设是 C(你确实说过a.out)。然后,如果 NDEBUG 未定义,则在读取 2,2(暗示 3 个字节)时,只需使读取函数失败。

您可以使用其他东西,例如 -DUNIT_TESTS_RUNNING,只需注意依赖关系。

再说一遍,如果您正在测试的函数返回一个字符串..无需打扰预处理器,让测试弄清楚这一点。

TAP 确实非常容易集成。您可以在此处找到我的临时Valgrind 感知版本< /a>.请注意,这是不正确的,该存储库一团糟,但值得展示的是让其他工具与 TAP 一起工作是多么容易。

顺便说一句, TAP : (T)est (A)nything (P)rotocol

如果这不是 C,您需要重新标记您的问题。

Have a look at TAP for unit testing. Its what Perl uses for testing the innards of Perl (specifically CPAN submissions), CCAN adopted it. I'm assuming C (you did say a.out). Then, simply make your read function fail if 2,2 is read (hinting on 3 bytes) if NDEBUG is not defined.

You could use something else, like -DUNIT_TESTS_RUNNING, just watch out for dependencies.

Then again, if the function you are testing returns a string .. no need to bother the preprocessor, let the test figure that out.

TAP is really, really easy to integrate. You can find my ad-hoc Valgrind aware version here. Note, that is not proper, that repo is a mess, but worth showing how easy it is to make other tools work with TAP.

Incidentally, TAP : (T)est (A)nything (P)rotocol

If this is NOT C, you need to re-tag your question.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文