本文介绍了UnitTest ++和main的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想给TDD一个尝试,我选择了UnitTest ++框架,但文档几乎不存在(据我所知)。

I want to give TDD a try and I've chosen the UnitTest++ framework, but the documentations is almost non-existent (to my knowledge).

我的关注这是:在我看过的所有教程中,他们在 main() UnitTest :: RunAllTests() >功能。我猜他们这样做只是为了简化说明,但我不想要我的软件。我应该把 UnitTest :: RunAllTests()放在哪里,这样我可以在每次构建软件时执行它,而不是在运行它时执行?

My concern is this: in all the tutorials I've seen, they put UnitTest::RunAllTests() in the main() function. I'm guessing they do it only to simplify the explanation, but I wouldn't want that with my software. Where should I put UnitTest::RunAllTests() so that I can have it executed every time I build the software but not when I run it?

推荐答案

UnitTest :: RunAllTests()应放入 / code>函数作为单独的程序,您可以编译并作为构建过程的一部分运行。

UnitTest::RunAllTests() should be put into the main function of a separate program, which you compile and run as part of your build process.

这篇关于UnitTest ++和main的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-10 00:07