mirror of
https://gitlab.com/arnekeller/kit-programmieren-ws1920-final1.git
synced 2024-11-08 18:00:38 +00:00
Add switch derailing test
This commit is contained in:
parent
a9348c4bdc
commit
cbac7fb00f
@ -139,6 +139,11 @@ class MainTest {
|
|||||||
cmpInOut("test13_input.txt", "test13_output.txt");
|
cmpInOut("test13_input.txt", "test13_output.txt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void switchDerailsAllTrains() throws IOException {
|
||||||
|
cmpInOut("switch_derails_all_trains_input.txt", "switch_derails_all_trains_output.txt");
|
||||||
|
}
|
||||||
|
|
||||||
private void cmpInOut(String in, String out) throws IOException {
|
private void cmpInOut(String in, String out) throws IOException {
|
||||||
System.setIn(new ByteArrayInputStream(readFile(in)));
|
System.setIn(new ByteArrayInputStream(readFile(in)));
|
||||||
ByteArrayOutputStream output = new ByteArrayOutputStream();
|
ByteArrayOutputStream output = new ByteArrayOutputStream();
|
||||||
|
21
switch_derails_all_trains_input.txt
Normal file
21
switch_derails_all_trains_input.txt
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
add switch (0,0) -> (5,0),(0,5)
|
||||||
|
add track (-2,0) -> (0,0)
|
||||||
|
add track (7,0) -> (5,0)
|
||||||
|
add track (0,7) -> (0,5)
|
||||||
|
create train-set T1 Alpha 1 true true
|
||||||
|
create train-set T1 Beta 1 true true
|
||||||
|
create train-set T1 Delta 1 true true
|
||||||
|
create train-set T1 Gamma 1 true true
|
||||||
|
add train 1 T1-Alpha
|
||||||
|
add train 2 T1-Beta
|
||||||
|
add train 3 T1-Delta
|
||||||
|
add train 4 T1-Gamma
|
||||||
|
set switch 1 position (5,0)
|
||||||
|
put train 1 at (-1,0) in direction 1,0
|
||||||
|
put train 2 at (6,0) in direction -1,0
|
||||||
|
put train 3 at (0,6) in direction 0,-1
|
||||||
|
put train 4 at (2,0) in direction 1,0
|
||||||
|
step 1
|
||||||
|
set switch 1 position (5,0)
|
||||||
|
step 0
|
||||||
|
exit
|
23
switch_derails_all_trains_output.txt
Normal file
23
switch_derails_all_trains_output.txt
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
1
|
||||||
|
2
|
||||||
|
3
|
||||||
|
4
|
||||||
|
T1-Alpha
|
||||||
|
T1-Beta
|
||||||
|
T1-Delta
|
||||||
|
T1-Gamma
|
||||||
|
train-set T1-Alpha added to train 1
|
||||||
|
train-set T1-Beta added to train 2
|
||||||
|
train-set T1-Delta added to train 3
|
||||||
|
train-set T1-Gamma added to train 4
|
||||||
|
OK
|
||||||
|
OK
|
||||||
|
OK
|
||||||
|
OK
|
||||||
|
OK
|
||||||
|
Train 1 at (0,0)
|
||||||
|
Train 2 at (5,0)
|
||||||
|
Train 3 at (0,5)
|
||||||
|
Train 4 at (3,0)
|
||||||
|
OK
|
||||||
|
OK
|
Loading…
Reference in New Issue
Block a user