1

I can't work out how to get unit testing to work with Boost and Eclipse. I get lots of different errors depending on where I put the source files.

Where are the tests supposed to go? (ie should I create a test folder in root, in src, no folder at all or what)

Do I need to specify something somewhere if I don't intend to have a main(), and just lots of tests?

I'm really confused, and I know I'm being quite lite on the details - hopefully you can show me the proper way to do Unit Testing with Boost in Eclipse rather than whatever I'm currently doing.

4

1 回答 1

1

在没有单元测试的情况下首先在 Eclipse 中正常编译您的应用程序。

之后,创建一个新项目并将其与您的应用程序一起引用到以前的项目。比你创建一个 main.cpp 并在那里插入你的单元测试。

您应该能够使用新项目中的其他项目类。因此,您可以实例化对象并执行您的断言或任何您喜欢的操作。如果您还有其他问题,请发布您的实际错误并提供您当前结构的屏幕截图。

于 2012-09-06T13:08:51.890 回答