Пример #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());
  }
Пример #7
0
 @Ignore("Still under development")
 @Test
 public void multiplication() {
   assertEquals(15, calculator.multiply(3, 5));
 }
Пример #8
0
 @Test
 public void testMultiply() throws Exception {
   assertEquals(10d, calculator.multiply(2d, 5d), 0);
 }