google test 使用指南

目录

测试项目

calculator.h

calculator.cpp

test01.cpp

创建新项目

 选择Google Test

选择要测试的项目 

pch.cpp

加入依赖  

设为启动项目

​编辑 

运行

​编辑

关键点


测试项目

calculator.h

#ifndef __CALCULATOR_H__
#define __CALCULATOR_H__

#include <iostream>

extern int  add(int x, int y);
extern int  sub(int x, int y);

#endif

calculator.cpp

#include"calculator.h"

int main()
{
    int result = add(10, 20);
    std::cout << "result = " << result << std::endl;
    return 0;
}

test01.cpp

#include"calculator.h"

int main()
{
    int result = add(10, 20);
    std::cout << "result = " << result << std::endl;
    return 0;
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值