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

网站建设的规模设想电子信息工程论坛

网站建设的规模设想,电子信息工程论坛,网站建设中中文模板,wordpress打包app上架本文开始从googletest提供的sample案例分析如何使用单元测试#xff0c; 代码路径在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_castconst 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 Cs lack of distinction between the// integer number 0 and the null pointer constant. Unfortunately,// we have to live with this fact.//// /TechnicalDetailsEXPECT_STREQ(nullptr, s.c_string());EXPECT_EQ(0u, s.Length()); }
http://www.dnsts.com.cn/news/220489.html

相关文章:

  • 网站开发需要什么人单页面的网站
  • 建站行业是什么意思wordpress中文开发文档下载
  • 做网站需要什么工具自我介绍的网页设计作业
  • 站长统计 网站统计怎样修改wordpress模板
  • 青岛专业公司网站设计企业信息查询系统入口
  • 把做的网站发布打万维网上中小型企业网站建设的资金流动
  • 如何提升网站排名华为网络工程师认证培训
  • 购物网站开发大纲绿色健康网站模板
  • 建站培训班白云微网站建设
  • 电商资源网站网站建设蛋蛋28
  • thinkphp 大型网站开发佛山高端网站建设报价
  • 用搬瓦工做储存网站域名备案怎么关闭网站
  • 手机网站域名哪里注册宁波seo服务推广软件
  • 盗用别人公司的产品图片做网站wordpress后台添加广告
  • 成都网站建设 培训学校西宁网站怎么做seo
  • 做导航网站把别人的网址链接过来要经过允许吗学前端好找工作吗
  • 成都网站建设收费明细ios网页游戏
  • php做的网站有设计公司企业定位
  • 辽宁省建设厅特种工查询网站表白网页代码
  • 网站编辑 图片批量营销活动有哪些
  • 女人和男人做床上爱网站网页生成app
  • 做网站不如做公众号传统企业如果建立网站
  • 东莞大朗网站建设公司房地产在线开盘
  • 网站开发合作安卓开发软件有哪些
  • 学会建网站如何做网络营销国外界面设计网站
  • 如何创建一个自己的网站网页三剑客的网页制作软件是
  • ui设计无经验找工作沈阳网站推广优化公司
  • 网站开发专业找什么工作温州网站设计制作课程
  • c在线编程网站网站上的文章做参考文献
  • 广阳区建设局网站网站建设属于哪个经营范围