软件测试homework3

a.

b.when n is very large,the fault would occur.

c.n=1

d.node coverage:{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}

edge coverage:{(1,2),(2,3),(2,3),(3,4),(4,5),(5,6),(6,7),(5,7),(6,8),(8,9),(9,10),(8,10),(10,2),(2,11),(11,13),(11,12),(12,14),(14,15),(15,12)}

prime path coverage:{(1,2,3,4,5,6,7),(1,2,3,4,5,7),(1,2,3,4,5,6,8,9,10),(1,2,3,4,5,6,8,10),(1,2,11,13),(1,2,11,12,14,15)}

 

 

package triangle;

import org.junit.Test;
import static org.junit.Assert.*;

public class Triangle {
public String compare(int a,int b,int c){
if(a==b && b==c)
return "equilateral";
else if(a==b||b==c||a==c)
return "isosceles";
else
return "scalene";
}
}

 

 

 

package triangle;

import org.junit.Test;
import static org.junit.Assert.*;

public class test
{
private Triangle tri;
private Triangle tri2;
private Triangle tri3;
@Test
public void testtri()
{
tri= new Triangle();
assertEquals("equilateral", tri.compare(3, 3, 3));
tri2= new Triangle();
assertEquals("isosceles", tri2.compare(2, 2, 3));
tri3= new Triangle();
assertEquals("scalene", tri3.compare(1, 2, 4));
}
}

posted @ 2016-03-29 16:54    阅读(139)  评论(0编辑  收藏  举报