额。。。。。。
Posted qybcom
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了额。。。。。。相关的知识,希望对你有一定的参考价值。
#
211606377覃一霸 211606361何承华
package sceond;
import static org.junit.Assert.*;
import org.junit.Test;
public class MathExam361Test {
@Test//测试传入的参数是否正确
public void test() {
String[] str = {"-grade","3","n","10"};
assertEquals(true ,MathExam361.jibu(str));
}
@Test//测试传入的年级超过范围是否正确
public void test1() {
String[] str = {"-grade","0","n","10"};
assertEquals(false ,MathExam361.jibu(str));
}
@Test//测试传入的题数超过范围是否正确
public void test2() {
String[] str = {"-grade","3","n","101"};
assertEquals(false ,MathExam361.jibu(str));
}
@Test//测试传入的参数超过范围是否正确
public void test3() {
String[] str = {"-grade","0","n","101"};
assertEquals(false ,MathExam361.jibu(str));
}
@Test//测试传入的参数为负数是是否正确
public void test4() {
String[] str= {"-grade","-1","n","-10"};
assertEquals(false ,MathExam361.jibu(str));
}
@Test//测试传入的年级为小数是否正确
public void test5() {
String[] str = {"-grade","3.0","n","10"};
assertEquals(true ,MathExam361.jibu(str));
}
}
import static org.junit.Assert.*;
import org.junit.Test;
public class MathExam361Test {
@Test//测试传入的参数是否正确
public void test() {
String[] str = {"-grade","3","n","10"};
assertEquals(true ,MathExam361.jibu(str));
}
@Test//测试传入的年级超过范围是否正确
public void test1() {
String[] str = {"-grade","0","n","10"};
assertEquals(false ,MathExam361.jibu(str));
}
@Test//测试传入的题数超过范围是否正确
public void test2() {
String[] str = {"-grade","3","n","101"};
assertEquals(false ,MathExam361.jibu(str));
}
@Test//测试传入的参数超过范围是否正确
public void test3() {
String[] str = {"-grade","0","n","101"};
assertEquals(false ,MathExam361.jibu(str));
}
@Test//测试传入的参数为负数是是否正确
public void test4() {
String[] str= {"-grade","-1","n","-10"};
assertEquals(false ,MathExam361.jibu(str));
}
@Test//测试传入的年级为小数是否正确
public void test5() {
String[] str = {"-grade","3.0","n","10"};
assertEquals(true ,MathExam361.jibu(str));
}
}
- 总结:根据源代码的思路设计测试代码,主要测试源代码的要求限制。如:结果不能为负数、除数不能为0.......。(最后实现代码,实现代码有点难,因为技术不够硬,大部分都是参考。。。)
以上是关于额。。。。。。的主要内容,如果未能解决你的问题,请参考以下文章