googletest参数化的高级使用

Advanced use of googletest's parameterization

我有几个关于 googletest 框架及其用法的问题:

By fixture in the following questions I mean a class derived from ::testing::Test

  1. 据我所知,我可以将 fixture 与 gtest 的 parameterization feature 一起使用。这是否适用于value-parameterizationtype-parameterization

  2. 有些情况下夹具是无关紧要的。我可以使用 type-parameterizationvalue-parameterization 而没有 fixture 吗?如何(例子会很好)?

  3. 纯兴趣: 我可以fixture 一起使用type- value-parameterization? (我很确定这是不必要的复杂性)

As far as I know, I can use fixture along with parameterization feature of gtests. Does this apply to both value-parameterization and type-parameterization?

是的,都value-parameterized tests typed teststype-parameterized tests 必须来自固定装置 class。链接的文档提供了示例。

Can I use type-parameterization with value-parameterization without fixture

我猜你的意思是 "type-parameterization OR value-parameterization"。无论如何,你不能 根据相同的文档,在没有固定装置 class 的情况下使用。

Can I use fixture together with type- and value-parameterization?

Googletest 不明确支持 type-and-value-parameterized 测试, 但你可以通过 type-parameterized 测试对其进行很好的近似, 正如我在 a previous answer

中所说明的