testsubsection1.java~2~

来自「数据库应用程序.它比较全面的含盖了JAVA应用程序与数据库之间通讯的全过程.本程」· JAVA~2~ 代码 · 共 38 行

JAVA~2~
38
字号
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(y1, subsection.sign(d1));
        assertEquals(y1, subsection.sign(d1));
    }

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?