TestCase V2.0版本

package testcaseBuilderPackage2;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;
import java.text.DecimalFormat;


class TestDouble extends Test  {
File file=new File("e:/testcase1.txt");
double hmin = 1.0;
double hmax = 250.0;
double wmin = 0.1;
double wmax = 500.0;
getRandom gr1 = new getRandom();
getRandom gr2 = new getRandom();
DecimalFormat df = new DecimalFormat("0.00");

public void height() throws IOException {
Writer w=new FileWriter(file,true);
String s1="身高的有效等價類爲:" +'\r'+'\n'+ df.format(gr1.getRandom1(hmin, hmax))
+ " ;  " + df.format(gr2.getRandom2(wmin, wmax))+'\r'+'\n';
String s2="無效等價類爲:\r\n" + df.format(hmin - 1) + " ;  "
+ df.format(gr2.getRandom2(wmin, wmax)) + '\r'+'\n'
+ df.format(hmin) + " ;  "
+ df.format(gr2.getRandom2(wmin, wmax)) + '\r'+'\n'
+ df.format(hmax) + " ;  "
+ df.format(gr2.getRandom2(wmin, wmax)) + '\r'+'\n'
+ df.format(hmax + 1) + " ;  "
+ df.format(gr2.getRandom2(wmin, wmax))+'\r'+'\n';
w.write(s1);
w.write(s2);
w.close();
}

public void weight() throws IOException {
Writer w=new FileWriter(file,true);
String s3="體重的有效等價類爲:\r\n" + df.format(gr1.getRandom1(hmin, hmax))
+ " ;  " + df.format(gr2.getRandom2(wmin, wmax))+'\r'+'\n';
String s4='\n' + "無效等價類爲:\r\n"
+ df.format(gr1.getRandom1(hmin, hmax)) + " ;  "
+ df.format(wmin - 0.1) + '\r'+'\n'
+ df.format(gr1.getRandom1(hmin, hmax)) + " ;  "
+ df.format(wmin) + '\r'+'\n'
+ df.format(gr1.getRandom1(hmin, hmax)) + " ;  "
+ df.format(wmax) + '\r'+'\n'
+ df.format(gr1.getRandom1(hmin, hmax)) + " ;  "
+ df.format((wmax + 0.1))+'\r'+'\n';
w.write(s3);
w.write(s4);
w.close();
}
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章