示例#1
0
 @Test
 public void testMultiplation() {
   int res;
   res = tester.multiply(153, 123);
   assertEquals(18819, res);
   res = tester.multiply(-153, 123);
   assertEquals(-18819, res);
   res = tester.multiply(153, -123);
   assertEquals(-18819, res);
 }
示例#2
0
  @Test
  public void testMultiply() {
    Calculator calc = new Calculator();

    calc.multiply(10);

    assertEquals(calc.getTotal(), 0);

    calc.add(2);
    calc.multiply(7);

    // The total value should be 14 after adding 2 to 0 then multiplying by 7
    assertEquals(calc.getTotal(), 14);
  }
示例#3
0
 @Test
 public void multiplyで5と7の乗算結果が取得できる() {
   Calculator calc = new Calculator();
   int expected = 35;
   int actual = calc.multiply(5, 7);
   assertThat(actual, is(expected));
 }
示例#4
0
 @Test
 public void multiplyで3と4の乗算結果が取得できる() {
   Calculator calc = new Calculator();
   int expected = 12;
   int actual = calc.multiply(3, 4);
   assertThat(actual, is(expected));
 }
示例#5
0
  @Test
  public void testGetTotal() {
    Calculator calc = new Calculator();

    calc.add(4);
    calc.subtract(1);
    calc.multiply(6);
    calc.divide(3);

    // The total value should be 6
    assertEquals(calc.getTotal(), 6);
  }
示例#6
0
  @Test
  public void testGetHistory() {
    Calculator calc = new Calculator();

    assertEquals(calc.getHistory(), "" + 0);

    calc.add(14);
    calc.divide(2);
    calc.multiply(3);
    calc.subtract(6);

    // Testing the history method
    assertEquals("0 + 14 / 2 * 3 - 6", calc.getHistory());
  }
 @Ignore("Still under development")
 @Test
 public void multiplication() {
   assertEquals(15, calculator.multiply(3, 5));
 }
 @Test
 public void testMultiply() throws Exception {
   assertEquals(10d, calculator.multiply(2d, 5d), 0);
 }