⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 constructed_instances.cpp

📁 VC源码,开源测试工具.有助于VC++的学习与开发
💻 CPP
字号:
#include <tut/tut.hpp>#include <iostream>namespace tut{/** * Testing exact number of instances created when top limit is specified. */struct constructed_instances{    test_runner tr;    struct dummy    {        static int constructed;        dummy()        {            constructed++;        };    };    typedef test_group<dummy,3> tf;    typedef tf::object object;    tf factory;    constructed_instances();};int constructed_instances::dummy::constructed = 0;/** * Internal test definition */template<>template<>void constructed_instances::object::test<1>(){}template<>template<>void constructed_instances::object::test<3>(){}/** * Internal constructor */constructed_instances::constructed_instances()     : factory("internal", tr){}typedef test_group<constructed_instances> tg;typedef tg::object object;tg constructed_instances("constructed instances");/** * Checks two and only two instances were created. */template<>template<>void object::test<1>(){    set_test_name("checks two and only two instances were created");        tr.run_tests("internal");    ensure_equals("result", constructed_instances::dummy::constructed, 2);}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -