|
@ -105,6 +105,7 @@ class testProgramm { |
|
|
assertEquals("120\n", out.toString()); |
|
|
assertEquals("120\n", out.toString()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
@Test |
|
|
public void testFakultaetWithZero() { |
|
|
public void testFakultaetWithZero() { |
|
|
String input = "0\n"; |
|
|
String input = "0\n"; |
|
@ -142,4 +143,19 @@ class testProgramm { |
|
|
private int getNumber() { |
|
|
private int getNumber() { |
|
|
return 0; |
|
|
return 0; |
|
|
} |
|
|
} |
|
|
|
|
|
@Test |
|
|
|
|
|
public void testTimer() { |
|
|
|
|
|
int actualTime = (int) (Math.random() * 10 + 1); |
|
|
|
|
|
int estimatedTime = (int) (Math.random() * 10 + 1); |
|
|
|
|
|
int difference = Math.abs(actualTime - estimatedTime); |
|
|
|
|
|
boolean result = false; |
|
|
|
|
|
if (difference == 0) { |
|
|
|
|
|
result = true; |
|
|
|
|
|
} else if (difference <= 2) { |
|
|
|
|
|
result = true; |
|
|
|
|
|
} else if (difference <= 4) { |
|
|
|
|
|
result = true; |
|
|
|
|
|
} |
|
|
|
|
|
assertTrue(result); |
|
|
|
|
|
} |
|
|
} |
|
|
} |