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

湛江专业建站免费咨询做招聘的网站有哪些内容

湛江专业建站免费咨询,做招聘的网站有哪些内容,网站建站过程分析,单页面应用优化GoogleTest单元测试可用实现在每个测试用例结束后监控其内存使用情况#xff0c; 可以通过GoogleTest提供的事件侦听器EmptyTestEventListener 来实现#xff0c;下面通过官方提供的sample例子#xff0c;路径在samples文件夹下的sample10_unittest.cpp // Copyright 2009…GoogleTest单元测试可用实现在每个测试用例结束后监控其内存使用情况 可以通过GoogleTest提供的事件侦听器EmptyTestEventListener 来实现下面通过官方提供的sample例子路径在samples文件夹下的sample10_unittest.cpp // Copyright 2009 Google Inc. All Rights Reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.// This sample shows how to use Google Test listener API to implement // a primitive leak checker.#include stdio.h #include stdlib.h#include gtest/gtest.h using ::testing::EmptyTestEventListener; using ::testing::InitGoogleTest; using ::testing::Test; using ::testing::TestEventListeners; using ::testing::TestInfo; using ::testing::TestPartResult; using ::testing::UnitTest;namespace { // We will track memory used by this class. class Water {public:// Normal Water declarations go here.// operator new and operator delete help us control water allocation.void* operator new(size_t allocation_size) {allocated_;return malloc(allocation_size);}void operator delete(void* block, size_t /* allocation_size */) {allocated_--;free(block);}static int allocated() { return allocated_; }private:static int allocated_; };int Water::allocated_ 0;// This event listener monitors how many Water objects are created and // destroyed by each test, and reports a failure if a test leaks some Water // objects. It does this by comparing the number of live Water objects at // the beginning of a test and at the end of a test. class LeakChecker : public EmptyTestEventListener {private:// Called before a test starts.void OnTestStart(const TestInfo /* test_info */) override {initially_allocated_ Water::allocated();}// Called after a test ends.void OnTestEnd(const TestInfo /* test_info */) override {int difference Water::allocated() - initially_allocated_;// You can generate a failure in any event handler except// OnTestPartResult. Just use an appropriate Google Test assertion to do// it.EXPECT_LE(difference, 0) Leaked difference unit(s) of Water!;}int initially_allocated_; };TEST(ListenersTest, DoesNotLeak) {Water* water new Water;delete water; }// This should fail when the --check_for_leaks command line flag is // specified. TEST(ListenersTest, LeaksWater) {Water* water new Water;EXPECT_TRUE(water ! nullptr); } } // namespaceint main(int argc, char **argv) {InitGoogleTest(argc, argv);bool check_for_leaks false;if (argc 1 strcmp(argv[1], --check_for_leaks) 0 )check_for_leaks true;elseprintf(%s\n, Run this program with --check_for_leaks to enable custom leak checking in the tests.);// If we are given the --check_for_leaks command line flag, installs the// leak checker.if (check_for_leaks) {TestEventListeners listeners UnitTest::GetInstance()-listeners();// Adds the leak checker to the end of the test event listener list,// after the default text output printer and the default XML report// generator.//// The order is important - it ensures that failures generated in the// leak checkers OnTestEnd() method are processed by the text and XML// printers *before* their OnTestEnd() methods are called, such that// they are attributed to the right test. Remember that a listener// receives an OnXyzStart event *after* listeners preceding it in the// list received that event, and receives an OnXyzEnd event *before*// listeners preceding it.//// We dont need to worry about deleting the new listener later, as// Google Test will do it.listeners.Append(new LeakChecker);}return RUN_ALL_TESTS(); } 通过Water类来重写new和delete方法来实现记录内存分配/释放的情况另外通过LeakChecker 继承自EmptyTestEventListener 并实现OnTestStart测试用例开始前运行和OnTestEnd方法测试用例结束后运行 关于LeakChecker的使用是先获取系统提供的listeners 然后把自定义事件加入到系统中去即可。 TestEventListeners listeners UnitTest::GetInstance()-listeners(); listeners.Append(new LeakChecker);
http://www.hkea.cn/news/14475366/

相关文章:

  • 天津建设网站的公司简介云企网站
  • 民营建筑网站专门做眼镜的国外网站
  • 靖江做网站的上海制作企业网站
  • 高端网站设计报价建筑设计网址大全
  • 企业网站多少钱一个蛋白质结构预测工具网站开发
  • 潍坊公司网站模板建站linux做网站
  • 营销型网站制作建设行业网站建设申请报告
  • 招聘网站开发需求景区网站做电子商务的特点
  • 湖州住房和城乡建设局网站曰照网站小程序建设
  • 建站模板工程造价北京网站域名备案
  • 建设网站物业经理上岗证陈俊华拆分网站开发
  • 做网站的请示下城区住房和城市建设局网站
  • 杭州网站建设 博客中山精品网站建设价位
  • 超市网站建设方案建设监督网站
  • 巩义网站公司网站右侧浮动
  • 都哪些网站可以做gif小说投稿赚钱的网站
  • 医院设计网站建设网站模板破解版
  • 一元夺宝网站建设费用wordpress 虚拟主机 推荐
  • 2023年没有封闭的网站有哪些东坑镇网站仿做
  • mysql 学习网站动画设计属于什么专业类别
  • 搜索引擎不友好的网站特征怎样做网站平台
  • 做外贸是不是要有网站企业网站风格
  • 卫浴建材网站建设大学的一级或二级域名
  • 设计灵感网站整理建设网站报价单
  • 南山网站设计公司ordown wordpress
  • 计算机网站建设及管理麻将软件开发平台
  • 公司企业网站搭建做棋牌游戏网站赚钱吗
  • 网页设计欣赏网站宁德市城乡建设局网站
  • 网站开发人员名片wordpress上传本地视频
  • 在百度上如何上传自己的网站wordpress自定义登录