Merge remote-tracking branch 'origin/Selectionsort_R2D2' into Selectionsort_R2D2
# Conflicts: # src/main/java/roboter/C3PO.java # src/main/java/roboter/R2D2.javamaster
commit
dc7b052300
BIN
bin/C3PO.class
BIN
bin/C3PO.class
Binary file not shown.
BIN
bin/Nexus6.class
BIN
bin/Nexus6.class
Binary file not shown.
BIN
bin/R2D2.class
BIN
bin/R2D2.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,68 @@
|
||||||
|
package test.java.roboter;
|
||||||
|
|
||||||
|
import org.junit.*;
|
||||||
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
import org.junit.jupiter.api.DynamicNode;
|
||||||
|
import roboter.exceptions.RobotException;
|
||||||
|
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.PrintStream;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
public class C3POTest <SystemOutRule, OutputCapture> {
|
||||||
|
|
||||||
|
private final ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||||
|
private final ByteArrayOutputStream err = new ByteArrayOutputStream();
|
||||||
|
private final PrintStream originalOut = System.out;
|
||||||
|
private final PrintStream originalErr = System.err;
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void setStreams() {
|
||||||
|
System.setOut(new PrintStream(out));
|
||||||
|
System.setErr(new PrintStream(err));
|
||||||
|
}
|
||||||
|
|
||||||
|
@After
|
||||||
|
public void restoreInitialStreams() {
|
||||||
|
System.setOut(originalOut);
|
||||||
|
System.setErr(originalErr);
|
||||||
|
}
|
||||||
|
@Test
|
||||||
|
public void sortieren() throws RobotException {
|
||||||
|
var list = new int[]{12,6,7,10,18,2};
|
||||||
|
Robot robot= RobotFactory.getRobot(Typ.C3PO,"roboter2");
|
||||||
|
|
||||||
|
Assert.assertEquals("18,12,10,7,6,2",robot.speak(list));
|
||||||
|
|
||||||
|
var list1 = new int[] {17,10,19,1,4,2,7};
|
||||||
|
Assert.assertEquals("19,17,10,7,4,2,1", robot.speak(list));
|
||||||
|
|
||||||
|
var list2 = new int[] {3,17,7,20,5,15,8};
|
||||||
|
Assert.assertEquals("20,17,15,8,7,5,3", robot.speak(list));
|
||||||
|
|
||||||
|
var list3 = new int[] {13,8,5,12,1,9,7};
|
||||||
|
Assert.assertEquals("13,12,9,8,7,5,1", robot.speak(list));
|
||||||
|
|
||||||
|
var list4 = new int[] {18,4,21,7,3,2,9};
|
||||||
|
Assert.assertEquals("21,18,9,7,4,3,2", robot.speak(list));
|
||||||
|
|
||||||
|
var list5 = new int[] {13,23,8,4,22,6};
|
||||||
|
Assert.assertEquals("23,22,13,8,6,4", robot.speak(list));
|
||||||
|
|
||||||
|
var list6 = new int[] {10,9,8,7,6,5};
|
||||||
|
Assert.assertEquals("10,9,8,7,6,5", robot.speak(list));
|
||||||
|
|
||||||
|
var list7 = new int[] {1,2,3,5,4,6};
|
||||||
|
Assert.assertEquals("6,5,4,3,2,1", robot.speak(list));
|
||||||
|
|
||||||
|
var list8 = new int[] {20,19,18,17,16,15};
|
||||||
|
Assert.assertEquals("20,19,18,17,16,15", robot.speak(list));
|
||||||
|
|
||||||
|
var list9 = new int[] {15,1,13,10,7,4};
|
||||||
|
Assert.assertEquals("15,13,10,7,4,1", robot.speak(list));
|
||||||
|
|
||||||
|
var list10 = new int[] {10,15,11,8,5,6,};
|
||||||
|
Assert.assertEquals("15,11,10,8,6,5", robot.speak(list));
|
||||||
|
}
|
||||||
|
}
|
|
@ -19,10 +19,39 @@ public class R2D2Test<SystemOutRule, OutputCapture> {
|
||||||
@Test
|
@Test
|
||||||
public void sortieren() throws RobotException, RobotMagicValueException {
|
public void sortieren() throws RobotException, RobotMagicValueException {
|
||||||
var list = new int[]{12,6,7,10,18,2};
|
var list = new int[]{12,6,7,10,18,2};
|
||||||
Robot robot= RobotFactory.getRobot(Typ.R2D2,"roboter2");
|
Robot robot= RobotFactory.getRobot(Typ.R2D2,"roboterX");
|
||||||
|
|
||||||
|
|
||||||
Assert.assertEquals("2,6,7,10,12,18",robot.speak(list));
|
Assert.assertEquals("2,6,7,10,12,18",robot.speak(list));
|
||||||
|
|
||||||
|
var list1 = new int[] {17,10,19,1,4,2,7};
|
||||||
|
Assert.assertEquals("1,2,4,7,10,17,19", robot.speak(list));
|
||||||
|
|
||||||
|
var list2 = new int[] {3,17,7,20,5,15,8};
|
||||||
|
Assert.assertEquals("3,5,7,8,15,17,20", robot.speak(list));
|
||||||
|
|
||||||
|
var list3 = new int[] {13,8,5,12,1,9,7};
|
||||||
|
Assert.assertEquals("1,5,7,8,9,12,13", robot.speak(list));
|
||||||
|
|
||||||
|
var list4 = new int[] {18,4,21,7,3,2,9};
|
||||||
|
Assert.assertEquals("2,3,4,7,9,18,21", robot.speak(list));
|
||||||
|
|
||||||
|
var list5 = new int[] {13,23,8,4,22,6};
|
||||||
|
Assert.assertEquals("4,6,8,13,22,23", robot.speak(list));
|
||||||
|
|
||||||
|
var list6 = new int[] {10,9,8,7,6,5};
|
||||||
|
Assert.assertEquals("5,6,7,8,9,10", robot.speak(list));
|
||||||
|
|
||||||
|
var list7 = new int[] {1,2,3,5,4,6};
|
||||||
|
Assert.assertEquals("1,2,3,4,5,6", robot.speak(list));
|
||||||
|
|
||||||
|
var list8 = new int[] {20,19,18,17,16,15};
|
||||||
|
Assert.assertEquals("15,16,17,18,19,20", robot.speak(list));
|
||||||
|
|
||||||
|
var list9 = new int[] {15,1,13,10,7,4};
|
||||||
|
Assert.assertEquals("1,4,7,10,13,15", robot.speak(list));
|
||||||
|
|
||||||
|
var list10 = new int[] {10,15,11,8,5,6,};
|
||||||
|
Assert.assertEquals("5,6,8,10,11,15", robot.speak(list));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue