📄 testsubsection1.java~4~
字号:
package chapter25;
import junit.framework.*;
public class TestSubsection1 extends TestCase {
private Subsection subsection = null;
protected void setUp() throws Exception {
super.setUp();
subsection = new Subsection();
}
protected void tearDown() throws Exception {
subsection = null;
super.tearDown();
}
public void testGetValue() {
int d1 = -3, y1 = 3;
int d2 = -2, y2 = 4;
int d3 = 0, y3 = 100;
int d4 = 2, y4 = 8;
int d5 = 33, y5 = Integer.MAX_VALUE;
assertEquals(y1, subsection.getValue(d1));
assertEquals(y2, subsection.getValue(d2));
assertEquals(y3, subsection.getValue(d3));
assertEquals(y4, subsection.getValue(d4));
assertEquals(y5, subsection.getValue(d5));
}
public void testSign() {
double d1 = -1.0, d2 = 0.0, d3 = 1.0;
int y1 = -1, y2 = 0, y3 = 1;
assertEquals(y1, subsection.sign(d1));
assertEquals(y2, subsection.sign(d2));
assertEquals(y3, subsection.sign(d3));
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -