setup_new_copy.cpp

来自「VC源码,开源测试工具.有助于VC++的学习与开发」· C++ 代码 · 共 69 行

CPP
69
字号
#include <tut/tut.hpp>namespace tut{    /** * Testing each test starts with brand new test object. */struct setup_new_copy{    static int counter;    test_runner tr;    struct dummy    {        dummy()        {            counter++;        };    };        typedef test_group<dummy> tf;    typedef tf::object object;    tf factory;    setup_new_copy();};int setup_new_copy::counter = 0;/** * Internal test definition */template<>template<>void setup_new_copy::object::test<1>(){}/** * Internal constructor */setup_new_copy::setup_new_copy()     : factory("internal", tr){}typedef test_group<setup_new_copy> tg;typedef tg::object object;tg setup_new_copy("new test object for each test");/** * Checks getting unknown exception in setup. */template<>template<>void object::test<1>(){    set_test_name("checks getting unknown exception in setup");        tr.run_test("internal",1);    ensure_equals("one constructor called", counter, 1);    tr.run_test("internal",1);    ensure_equals("another constructor called", counter, 2);}}

⌨️ 快捷键说明

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