Fix tests...
This commit is contained in:
@ -1,7 +1,6 @@
|
|||||||
public class Aufgabe2Test {
|
public class Aufgabe2Test {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|
||||||
//test classes BodyQueue and BodyForceMap
|
//test classes BodyQueue and BodyForceMap
|
||||||
|
|
||||||
// create three bodies
|
// create three bodies
|
||||||
@ -49,7 +48,6 @@ public class Aufgabe2Test {
|
|||||||
bfm.put(earth, new Vector3(0,0,0));
|
bfm.put(earth, new Vector3(0,0,0));
|
||||||
testValue(bfm.get(earth).distanceTo(new Vector3(0,0,0)), 0);
|
testValue(bfm.get(earth).distanceTo(new Vector3(0,0,0)), 0);
|
||||||
testValue(bfm.get(mercury),null);
|
testValue(bfm.get(mercury),null);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void testComparison(Object first, Object second, boolean expected) {
|
public static void testComparison(Object first, Object second, boolean expected) {
|
||||||
|
@ -3,7 +3,6 @@ import java.util.Objects;
|
|||||||
public class Aufgabe3Test {
|
public class Aufgabe3Test {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|
||||||
//test classes BodyLinkedList and BodyForceTreeMap
|
//test classes BodyLinkedList and BodyForceTreeMap
|
||||||
|
|
||||||
// create five bodies
|
// create five bodies
|
||||||
@ -78,10 +77,9 @@ public class Aufgabe3Test {
|
|||||||
testValue(bfm.get(earth).distanceTo(earth.gravitationalForce(sun)), 0);
|
testValue(bfm.get(earth).distanceTo(earth.gravitationalForce(sun)), 0);
|
||||||
testValue(bfm.get(sun).distanceTo(sun.gravitationalForce(earth).plus(sun.gravitationalForce(venus))), 0);
|
testValue(bfm.get(sun).distanceTo(sun.gravitationalForce(earth).plus(sun.gravitationalForce(venus))), 0);
|
||||||
|
|
||||||
|
testValue(bfm.put(earth, new Vector3(0, 0, 0)).distanceTo(earth.gravitationalForce(sun)), 0);
|
||||||
testValue(bfm.get(mercury).distanceTo(mercury.gravitationalForce(sun)), 0);
|
testValue(bfm.get(mercury).distanceTo(mercury.gravitationalForce(sun)), 0);
|
||||||
testValue(bfm.get(earth).distanceTo(new Vector3(0, 0, 0)), 0);
|
|
||||||
testValue(bfm.get(mercury), mercury.gravitationalForce(sun));
|
testValue(bfm.get(mercury), mercury.gravitationalForce(sun));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void testComparison(Object first, Object second, boolean expected) {
|
public static void testComparison(Object first, Object second, boolean expected) {
|
||||||
@ -95,7 +93,7 @@ public class Aufgabe3Test {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void testValue(Object given, Object expected) {
|
public static void testValue(Object given, Object expected) {
|
||||||
if (given == expected) {
|
if (Objects.equals(given, expected)) {
|
||||||
System.out.println("Successful test");
|
System.out.println("Successful test");
|
||||||
} else {
|
} else {
|
||||||
System.out.println("Test NOT successful! Expected value: " + expected + " / Given value: " + given);
|
System.out.println("Test NOT successful! Expected value: " + expected + " / Given value: " + given);
|
||||||
|
Reference in New Issue
Block a user