GoogleTest系列:TEST_P的基本用法
一、代码部分
#include <gtest/gtest.h>class Bis
{
public:bool Even(int n) {if (n % 2 == 0) {return true;}else {return false;}};bool Suc(bool bSuc) {return bSuc;}
};class CombineTest : public ::testing::TestWithParam< ::testing::tuple<bool, int> > {
protected:bool checkData() {bool suc = ::testing::get<0>(GetParam());int n = ::testing::get<1>(GetParam());return bis.Suc(suc) && bis.Even(n);}
private:Bis bis;
};TEST_P(CombineTest, Test) {EXPECT_TRUE(checkData());
}INSTANTIATE_TEST_CASE_P(TestBisValuesCombine, CombineTest, ::testing::Combine(::testing::Bool(), ::testing::Values(0, 1, 2, 3, 4)));
二、结果部分
Running main() from external/googletest/googletest/src/gtest_main.cc
[==========] Running 10 tests from 1 test suite.
[----------] Global test environment set-up.
[----------] 10 tests from TestBisValuesCombine/CombineTest
[ RUN ] TestBisValuesCombine/CombineTest.Test/0
vendor/mediatek/tests/vendor/HIDL_FORMATTER/interface/1.0/HIDL_FORMATTERV1_0AIT.cpp:38: Failure
Value of: checkData()Actual: false
Expected: true
[ FAILED ] TestBisValuesCombine/CombineTest.Test/0, where GetParam() = (false, 0) (0 ms)
[ RUN ] TestBisValuesCombine/CombineTest.Test/1
vendor/mediatek/tests/vendor/HIDL_FORMATTER/interface/1.0/HIDL_FORMATTERV1_0AIT.cpp:38: Failure
Value of: checkData()Actual: false
Expected: true
[ FAILED ] TestBisValuesCombine/CombineTest.Test/1, where GetParam() = (false, 1) (0 ms)
[ RUN ] TestBisValuesCombine/CombineTest.Test/2
vendor/mediatek/tests/vendor/HIDL_FORMATTER/interface/1.0/HIDL_FORMATTERV1_0AIT.cpp:38: Failure
Value of: checkData()Actual: false
Expected: true
[ FAILED ] TestBisValuesCombine/CombineTest.Test/2, where GetParam() = (false, 2) (0 ms)
[ RUN ] TestBisValuesCombine/CombineTest.Test/3
vendor/mediatek/tests/vendor/HIDL_FORMATTER/interface/1.0/HIDL_FORMATTERV1_0AIT.cpp:38: Failure
Value of: checkData()Actual: false
Expected: true
[ FAILED ] TestBisValuesCombine/CombineTest.Test/3, where GetParam() = (false, 3) (0 ms)
[ RUN ] TestBisValuesCombine/CombineTest.Test/4
vendor/mediatek/tests/vendor/HIDL_FORMATTER/interface/1.0/HIDL_FORMATTERV1_0AIT.cpp:38: Failure
Value of: checkData()Actual: false
Expected: true
[ FAILED ] TestBisValuesCombine/CombineTest.Test/4, where GetParam() = (false, 4) (0 ms)
[ RUN ] TestBisValuesCombine/CombineTest.Test/5
[ OK ] TestBisValuesCombine/CombineTest.Test/5 (0 ms)
[ RUN ] TestBisValuesCombine/CombineTest.Test/6
vendor/mediatek/tests/vendor/HIDL_FORMATTER/interface/1.0/HIDL_FORMATTERV1_0AIT.cpp:38: Failure
Value of: checkData()Actual: false
Expected: true
[ FAILED ] TestBisValuesCombine/CombineTest.Test/6, where GetParam() = (true, 1) (0 ms)
[ RUN ] TestBisValuesCombine/CombineTest.Test/7
[ OK ] TestBisValuesCombine/CombineTest.Test/7 (0 ms)
[ RUN ] TestBisValuesCombine/CombineTest.Test/8
vendor/mediatek/tests/vendor/HIDL_FORMATTER/interface/1.0/HIDL_FORMATTERV1_0AIT.cpp:38: Failure
Value of: checkData()Actual: false
Expected: true
[ FAILED ] TestBisValuesCombine/CombineTest.Test/8, where GetParam() = (true, 3) (0 ms)
[ RUN ] TestBisValuesCombine/CombineTest.Test/9
[ OK ] TestBisValuesCombine/CombineTest.Test/9 (0 ms)
[----------] 10 tests from TestBisValuesCombine/CombineTest (3 ms total)[----------] Global test environment tear-down
[==========] 10 tests from 1 test suite ran. (4 ms total)
[ PASSED ] 3 tests.
[ FAILED ] 7 tests, listed below:
[ FAILED ] TestBisValuesCombine/CombineTest.Test/0, where GetParam() = (false, 0)
[ FAILED ] TestBisValuesCombine/CombineTest.Test/1, where GetParam() = (false, 1)
[ FAILED ] TestBisValuesCombine/CombineTest.Test/2, where GetParam() = (false, 2)
[ FAILED ] TestBisValuesCombine/CombineTest.Test/3, where GetParam() = (false, 3)
[ FAILED ] TestBisValuesCombine/CombineTest.Test/4, where GetParam() = (false, 4)
[ FAILED ] TestBisValuesCombine/CombineTest.Test/6, where GetParam() = (true, 1)
[ FAILED ] TestBisValuesCombine/CombineTest.Test/8, where GetParam() = (true, 3)7 FAILED TESTS
GoogleTest系列:TEST_P的基本用法相关推荐
- Go基础系列:双层channel用法示例
Go channel系列: channel入门 为select设置超时时间 nil channel用法示例 双层channel用法示例 指定goroutine的执行顺序 双层通道的解释见Go的双层通道 ...
- Android系列之butterknife基本用法
现在安卓项目开发中,butterknife是比较常用的注解框架,从而简化了findViewById的重复使用,提高了编程的效率 然而为什么要使用butterknife?一方面是为了提高编程效率,一方面 ...
- pyecharts系列之Bar的用法
文章目录 准备工作 一.柱状图 二.堆积柱状图 三.瀑布图 四.直方图 五.条形图 六.配置 1.主题配置 2.区域缩放 3.标记线 4.标记点 准备工作 1.安装库pyecharts 以下代码默认版 ...
- 音视频系列--OpenSL ES基础用法总结
一.前置 OpenSL ES全称为Open Sound Library for Embedded Systems,及嵌入式音频加速标准.OpenSL ES是无授权费.跨平台.针对嵌入式系统封精心优化的 ...
- C语言实用算法系列之二级指针用法简介
一.几个知识点 内存四区:栈.全局(静态),常量区,除此以外剩余的空间暂时不能随意使用:除此以外剩余的空间只要通过malloc函数申请一下,就可以使用了: 申请一个堆上的单个int变量的方法:int* ...
- [Vuex系列] - Mutation的具体用法
更改 Vuex 的 store 中的状态的唯一方法是提交 mutation.Vuex 中的 mutation 非常类似于事件:每个 mutation 都有一个字符串的 事件类型 (type) 和 一个 ...
- C#面向对象系列(2):构造函数的用法
1. 如果不为类编写构造函数,编译器就会创建一个默认的构造函数,运行时会在创建新对象时调用它. 2. 构造函数互相之间的可链接关系 1using System; 2 3namespace We ...
- Hadoop系列之InputFormat,OutputFormat用法
首先看下InputFormat接口的代码 public interface InputFormat<K, V> {InputSplit[] getSplits(JobConf var1, ...
- 【CSS系列】background-clip 定义用法
background-clip 属性规定背景的绘制区域. background-clip 有三个属性 border-box 背景被裁剪到边框盒. padding-box 背景被裁剪到内边距框. con ...
最新文章
- c#初学-索引器get和set的使用(泛型类)
- 数据结构实验之链表一:顺序建立链表(SDUT 2116)
- sessionlistener方法中获取session中存储的值报空指针异常_从Golang实践中得到的教训...
- C++知识点:typedef struct、printf
- 【Angular专题】——【译】Angular中的ForwardRef
- maven多模块项目,多web合并项目使用心得
- 小程序优化的20中策略
- 服务器响应submit,任务操作:submitJob (REST)
- String字符串按多个字符Split方法
- BZOJ1604 洛谷2906:[USACO2008 OPEN]Cow Neighborhoods 奶牛的邻居——题解
- 基于pyqt5实现QQ截图功能
- Python爬虫实战|爬取视频
- KSF—— 关键成功因素法
- 互联网晚报 | 11月3日 星期三 | 头条西瓜等业务并入抖音;菜鸟联合天猫上亿元补贴快递员;雅虎宣布正式退出中国市场...
- 无人机通信信道模型实现代码
- poi3.17excel加边框
- Python如何读取Jason格式,变成dataframe
- BarTender 打印机的控制详解
- 第三章 流程控制语句
- java mssql jdbc_一个简单的Struts JDBC连接池(mssql)