好难啊
211606361 何承华
211606377覃一霸
一.单元测试
1.需使用junit插件写测试代码
二.代码
@Test//测试传入的参数是否正确
public void test() {
String[] str = {"-grade","3","n","10"};
assertEquals(true ,MathExam6361.jibu(str));
}
@Test//测试传入的年级超过范围是否正确
public void test1() {
String[] str = {"-grade","0","n","10"};
assertEquals(false ,MathExam6361.jibu(str));
}
@Test//测试传入的题数超过范围是否正确
public void test2() {
String[] str = {"-grade","3","n","101"};
assertEquals(false ,MathExam6361.jibu(str));
}
@Test//测试传入的参数超过范围是否正确
public void test3() {
String[] str = {"-grade","0","n","101"};
assertEquals(false ,MathExam6361.jibu(str));
}
@Test//测试传入的参数为负数是是否正确
public void test4() {
String[] str= {"-grade","-1","n","-10"};
assertEquals(false ,MathExam6361.jibu(str));
}
@Test//测试传入的年级为小数是否正确
public void test5() {
String[] str = {"-grade","3.0","n","10"};
assertEquals(true ,MathExam6361.jibu(str));
}
}
三.类图
四、总结
这是这次作业目前的进度,接下来我会在国庆继续写完