From 4d2389450901d9b2dc5205cecba83dafe8d3d537 Mon Sep 17 00:00:00 2001 From: Arne Keller Date: Mon, 17 Feb 2020 09:46:00 +0100 Subject: [PATCH] Add more tests --- fuzz10_input.txt | 34 ++++++++++++++++++++++++++++ fuzz10_output.txt | 32 ++++++++++++++++++++++++++ fuzz11_input.txt | 20 ++++++++++++++++ fuzz11_output.txt | 19 ++++++++++++++++ src/edu/kit/informatik/MainTest.java | 10 ++++++++ 5 files changed, 115 insertions(+) create mode 100644 fuzz10_input.txt create mode 100644 fuzz10_output.txt create mode 100644 fuzz11_input.txt create mode 100644 fuzz11_output.txt diff --git a/fuzz10_input.txt b/fuzz10_input.txt new file mode 100644 index 0000000..99fa29a --- /dev/null +++ b/fuzz10_input.txt @@ -0,0 +1,34 @@ +add track (1,1) -> (5,1) +add switch (5,1) -> (8,1),(5,3) +add track (10,1) -> (8,1) +add switch (10,-3) -> (10,1),(12,-3) +add track (10,-3) -> (1,-3) +add track (5,3) -> (10,3) +add track (10,3) -> (12,3) +add switch (12,3) -> (12,-3),(14,3) +add track (14,-1) -> (14,3) +create engine steam T3 Emma 1 false true +create engine electrical 103 118 3 true true +delete rolling stock 3 +delete rolling stock 103-118 +create coach passenger 1 true true +add train 1 W1 +delete train 1 +add train 1 T3-Emma +add train 1 W2 +create train-set 403 145 4 true true +add train 2 403-145 +set switch 4 position (10,1) +set switch 2 position (8,1) +set switch 8 position (12,-3) +step 1 +put train 1 at (1,1) in direction 1,0 +put train 2 at (10,-2) in direction 0,1 +step 2 +step -2 +step 2 +step 4 +step 1 +# Beim Aufgleisen ist zu beachten, dass der Richtungsvektor der Richtung des Gleises beim Aufgleispunkt entspricht (oder dem entgegengesetzten). +put train 1 at (1,1) in direction 0,-1 +exit diff --git a/fuzz10_output.txt b/fuzz10_output.txt new file mode 100644 index 0000000..6534dd8 --- /dev/null +++ b/fuzz10_output.txt @@ -0,0 +1,32 @@ +1 +2 +3 +4 +5 +6 +7 +8 +9 +T3-Emma +103-118 +Error, could not delete rolling stock +OK +1 +passenger coach W1 added to train 1 +OK +steam engine T3-Emma added to train 1 +Error, could not modify train +403-145 +train-set 403-145 added to train 2 +OK +OK +OK +OK +Error, could not place train +OK +Train 2 at (10,0) +Train 2 at (10,-2) +Train 2 at (10,0) +Train 2 at (7,1) +Train 2 at (6,1) +Error, could not place train diff --git a/fuzz11_input.txt b/fuzz11_input.txt new file mode 100644 index 0000000..2c29e2d --- /dev/null +++ b/fuzz11_input.txt @@ -0,0 +1,20 @@ +add track (0,0) -> (0,14) +create engine diesel T3 Sabine 1 false true +add train 1 T3-Sabine +put train 1 at (0,0) in direction 0,-1 +add track (0,0) -> (2,0) +add track (2,0) -> (2,2) +add track (2,2) -> (0,2) +create engine diesel T3 Emma 1 false true +create coach passenger 2 true true +create coach passenger 3 true true +create coach passenger 2 true false +add train 1 T3-Emma +add train 1 W2 +put train 1 at (0,0) in direction 1,0 +step 64 +delete track 1 +delete track 2 +delete track 3 +delete track 4 +exit diff --git a/fuzz11_output.txt b/fuzz11_output.txt new file mode 100644 index 0000000..6db33ea --- /dev/null +++ b/fuzz11_output.txt @@ -0,0 +1,19 @@ +1 +T3-Sabine +diesel engine T3-Sabine added to train 1 +OK +2 +3 +4 +T3-Emma +1 +2 +3 +Error, could not modify train +Error, could not modify train +Error, could not place train +Crash of train 1 +OK +OK +OK +OK diff --git a/src/edu/kit/informatik/MainTest.java b/src/edu/kit/informatik/MainTest.java index 4ba2ddf..8c4a78a 100644 --- a/src/edu/kit/informatik/MainTest.java +++ b/src/edu/kit/informatik/MainTest.java @@ -73,6 +73,16 @@ class MainTest { cmpInOut("fuzz8_input.txt", "fuzz8_output.txt"); } + @Test + void fuzz10() throws IOException { + cmpInOut("fuzz10_input.txt", "fuzz10_output.txt"); + } + + @Test + void fuzz11() throws IOException { + cmpInOut("fuzz11_input.txt", "fuzz11_output.txt"); + } + private void cmpInOut(String in, String out) throws IOException { System.setIn(new ByteArrayInputStream(readFile(in))); ByteArrayOutputStream output = new ByteArrayOutputStream();