使用Boost和Eclipse进行单元测试

编程入门 行业动态 更新时间:2024-10-26 22:23:28
本文介绍了使用Boost和Eclipse进行单元测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我不知道如何使单元测试与Boost和Eclipse一起使用. 根据放置源文件的位置,我会遇到很多不同错误.

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.

应该去哪里考试? (即我应该在根目录,src目录中创建一个测试文件夹,还是根本没有文件夹)

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

如果我不打算拥有main()并且仅进行大量测试,是否需要在某处指定某些内容?

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

我真的很困惑,我知道我对细节很了解-希望您可以向我展示使用Eclipse中的Boost进行单元测试的正确方法,而不是我目前正在做的事情.

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.

推荐答案

以eclipse的第一标准编译应用程序,而无需进行单元测试.

Compile your application in eclipse first normal without unit tests.

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

After that create a new Project and reference it to the former Project with your application. Than you create a main.cpp and insert your unit tests there.

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

You should be able to use the other projects classes from the new Project. Therefore, you are able to Instantiate Objects and do your asserts or whatever you like. If you have any further questions, please post your actual error and provide a screen-shot of your current structure.

更多推荐

使用Boost和Eclipse进行单元测试

本文发布于:2023-06-13 09:33:15,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/678971.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:单元测试   Boost   Eclipse

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!