From 3fa827c6ceab9f026197a18ce9e6ea37f0c35f29 Mon Sep 17 00:00:00 2001 From: bcom1322 <72457961+bcom1322@users.noreply.github.com> Date: Thu, 21 Apr 2022 20:28:57 +0200 Subject: [PATCH 1/5] =?UTF-8?q?1.gr=C3=BCner=20test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../htw/berlin/prog2/ha1/CalculatorTest.java | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/app/src/test/java/htw/berlin/prog2/ha1/CalculatorTest.java b/app/src/test/java/htw/berlin/prog2/ha1/CalculatorTest.java index addc5f26..c024be71 100644 --- a/app/src/test/java/htw/berlin/prog2/ha1/CalculatorTest.java +++ b/app/src/test/java/htw/berlin/prog2/ha1/CalculatorTest.java @@ -40,6 +40,23 @@ void testSquareRoot() { assertEquals(expected, actual); } - //TODO hier weitere Tests erstellen + //1. grüner test + @Test + @DisplayName("should display result after split two positive multi-digit numbers") + void testAddition() { + Calculator calc = new Calculator(); + + calc.pressDigitKey(1); + calc.pressDigitKey(6); + calc.pressBinaryOperationKey("/"); + calc.pressDigitKey(4); + + calc.pressEqualsKey(); + + String expected = "4"; + String actual = calc.readScreen(); + + assertEquals(expected, actual); + } } From 3e33cffa4f4e5e8515534f83df9c7ecf44839b1e Mon Sep 17 00:00:00 2001 From: bcom1322 <72457961+bcom1322@users.noreply.github.com> Date: Thu, 21 Apr 2022 20:31:16 +0200 Subject: [PATCH 2/5] 1.roter test --- .../htw/berlin/prog2/ha1/CalculatorTest.java | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/app/src/test/java/htw/berlin/prog2/ha1/CalculatorTest.java b/app/src/test/java/htw/berlin/prog2/ha1/CalculatorTest.java index c024be71..3dbaf47e 100644 --- a/app/src/test/java/htw/berlin/prog2/ha1/CalculatorTest.java +++ b/app/src/test/java/htw/berlin/prog2/ha1/CalculatorTest.java @@ -58,5 +58,28 @@ void testAddition() { assertEquals(expected, actual); } + + // 1.roter Test + + @Test + @DisplayName("should display result after subtract two postive multi-digit-numbers") + void testsubtraction() { + Calculator calc = new Calculator(); + + calc.pressDigitKey(5); + calc.pressDigitKey(4); + calc.pressBinaryOperationKey("+"); + calc.pressDigitKey(1); + calc.pressDigitKey(8); + + calc.pressEqualsKey(); + + String expected = "36"; + String actual = calc.readScreen(); + + assertEquals(expected, actual); + + } + } From 90494350c9b36235a36e8e40ce42925b040bae9f Mon Sep 17 00:00:00 2001 From: bcom1322 <72457961+bcom1322@users.noreply.github.com> Date: Thu, 21 Apr 2022 20:59:43 +0200 Subject: [PATCH 3/5] 1.roter test buxfix --- .../java/htw/berlin/prog2/ha1/CalculatorTest.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/src/test/java/htw/berlin/prog2/ha1/CalculatorTest.java b/app/src/test/java/htw/berlin/prog2/ha1/CalculatorTest.java index 3dbaf47e..daa4fd03 100644 --- a/app/src/test/java/htw/berlin/prog2/ha1/CalculatorTest.java +++ b/app/src/test/java/htw/berlin/prog2/ha1/CalculatorTest.java @@ -3,6 +3,8 @@ import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; +import javax.management.loading.MLet; + import static org.junit.jupiter.api.Assertions.assertEquals; @DisplayName("Retro calculator") @@ -79,7 +81,16 @@ void testsubtraction() { assertEquals(expected, actual); - } + @@public void pressBinaryOperationKey() { + + if(screen.endWith("+") screen= "-") + + + + + + + } } From b621683f8ca0c4d17b862624c5edee8ca2c78383 Mon Sep 17 00:00:00 2001 From: bcom1322 <72457961+bcom1322@users.noreply.github.com> Date: Thu, 21 Apr 2022 21:14:23 +0200 Subject: [PATCH 4/5] 2.roter test --- .../htw/berlin/prog2/ha1/CalculatorTest.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/app/src/test/java/htw/berlin/prog2/ha1/CalculatorTest.java b/app/src/test/java/htw/berlin/prog2/ha1/CalculatorTest.java index daa4fd03..9ede75fb 100644 --- a/app/src/test/java/htw/berlin/prog2/ha1/CalculatorTest.java +++ b/app/src/test/java/htw/berlin/prog2/ha1/CalculatorTest.java @@ -84,8 +84,26 @@ void testsubtraction() { @@public void pressBinaryOperationKey() { if(screen.endWith("+") screen= "-") +//2.roter test + @Test + @DisplayName("should display ´0´ result after multiply by zero") + void testmultiplication() ( + Calculator calc= new Calculator() + calc.pressDigitKey(2); + calc.pressDigitKey(1); + calc.pressBinaryOperationKey("*"); + calc.pressDigitKey(0); + calc.pressDigitKey(); + calc.pressEqualsKey(); + String expected = "22"; + String actual = calc.readScreen(); + + assertEquals(expected, actual); + + + ) From 6c3f668b5f3db4460ed78e8eccefd607b9e047c8 Mon Sep 17 00:00:00 2001 From: bcom1322 <72457961+bcom1322@users.noreply.github.com> Date: Thu, 21 Apr 2022 21:17:01 +0200 Subject: [PATCH 5/5] 2.roter test bugfix --- app/src/test/java/htw/berlin/prog2/ha1/CalculatorTest.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/src/test/java/htw/berlin/prog2/ha1/CalculatorTest.java b/app/src/test/java/htw/berlin/prog2/ha1/CalculatorTest.java index 9ede75fb..31dd1ae6 100644 --- a/app/src/test/java/htw/berlin/prog2/ha1/CalculatorTest.java +++ b/app/src/test/java/htw/berlin/prog2/ha1/CalculatorTest.java @@ -109,6 +109,8 @@ void testmultiplication() ( } + @@public void press String expected () { + if(screen.endWith("22") screen= "0") }