a)
b)令MAXPRIMES=10
c)n=1
d) 节点覆盖:
{1,2,3,4,5,6,7,8,9,2,10,11}
边覆盖:
{1,2,3,4,5,6,7,8,9,2,10,11},
{1,2,3,4,5,4,7,9,2,10,11}
主路径覆盖:
{1,2,3,4,5,6,7,8,9}, {1,2,3,4,5,6,7,9},
{1,2,3,4,7,8,9}, {1,2,3,4,7,9}, {1,2,10,11}
{2,3,4,5,6,7,8,9,2}, {2,3,4,5,6,7,9,2},
{2,3,4,7,8,9,2}, {2,3,4,7,9,2}
{4,5,4}, {5,4,5}
测试用例:
package PrimayGH;
import static org.junit.Assert.*;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import org.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
//import org.junit.internal.runners.TestClassRunner;
import org.junit.runner.RunWith;
import PrimayGH.PrimaiesGH;
public class PrimaiesGHTest {
public PrimaiesGH primaies=new PrimaiesGH();
@Before
public void Start()throws Exception{
primaies.Start();
}
@After
public void End()throws Exception{
}
@Test
public void Five(){
String str=new String("2 3 5 7 11 ");
primaies.printPrimes(5);
assertEquals(str,primaies.Getstr());
}
}
原文:http://www.cnblogs.com/gaigaihe/p/6551377.html