博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
软件测试第三次作业——习题2.3.7
阅读量:5366 次
发布时间:2019-06-15

本文共 2032 字,大约阅读时间需要 6 分钟。

a)

b)若MAXPRIMES为2,则t2在primes[numPrimes]=curPrime(即上图节点8)处会发生访问非法内存的错误,因为n=5时质数有2,3,5.但t1不会出错,因为n=3时质数只有2,3.

c)t=(n=1).

d)点覆盖:{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}

边覆盖:{(0,1),(1,2),(1,11),(2,3),(3,4),(3,7),(4,5),(4,6),(5,7),(6,3),(7,8),(8,9),(8,10),(9,10),(10,1),(11,12),(12,13),(13,14),(13,15),(14,13)}

主路径覆盖{(13,14,13)(14,13,14)(14,13,15)(3,4,6,3)(4,6,3,4)(6,3,4,6)(0,1,2,3,4,6)(0,1,11,12,13,14)(0,1,11,12,13,15)(0,1,2,3,7,8,10)(1,2,3,7,8,10,1)(2,3,7,8,10,1,2)(3,7,8,10,1,2,3)(7,8,10,1,2,3,7)(8,10,1,2,3,7,8)(10,1,2,3,7,8,10)(0,1,2,3,7,8,9,10)(1,2,3,7,8,9,10,1)(2,3,7,8,9,10,1,2)(3,7,8,9,10,1,2,3)(4,6,3,7,8,10,1,2)(7,8,9,10,1,2,3,7)(8,9,10,1,2,3,7,8)(9,10,1,2,3,7,8,9)(10,1,2,3,7,8,9,10)(0,1,2,3,4,5,7,8,10)(1,2,3,4,5,7,8,10,1)(2,3,4,5,7,8,10,1,2)(3,4,5,7,8,10,1,2,3)(4,5,7,8,10,1,2,3,4)(4,6,3,7,8,9,10,1,2)(5,7,8,10,1,2,3,4,5)(5,7,8,10,1,2,3,4,6)(6,3,4,5,7,8,10,1,2)(7,8,9,10,1,2,3,4,6)(7,8,10,1,2,3,4,5,7)(8,10,1,2,3,4,5,7,8)(10,1,2,3,4,5,7,8,10)(0,1,2,3,4,5,7,8,9,10)(1,2,3,4,5,7,8,9,10,1)(2,3,4,5,7,8,9,10,1,2)(3,4,5,7,8,9,10,1,2,3)(4,5,7,8,9,10,1,2,3,4)(5,7,8,9,10,1,2,3,4,5)(5,7,8,9,10,1,2,3,4,6)(6,3,4,5,7,8,9,10,1,2)(7,8,9,10,1,2,3,4,5,7)(8,9,10,1,2,3,4,5,7,8)(9,10,1,2,3,4,5,7,8,9)(10,1,2,3,4,5,7,8,9,10)(2,3,7,8,9,10,1,11,12,13,14)(2,3,7,8,9,10,1,11,12,13,15)(4,6,3,7,8,10,1,11,12,13,14)(4,6,3,7,8,10,1,11,12,13,15)(2,3,4,5,7,8,10,1,11,12,13,14)(2,3,4,5,7,8,10,1,11,12,13,15)(4,6,3,7,8,9,10,1,11,12,13,14)(4,6,3,7,8,9,10,1,11,12,13,15)(6,3,4,5,7,8,10,1,11,12,13,14)(6,3,4,5,7,8,10,1,11,12,13,15)(2,3,4,5,7,8,9,10,1,11,12,13,14)(2,3,4,5,7,8,9,10,1,11,12,13,15)(6,3,4,5,7,8,9,10,1,11,12,13,14)(6,3,4,5,7,8,9,10,1,11,12,13,15)}

基于Junit测试:

package test;import org.junit.Before;import org.junit.Test;import static org.junit.Assert.*;public class testhello {private hello cal;		// 执行任意一个方法之前都会执行setUp方法	@Before	public void setUp(){		cal = new hello();	}		// 加了@Test表示该方法是一个单元测试 	@Test	public void testPrime(){ 		cal.printPrimes(20);	} 	 	//hamcrest 1.3}

  结果截图:

覆盖测试:

 

转载于:https://www.cnblogs.com/3014218068sht/p/6548994.html

你可能感兴趣的文章
MES架构
查看>>
hdu 2767(tarjan)
查看>>
sklearn之分类模型混淆矩阵和分类报告
查看>>
MySQL各存储引擎
查看>>
项目--简单导出CSV文件
查看>>
Oracle session相关数据字典(一)
查看>>
织梦文章内容提取第一张或者多张图片输出
查看>>
C#用正则表达式 获取网页源代码标签的属性或值
查看>>
BZOJ 3399 [Usaco2009 Mar]Sand Castle城堡(贪心)
查看>>
WCF(一) 简单的认知
查看>>
[MFC][DShow]简单例子
查看>>
js onclick事件传参
查看>>
WiCloud 商业Wi-Fi管理平台
查看>>
团队项目--未完待续
查看>>
双重标准,我该怎么解决
查看>>
python中的网页标签等字符处理
查看>>
Linux常用命令(十二)
查看>>
Linux常用命令(十五)
查看>>
Linux常用命令(十四)
查看>>
Linux常用命令(十七)
查看>>