资源简介
TDD是测试驱动开发(Test-Driven Development)的英文简称,是敏捷开发中的一项核心实践和技术,也是一种设计方法论。TDD的原理是在开发功能代码之前,先编写单元测试用例代码,测试代码确定需要编写什么产品代码。TDD虽是敏捷方法的核心实践,但不只适用于XP(Extreme Programming),同样可以适用于其他开发方法和过程。
代码片段和文件信息
/*
* Copyright (c) 2007 Michael Feathers James Grenning and Bas Vodde
* 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 the 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 EARLIER MENTIONED AUTHORS ‘‘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 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.
*/
#include “CppUTest/CommandLineTestRunner.h“
#include “CppUTest/TestPlugin.h“
#include “CppUTest/TestRegistry.h“
#include “CppUTestExt/MockSupportPlugin.h“
class MyDummyComparator : public MockNamedValueComparator
{
public:
virtual bool isEqual(void* object1 void* object2)
{
return object1 == object2;
}
virtual SimpleString valueToString(void* object)
{
return StringFrom(object);
}
};
int main(int ac char** av)
{
MyDummyComparator dummyComparator;
MockSupportPlugin mockPlugin;
mockPlugin.installComparator(“MyDummyType“ dummyComparator);
TestRegistry::getCurrentRegistry()->installPlugin(&mockPlugin);
return CommandLineTestRunner::RunAllTests(ac av);
}
#include “ApplicationLib/AllTests.h“
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2012-06-14 10:42 code\
文件 2179 2012-06-14 10:42 code\.cdtproject
文件 20038 2012-06-14 10:42 code\.cproject
文件 76 2012-06-14 10:42 code\.gdb_history
文件 2274 2012-06-14 10:42 code\.project
目录 0 2012-06-14 10:42 code\.settings\
文件 421 2012-06-14 10:42 code\.settings\org.eclipse.cdt.core.prefs
文件 874 2012-06-14 10:42 code\BookCode.dsw
目录 0 2012-06-14 10:42 code\CppUTest\
文件 2179 2012-06-14 10:42 code\CppUTest\.cdtproject
文件 2832 2012-06-14 10:42 code\CppUTest\.cproject
文件 2614 2012-06-14 10:42 code\CppUTest\.project
目录 0 2012-06-14 10:42 code\CppUTest\.settings\
文件 12692 2012-06-14 10:42 code\CppUTest\.settings\org.eclipse.cdt.core.prefs
文件 130 2012-06-14 10:42 code\CppUTest\.settings\org.eclipse.cdt.ui.prefs
目录 0 2012-06-14 10:42 code\CppUTest\build\
文件 2422 2012-06-14 10:42 code\CppUTest\build\alltests.mmp
文件 2674 2012-06-14 10:42 code\CppUTest\build\bld.inf
文件 6815 2012-06-14 10:42 code\CppUTest\build\ComponentMakefile
文件 1204 2012-06-14 10:42 code\CppUTest\build\ComponentMakefileExampleParameters
文件 2282 2012-06-14 10:42 code\CppUTest\build\cpputest.mmp
文件 11848 2012-06-14 10:42 code\CppUTest\build\MakefileWorker.mk
文件 157 2012-06-14 10:42 code\CppUTest\build\StaticLibMakefile
文件 605 2012-06-14 10:42 code\CppUTest\cleanAll.sh
文件 67701 2012-06-14 10:42 code\CppUTest\cpputest-hist.txt
文件 11593 2012-06-14 10:42 code\CppUTest\CppUTest.dsp
文件 825 2012-06-14 10:42 code\CppUTest\CppUTest.dsw
文件 7455 2012-06-14 10:42 code\CppUTest\CppUTest.mak
文件 1500 2012-06-14 10:42 code\CppUTest\CppUTest.sln
文件 12900 2012-06-14 10:42 code\CppUTest\CppUTest.vcproj
目录 0 2012-06-14 10:42 code\CppUTest\examples\
............此处省略814个文件信息
- 上一篇:UML和模式应用第3版
- 下一篇:黑客防线2014合集.part2.rar
评论
共有 条评论