You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
100 lines
1.7 KiB
100 lines
1.7 KiB
package programmiermethoden_und_Werkzeuge;
|
|
|
|
import static org.junit.Assert.*;
|
|
|
|
import org.junit.Test;
|
|
|
|
public class TaschenrechnerTest {
|
|
|
|
@Test
|
|
public void testAddition() {
|
|
int a = 3;
|
|
int b = 4;
|
|
int ab = a + b;
|
|
int result = Taschenrechner.addition(a,b);
|
|
|
|
assertEquals(ab, result);
|
|
}
|
|
|
|
@Test
|
|
public void testMultiplikation() {
|
|
int a = 6;
|
|
int b = 6;
|
|
int ab = a * b;
|
|
int result = Taschenrechner.multiplikation(a, b);
|
|
|
|
assertEquals(ab, result);
|
|
}
|
|
|
|
@Test
|
|
public void testDivision() {
|
|
int a = 14;
|
|
int b = 7;
|
|
int ab = a / b;
|
|
int result = Taschenrechner.division(a, b);
|
|
|
|
assertEquals(ab, result);
|
|
}
|
|
|
|
@Test
|
|
public void testPotenzieren() {
|
|
int a = 2;
|
|
int b = 3;
|
|
int ab = (int)Math.pow(a, b);
|
|
int result = Taschenrechner.potenzieren(a, b);
|
|
|
|
assertEquals(ab, result);
|
|
}
|
|
|
|
@Test
|
|
public void testKleinerAls() {
|
|
int a = 9;
|
|
int b = 6;
|
|
boolean ab = a<b;
|
|
boolean result = Taschenrechner.kleinerAls(a, b);
|
|
|
|
assertEquals(ab, result);
|
|
}
|
|
|
|
@Test
|
|
public void testGroeßerAls() {
|
|
int a = 6;
|
|
int b = 9;
|
|
boolean ab = a>b;
|
|
boolean result = Taschenrechner.groeßerAls(a, b);
|
|
|
|
assertEquals(ab, result);
|
|
}
|
|
|
|
@Test
|
|
public void testGleich() {
|
|
int a = 5;
|
|
int b = 5;
|
|
boolean ab = a==b;
|
|
boolean result = Taschenrechner.gleich(a, b);
|
|
|
|
assertEquals(ab, result);
|
|
}
|
|
|
|
@Test
|
|
public void testRandomIntegerNummer() {
|
|
int a = 2;
|
|
int b = 10;
|
|
int r = (int) (Math.random() * (a + 1)) + b;
|
|
boolean result = r > a && r >= b;
|
|
|
|
assertEquals(true, result);
|
|
}
|
|
|
|
@SuppressWarnings("deprecation")
|
|
@Test
|
|
public void testKreisUmfang() {
|
|
int r = 3;
|
|
double u = 2* r *Math.PI;
|
|
double result = Taschenrechner.kreisUmfang(r);
|
|
|
|
assertEquals(u, result);
|
|
}
|
|
|
|
|
|
}
|