Stand 001/14.10/15:56
This commit is contained in:
parent
6944f54290
commit
51ff128cba
17
.idea/libraries/junit_jupiter.xml
generated
Normal file
17
.idea/libraries/junit_jupiter.xml
generated
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<component name="libraryTable">
|
||||||
|
<library name="junit.jupiter" type="repository">
|
||||||
|
<properties maven-id="org.junit.jupiter:junit-jupiter:5.8.1" />
|
||||||
|
<CLASSES>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter/5.8.1/junit-jupiter-5.8.1.jar!/" />
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-api/5.8.1/junit-jupiter-api-5.8.1.jar!/" />
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/org/opentest4j/opentest4j/1.2.0/opentest4j-1.2.0.jar!/" />
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-commons/1.8.1/junit-platform-commons-1.8.1.jar!/" />
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/org/apiguardian/apiguardian-api/1.1.2/apiguardian-api-1.1.2.jar!/" />
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-params/5.8.1/junit-jupiter-params-5.8.1.jar!/" />
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-engine/5.8.1/junit-jupiter-engine-5.8.1.jar!/" />
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-engine/1.8.1/junit-platform-engine-1.8.1.jar!/" />
|
||||||
|
</CLASSES>
|
||||||
|
<JAVADOC />
|
||||||
|
<SOURCES />
|
||||||
|
</library>
|
||||||
|
</component>
|
@ -3,9 +3,12 @@
|
|||||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||||
<exclude-output />
|
<exclude-output />
|
||||||
<content url="file://$MODULE_DIR$">
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/TestTriangle" isTestSource="true" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
|
||||||
</content>
|
</content>
|
||||||
<orderEntry type="inheritedJdk" />
|
<orderEntry type="inheritedJdk" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
<orderEntry type="library" name="junit.jupiter" level="project" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
18
TestTriangle/TriangleCheckerTest.java
Normal file
18
TestTriangle/TriangleCheckerTest.java
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
|
||||||
|
class TriangleCheckerTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void checkTriangle() {
|
||||||
|
|
||||||
|
float a = 3;
|
||||||
|
float b = 4;
|
||||||
|
float c = 5;
|
||||||
|
|
||||||
|
TriangleChecker.TriangleType result = TriangleChecker.checkTriangle(a, b, c);
|
||||||
|
|
||||||
|
assertEquals(TriangleChecker.TriangleType.NORMAL, result, "Normales Dreieck");
|
||||||
|
}
|
||||||
|
}
|
@ -2,10 +2,9 @@ package praktikum01;
|
|||||||
|
|
||||||
|
|
||||||
public class Zahlenfilter {
|
public class Zahlenfilter {
|
||||||
static int temp = 0;
|
static int wiederholen;
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
int wiederholen;
|
|
||||||
|
|
||||||
if( args.length == 0){
|
if( args.length == 0){
|
||||||
wiederholen= 200;
|
wiederholen= 200;
|
||||||
@ -13,31 +12,30 @@ public class Zahlenfilter {
|
|||||||
else {
|
else {
|
||||||
wiederholen= Integer.parseInt(args[0]);
|
wiederholen= Integer.parseInt(args[0]);
|
||||||
}
|
}
|
||||||
|
printNumbers();
|
||||||
System.out.println(wiederholen);
|
System.out.println(wiederholen);
|
||||||
System.out.println(args.length);
|
//System.out.println(args.length);
|
||||||
for (int i = 0; i < wiederholen ; i++ ){
|
}
|
||||||
|
|
||||||
System.out.println("Zahl |" +i+"|");
|
private static void printNumbers(){
|
||||||
|
for (int i=1; i <=wiederholen; i++)
|
||||||
|
|
||||||
//DURCH 5 TEILBAR---------------------------------------------------//
|
if(filter(i))
|
||||||
|
System.out.println(i);
|
||||||
|
}
|
||||||
|
|
||||||
if (i % 5== 0){
|
public static boolean filter(int i){
|
||||||
System.out.println(" '-----> ["+i+"] ist durch 5 teilbar!");
|
return !(checkDivisibleBy5(i) || checkEndsWith9(i) || checkSumDivisibleBy3(i, i-1));
|
||||||
}
|
}
|
||||||
|
|
||||||
//AM ENDE EINE 9---------------------------------------------------//
|
public static boolean checkDivisibleBy5(int i){
|
||||||
if (i %10 ==9){
|
return (i % 5== 0);
|
||||||
System.out.println(" '-----> [" +i+"] ist endet auf 9!");
|
}
|
||||||
}
|
public static boolean checkEndsWith9(int i){
|
||||||
|
return (i %10 ==9);
|
||||||
|
}
|
||||||
|
|
||||||
//ADDIERT DURCH 3 TEILBAR -----------------------------------------//
|
public static boolean checkSumDivisibleBy3(int i, int j) {
|
||||||
if ((i + temp) % 3 ==0){
|
return ((i + j) % 3 ==0);
|
||||||
int ergebnis = i +temp;
|
|
||||||
System.out.println(" '-----> ["+i+"] und [" +temp+ "] addiert ergeben [" +ergebnis + "] und [" +ergebnis+ "] ist durch 3 teilbar");
|
|
||||||
}
|
|
||||||
//ZUWEISUNG TEMP WERT----------------------------------------------//
|
|
||||||
temp = i;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
46
test/praktikum01/ZahlenfilterTest.java
Normal file
46
test/praktikum01/ZahlenfilterTest.java
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
package praktikum01;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
|
||||||
|
class ZahlenfilterTest {
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void filter() {
|
||||||
|
assertTrue(Zahlenfilter.filter(7));
|
||||||
|
|
||||||
|
// Testfall 2: Zahl, die die Filterkriterien nicht erfüllt (z.B. 15 - teilbar durch 5)
|
||||||
|
assertFalse(Zahlenfilter.filter(15));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void checkDivisibleBy5() {
|
||||||
|
|
||||||
|
assertTrue(Zahlenfilter.checkDivisibleBy5(10));
|
||||||
|
|
||||||
|
// Testfall 2: Zahl, die nicht durch 5 teilbar ist
|
||||||
|
assertFalse(Zahlenfilter.checkDivisibleBy5(7));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void checkEndsWith9() {
|
||||||
|
|
||||||
|
assertTrue(Zahlenfilter.checkEndsWith9(29));
|
||||||
|
|
||||||
|
// Testfall 2: Zahl, die nicht auf 9 endet
|
||||||
|
assertFalse(Zahlenfilter.checkEndsWith9(20));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void checkSumDivisibleBy3() {
|
||||||
|
assertTrue(Zahlenfilter.checkSumDivisibleBy3(4, 2));
|
||||||
|
|
||||||
|
// Testfall 2: Summe von zwei Zahlen, die nicht durch 3 teilbar ist (z.B. 4 + 3 = 7)
|
||||||
|
assertFalse(Zahlenfilter.checkSumDivisibleBy3(4, 3));
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user