问题标签 [cppunit]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
322 浏览

embedded - 一组一致且简单的 IDE 和工具,用于 C++ 中的嵌入式代码和单元测试?

我正在为 Texas Instrument C283xx 和 C6xxx 目标使用C++启动一个新固件项目。单元测试不会在 target 上运行,但将在带有 windows 的 PC 上使用gcc/gcov编译(并且在 PC 上也可以运行),并带有测试代码覆盖率的简单指标。

整个项目将成为 Cruise Control.NET 的一部分,用于持续集成。

我的问题是:有哪些一致的 IDE/框架/工具可以协同工作?

A/ 一位开发人员说CodeComposerStudio V3.1用于应用程序和CodeBlocks + CxxUnit用于单元测试。

B/ 我更喜欢CodeComposerStudio V4应用程序、Eclipse CDT(以及 CCS V4)和CppUnit用于单元测试 + MockCpp用于模拟。

我不想要每个流程都使用一流的工具,而是想要一个全局的、一致的和简单的解决方案(或者如果您愿意,可以使用一组工具)。

0 投票
2 回答
1776 浏览

c++ - 使用 CppUnit 进行“小于”测试

我是 CppUnit 的新手。有没有办法断言一个值必须小于零?我正在寻找与CPPUNIT_ASSERT_EQUAL(). 我在想可能有一个名为CPPUNIT_ASSERT_LESS_THAN().

0 投票
1 回答
1920 浏览

c++ - Specifying test dependencies in CppUnit?

I would like to specify the order of testing in CppUnit. According to my research, the testing order depends on either the compiler or linker and how they came across the files.

How does one specify dependencies in CppUnit?

For example, let us consider a rectangle class that has four lines. Each line contains two point classes. Assume that each class is in a separate module or translation unit.

In the above code, the Point class should be tested first, then the Line class and finally the Rectangle class. There is no reason to test the Rectangle class if the Line or Point classes have problems. This is a very simplified example.

For composite classes, the inner classes or member data type classes should be test first.

Let us assume that each class has an associated testing class. Each test class has its own published test methods (which are registered to the CppUnit list), in separate files. The class for testing Lines has no knowledge of the testing class for points; and similar for the rectangle. When these test case classes are compiled, their order is dependent on the compiler and linker.

So, how does one order the test cases?

FYI, I am using CppUnit, wxTestRunner and Visual Studio 2008

0 投票
2 回答
12716 浏览

c++ - boost.test 与 CppUnit

我已经使用 CppUnit 有一段时间了(并且很满意)。随着我们使用越来越多的 boost 库的部分,我对 boost.test 做了一个简短的了解,现在我想知道是否应该在新项目中切换到 boost.test。

谁能告诉我这两个框架之间的区别以及使用 boost.test 的好处(如果有的话)?

0 投票
0 回答
817 浏览

cppunit - cppunit_cookbook 关于 addTest 的示例似乎不起作用

我正在尝试使用 CppUnit 测试,这是从CppUnit Cookbook借来的简单测试代码。该系统是带有 g++ 4.2.1 的 Mac OS X。

当我运行它时,我收到以下错误。

以下等效代码可以正常工作。可能有什么问题?第一个(之前的)示例是否已过时?

0 投票
1 回答
1451 浏览

c++ - CppUnit 中的类似 TestFixtureSetUp 的方法

在 NUnit 中,TestFixtureSetup 属性可用于标记应在夹具中的任何测试之前执行一次的方法。

CppUnit中有类似的概念吗?

如果没有,是否有支持此概念的 C++ 单元测试框架?

根据下面的答案,这是一个完成此操作的示例(遵循问题答案的建议):

0 投票
1 回答
82 浏览

c++ - 如何在 Visual Studio 2008 的 cpp 项目中使用外部 cpp 项目

我试图通过使用 cppunit 制作小型测试驱动示例。所以我有 2 个项目,分别是测试和普通库项目。无论我做什么,我都无法成功。我得到了所有时间的 LNK 错误。任何帮助将不胜感激。

0 投票
1 回答
311 浏览

boost - Boost.Test 或 cppUnit 是否有任何扩展可以提供 HTML 输出等?

我参与了我们项目的单元级测试用例的开发。有托管代码和本机 C++ 代码。经过一番研究,我选择了 NUnit 作为托管代码。我会使用 Gallio 或 FireBenchmarks,这是提供 HTML 输出和图表等的扩展。

我们对 cppUnit 或 Boost.Test 有这样的扩展吗?我还没有决定使用哪一个。如果没有,哪些更容易扩展以启用这样的插件?

请就此提出您的建议。

0 投票
1 回答
5627 浏览

c++ - C++ CppUnitTest (CPPUNIT_ASSERT_EQUAL)

我正在尝试使用 Ubuntu NetBeans 对我的程序进行一些 CppUnit 测试,但我不断遇到类似的错误(无效使用 void 表达式)。我不确定出了什么问题。任何帮助将不胜感激。

错误是这样的:

我的作业测试.cpp:

我的作业测试.h:

我的 GetInfo.h:

0 投票
2 回答
2629 浏览

c++ - C++ CppUnit 测试 (CPPUNIT_ASSERT)

我正在尝试完成屏幕抓取任务。我的 cpp 工作,但我不知道如何集成我的单元测试。我试图对文件有效性进行布尔检查单元测试,但它给了我这个错误:

屏幕截图.cpp:

屏幕截图.h:

屏幕截图测试.cpp:

屏幕截图测试.h:

我试图声明“ScreenScrape ss;” 在screenscrapetest.h下,使用一个对象(ss)来调用getFile(),但它给了我这个错误的倍数:

我只想通过单元测试检查文件的有效性。任何帮助将不胜感激。提前致谢!

问候,华莱士