From fffc21a73ea1910bacc330083fb3ebbd56bf0f58 Mon Sep 17 00:00:00 2001 From: Arne Keller Date: Fri, 28 Feb 2020 11:59:40 +0100 Subject: [PATCH] Add command tests --- commands1_input.txt | 6 ++++++ commands1_output.txt | 6 ++++++ src/edu/kit/informatik/MainTest.java | 5 +++++ 3 files changed, 17 insertions(+) create mode 100644 commands1_input.txt create mode 100644 commands1_output.txt diff --git a/commands1_input.txt b/commands1_input.txt new file mode 100644 index 0000000..e4abf41 --- /dev/null +++ b/commands1_input.txt @@ -0,0 +1,6 @@ +list-buildings +list-resources +list-buildings I can build +list-resources I can buy +reset +reset the game diff --git a/commands1_output.txt b/commands1_output.txt new file mode 100644 index 0000000..7191d62 --- /dev/null +++ b/commands1_output.txt @@ -0,0 +1,6 @@ +EMPTY +EMPTY +Error, invalid list-buildings argument: none expected +Error, invalid list-resources argument: none expected +OK +Error, invalid reset argument: none expected diff --git a/src/edu/kit/informatik/MainTest.java b/src/edu/kit/informatik/MainTest.java index 1542ade..fcec58a 100644 --- a/src/edu/kit/informatik/MainTest.java +++ b/src/edu/kit/informatik/MainTest.java @@ -13,6 +13,11 @@ class MainTest { cmpInOut("game1_input.txt", "game1_output.txt"); } + @Test + void commands1() throws IOException { + cmpInOut("commands1_input.txt", "commands1_output.txt"); + } + private void cmpInOut(String in, String out) throws IOException { System.setIn(new ByteArrayInputStream(readFile(in))); ByteArrayOutputStream output = new ByteArrayOutputStream();