结对编程作业
项目成员
丁树乐 201521123024
郑佳明 201521123029
项目码云地址:https://gitee.com/m1n9/in
思维导图
部分代码
package calculation;
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;
public class CalcFunctionTest {
CalcFunction calc = new CalcFunction();
@Before
public void setUp() throws Exception {
}
@Test
public void testCalc() {
}
@Test
public void testAdd() {
calc.add("1+2");
assertEquals("3" , calc.getResult());
calc.add("2/3+2/3");
assertEquals("4/3" , calc.getResult());
}
@Test
public void testSubstract() {
calc.substract("3-1");
assertEquals("2", calc.getResult());
calc.substract("2/3-1/3");
assertEquals("1/3", calc.getResult());
}
@Test
public void testMultiply() {
calc.multiply("2*3");
assertEquals("6" , calc.getResult());
calc.multiply("2/3*1/3");
assertEquals("2/9" , calc.getResult());
}
@Test
public void testDivide() {
calc.divide("8÷4");
assertEquals("2", calc.getResult());
calc.divide("1/4÷1/4");
assertEquals("1", calc.getResult());
}
}
package calculation;
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;
public class CalcTest {
@Before
public void setUp() throws Exception {
}
@Test
public void test() {
fail("Not yet implemented");
}
}
结果截图
结对照片
小结
第一次结对编程感觉很不习惯,题目也有点难度,不是很会做,不过还是收获到一些东西,希望下次能做出来并完成老师的要求。