如果您无法下载资料,请参考说明:
1、部分资料下载需要金币,请确保您的账户上有足够的金币
2、已购买过的文档,再次下载不重复扣费
3、资料包下载后请先用软件解压,在使用对应软件打开
TestPathpublic:TestPath();/*构造一条无效的路径直到一个测试被add()添加!*/TestPath(Test*root);/*构造一条有效的路径,测试root被添加!*//*用其他路径的部分构造一条路径!从otherPath路径的indexFirst索引开始,顺序向后添加count个测试到本路径,如果count小于0,则添加otherPath的所有测试到本路径!*/TestPath(constTestPath&otherPath,intindexFirst,intcount=-1);/*从函数toString()返回的一个字符串路径分解一条路径!把字符串路径pathAsString分解成各个测试名,然后插入到searchRoot对应的路径中*/TestPath(Test*searchRoot,conststd::string&pathAsString);TestPath(constTestPath&other);virtual~TestPath();virtualboolisValid()const;/*路径至少包含一个测试是有效的!*/virtualvoidadd(Test*test);/*添加一个测试到路径!*/virtualvoidadd(constTestPath&path);/*添加路径path的测试到本路径!*/virtualvoidinsert(Test*test,intindex);/*在索引index位置插入测试!*//*在索引index位置插入路径path的所有测试!*/virtualvoidinsert(constTestPath&path,intindex);virtualvoidremoveTests();/*删除路径上所有的测试,路径变成无效的!*/virtualvoidremoveTest(intindex);/*删除路径中具体索引index的测试!*/virtualvoidup();/*删除最后一个的测试!*/virtualintgetTestCount()const;/*返回路径中测试的总数目!*/virtualTest*getTestAt(intindex)const;/*返回路径中索引index的测试!*/virtualTest*getChildTest()const;/*返回路径中层次最底层的测试!*//*返回路径字符串!例如:一个路径包含三个名字为"AllTests"、"Math"和"Math::testAdd"的测试,调用此函数将返回:"/AllTests/Math/Math::testAdd"*/virtualstd::stringtoString()const;TestPath&operator=(constTestPath&other);protected:voidcheckIndexValid(intindex)const;/*检查测试索引index在有效的范围内!*/typedefCppUnitDeque<std::string>PathTestNames;/*分离路径字符串成它的测试名成分,将各个测试名字符串放到队列testNames中!例如:pathAsString为:"/AllTests/Math/Math::testAdd",则调用此函数后,testNames[0]=“AllTests“,testNames[1]=“Math“,testNames[2]=“Math::testAdd“*/boolsplitPathString(conststd::string&pathAsString,PathTestNames&testNames);/*查找路径字符串的实际根(第一个测试名)和得到路径字符串名字成分!*/Test*findActualRoot(Test*searchRoot,conststd::string&pathAsString,PathTestNames&testNames);typedefCppUnitDeque<Test*>Tests;Testsm_tests;Testpublic:virtual~Test();virtualvoidrun(TestResult*result)=0;/*运行测试,收集结果!*/virtualintcountTestCases()const=0;/*返回被run()调用的测试用例的数目!*//*返回测试的直接孩子(直接子测试包)的数目!*/virtualintgetChildTestCount()const=0;/*返回具体索引为index的测试孩子(测试包)的地址!*/virtualTes