Unit testing non-exported classes in a DLL

前端 未结 4 1423
执笔经年
执笔经年 2021-01-31 09:05

We develop a C++ application using Visual Studio 2008 and unit test using Boost.Test. At the moment, we have a separate solution which contains our unit tests.

Many of o

4条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-31 09:24

    The solution I use for this is to build the same non-exported code into my tests DLL as well. This does increase build time and means adding everything to both projects, but saves exporting everything or putting the tests in the main product code.

    Another posibility would be to compile the non-exported code into a lib which is used by both the DLL with exports, and the unit test project.

提交回复
热议问题