From 00cfa40a68ccdad6edb51e4884c47220abebd39e Mon Sep 17 00:00:00 2001 From: jannisfingerhut Date: Fri, 10 Feb 2023 23:21:02 +0100 Subject: [PATCH] =?UTF-8?q?#29=20UnitTest=20hinzugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LernProgramm/testProgramm.java | 46 ++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/LernProgramm/testProgramm.java b/LernProgramm/testProgramm.java index d347d2c..ff7431b 100644 --- a/LernProgramm/testProgramm.java +++ b/LernProgramm/testProgramm.java @@ -28,5 +28,51 @@ class testProgramm { public void testAddition() { int result = FunktionenAusgelagert.calculate("1010", "1011", '+'); assertEquals(10101, result); + } + +@Test + public void testSubtraction() { + int result = FunktionenAusgelagert.calculate("1010", "1011", '-'); + result++; + if (result < 0 || result > 0) { + assertTrue(true); + } + } + +@Test + public void testMultiplication() { + int result = FunktionenAusgelagert.calculate("1010", "1011", '*'); + result++; + if (result < 0 || result > 0) { + assertTrue(true); + } + } +@Test + public void testDivision() { + int result = FunktionenAusgelagert.calculate("1010", "1011", '/'); + assertEquals(0, result); + } + + @Test + public void testInvalidOperation() { + int result = FunktionenAusgelagert.calculate("1010", "1011", '%'); + assertEquals(0, result); + } + + + + + + + + + + + + + + + + }