yeg*_*256 8 c++ boost boost-test
我有一个包含50多个.H/.CPP文件/类的项目.我想用自己的测试用例测试每个类,其中包括测试每个类的不同方面的方法.我的类位于不同的目录中,如下所示:
/project
/include
/SuperModule
Foo.h
Foo.cpp
..
Alpha.h
Alpha.cpp
..
/test // I assume that my tests shall be here
main.cpp
Makefile
Run Code Online (Sandbox Code Playgroud)
我想使用boost :: test作为单元测试框架.我应该如何组织我的文件,如何命名,等等.一些提示或链接或建议将不胜感激.谢谢.
我们在类似的布局中使用 boost::test 。我们的布局是——
/project
/include
/SuperModule
/Foo
foo.c
foo.h
/foo_unittest
foo_unittest.c // note - no separate header file is required
// for boost::test unit test.exe program.
Run Code Online (Sandbox Code Playgroud)
基本布局规则是将类的单元测试放在与源代码同一目录中的类后面名为“foo_unittest”的子目录中。这种命名的好处是
由于我们的项目不太复杂(30-50 个主要类别),因此该系统适合我们。如果您正在运行较大的项目,我认为这不是最佳解决方案。