头文件:
#include"stdafx.h"
#include<iostream>
#include <string.h>
using namespace std;
class CBox // Class definition at global scope
{
public:
double m_Length ; // Length of a box in inches
double m_Width; // Width of a box in inches
double m_Height; // Height of a box in inches
// Constructor definition
CBox(double lv, double wv, double hv);
CBox();

这篇博客介绍了如何使用Google Test(gtest)框架来测试C++类中的函数,包括构造函数和成员方法。通过示例展示了TEST_F与TEST的区别,TEST_F提供了SetUp和TearDown函数,确保每个测试用例在独立的环境中运行,避免了相互影响。内容适合初学者,有助于理解和应用gtest进行单元测试。
最低0.47元/天 解锁文章
3917

被折叠的 条评论
为什么被折叠?



