当前位置: 首页 > news >正文

作文大全网站友汇网 做公司网站

作文大全网站,友汇网 做公司网站,做网站得做多少网页,网站整站开发视频教程本文开始从googletest提供的sample案例分析如何使用单元测试, 代码路径在googletest/googletest/samples/sample1.unittest.cc 本文件主要介绍EXPECT*相关宏使用 EXPECT_EQ 判断是否相等 EXPECT_TRUE 是否为True EXPECT_FALSE 是否为False TEST(FactorialTest, N…

本文开始从googletest提供的sample案例分析如何使用单元测试,

代码路径在googletest/googletest/samples/sample1.unittest.cc
本文件主要介绍EXPECT
*相关宏使用

EXPECT_EQ 判断是否相等
EXPECT_TRUE 是否为True
EXPECT_FALSE 是否为False

TEST(FactorialTest, Negative) {// This test is named "Negative", and belongs to the "FactorialTest"// test case.EXPECT_EQ(1, Factorial(-5));EXPECT_EQ(1, Factorial(-1));EXPECT_GT(Factorial(-10), 0);// <TechnicalDetails>//// EXPECT_EQ(expected, actual) is the same as////   EXPECT_TRUE((expected) == (actual))//// except that it will print both the expected value and the actual// value when the assertion fails.  This is very helpful for// debugging.  Therefore in this case EXPECT_EQ is preferred.//// On the other hand, EXPECT_TRUE accepts any Boolean expression,// and is thus more general.//// </TechnicalDetails>
}

下面介绍sample2_unittest.cc文件

这里测试MyString类,
EXPECT_STREQ(nullptr, s.c_string()); //这里的STREQ是判断字符串内容,s为空类比较要使用nullptr

TEST(MyString, DefaultConstructor) {const MyString s;// Asserts that s.c_string() returns NULL.//// <TechnicalDetails>//// If we write NULL instead of////   static_cast<const char *>(NULL)//// in this assertion, it will generate a warning on gcc 3.4.  The// reason is that EXPECT_EQ needs to know the types of its// arguments in order to print them when it fails.  Since NULL is// #defined as 0, the compiler will use the formatter function for// int to print it.  However, gcc thinks that NULL should be used as// a pointer, not an int, and therefore complains.//// The root of the problem is C++'s lack of distinction between the// integer number 0 and the null pointer constant.  Unfortunately,// we have to live with this fact.//// </TechnicalDetails>EXPECT_STREQ(nullptr, s.c_string());EXPECT_EQ(0u, s.Length());
}
http://www.laogonggong.com/news/81003.html

相关文章:

  • 南京专业做网站公司地址免费企业邮箱登录入口
  • 网站文章页要不要做内链建设网站对于电商的作用是?
  • 品牌网站建设美丽phpcms安装教程
  • 织梦网站优化怎么做制作网站团队人员
  • 广西智能网站建设企业intitle 做网站
  • 国内大的网站建设公司网站开发文档步骤应该怎么写
  • 网站转移权重公司年会视频制作模板
  • 公众号运营外包谷歌优化怎么做
  • 建设银行网站能变更手机号吗建设购物网站需要多少费用
  • 网站内容告知书设计素材网站大全网站
  • 威海有名的做网站欧美风网站
  • 湛江网站搜索优化电脑十大耐玩网络游戏
  • 档案网站建设经验威县做网站哪家便宜
  • 响应式网站设计的优点erp快速开发平台
  • 网站的模块wordpress调整固态链接后打不开
  • 如何做网站好看为什么需要响应式网站
  • 适合女生做的网站河南省城乡和住房建设厅网站首页
  • 漫画网站开发说明wordpress推广升级vip
  • 大岭山镇仿做网站中山做网站哪家公司好
  • 专业网站设计开发明年做那些网站能致富
  • 网站浏览历史能恢复吗怎么设置建设类似衣联网的网站
  • 亚马逊跨境电商官方网站东营做网站
  • 成都网站建设多少钱网站seo优化案例
  • 社交网站模板下载苏州做门户网站的公司
  • 网站建设技术网站建湟中县公司网站建设
  • 阜新网站设计做的好的营销型网站有哪些内容
  • 广州网站设计首选柚米私人网页服务器
  • 公司网站如何制作设计浙江省建设厅 网站是多少
  • seo网站优化优化排名做竞价托管的公司
  • 西红门模板网站建设做网站练手项目