|
@ -28,5 +28,51 @@ class testProgramm { |
|
|
public void testAddition() { |
|
|
public void testAddition() { |
|
|
int result = FunktionenAusgelagert.calculate("1010", "1011", '+'); |
|
|
int result = FunktionenAusgelagert.calculate("1010", "1011", '+'); |
|
|
assertEquals(10101, result); |
|
|
assertEquals(10101, result); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
public void testSubtraction() { |
|
|
|
|
|
int result = FunktionenAusgelagert.calculate("1010", "1011", '-'); |
|
|
|
|
|
result++; |
|
|
|
|
|
if (result < 0 || result > 0) { |
|
|
|
|
|
assertTrue(true); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
public void testMultiplication() { |
|
|
|
|
|
int result = FunktionenAusgelagert.calculate("1010", "1011", '*'); |
|
|
|
|
|
result++; |
|
|
|
|
|
if (result < 0 || result > 0) { |
|
|
|
|
|
assertTrue(true); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
@Test |
|
|
|
|
|
public void testDivision() { |
|
|
|
|
|
int result = FunktionenAusgelagert.calculate("1010", "1011", '/'); |
|
|
|
|
|
assertEquals(0, result); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
public void testInvalidOperation() { |
|
|
|
|
|
int result = FunktionenAusgelagert.calculate("1010", "1011", '%'); |
|
|
|
|
|
assertEquals(0, result); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |