summaryrefslogtreecommitdiffstats
path: root/src/de/fhswf/in/inf/java1/aufgabe13/BinaryOperatorTests.java
diff options
context:
space:
mode:
authorStefan Suhren <suhren.stefan@fh-swf.de>2015-01-14 14:12:03 +0100
committerStefan Suhren <suhren.stefan@fh-swf.de>2015-01-14 14:12:03 +0100
commitdc5ea1e78eee529090d739774889639fab1c181c (patch)
tree2acee44930f7d9227aa1dbb1d6256bfaad245cda /src/de/fhswf/in/inf/java1/aufgabe13/BinaryOperatorTests.java
parent1b7c58e24ac4a143521aa0a77f6a1a486a1dca39 (diff)
downloadJava1-dc5ea1e78eee529090d739774889639fab1c181c.tar.gz
Java1-dc5ea1e78eee529090d739774889639fab1c181c.zip
Assignment No.13 after correction
Diffstat (limited to 'src/de/fhswf/in/inf/java1/aufgabe13/BinaryOperatorTests.java')
-rw-r--r--src/de/fhswf/in/inf/java1/aufgabe13/BinaryOperatorTests.java148
1 files changed, 0 insertions, 148 deletions
diff --git a/src/de/fhswf/in/inf/java1/aufgabe13/BinaryOperatorTests.java b/src/de/fhswf/in/inf/java1/aufgabe13/BinaryOperatorTests.java
deleted file mode 100644
index 238c865..0000000
--- a/src/de/fhswf/in/inf/java1/aufgabe13/BinaryOperatorTests.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/**
- *
- */
-package de.fhswf.in.inf.java1.aufgabe13;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.Stack;
-
-import org.junit.Test;
-
-import de.fhswf.in.inf.java1.aufgabe12.Addition;
-import de.fhswf.in.inf.java1.aufgabe12.BinaryOperator;
-import de.fhswf.in.inf.java1.aufgabe12.BinaryTemplate;
-import de.fhswf.in.inf.java1.aufgabe12.Division;
-import de.fhswf.in.inf.java1.aufgabe12.Modulo;
-import de.fhswf.in.inf.java1.aufgabe12.Multiplication;
-import de.fhswf.in.inf.java1.aufgabe12.Subtraction;
-
-/**
- * Tests the BinaryOperators.
- *
- * @author $Author: $
- * @version $Revision: $, $Date: $ UTC
- */
-public class BinaryOperatorTests
-{
-
- /**
- * Test for the Addition class.
- */
- @Test
- public final void testOperatorAddition()
- {
- // Sin is tested
- BinaryOperator tester = new Addition();
-
- // Test
- Stack<Double> test = new Stack<>();
-
- test.add(1.0);
- test.add(1.0);
- tester.eval(test);
-
- assertEquals(2.0, (double) test.pop(), 0);
- }
-
- /**
- * Test for the Division class.
- */
- @Test
- public final void testOperatorDivision()
- {
- // Sin is tested
- BinaryOperator tester = new Division();
-
- // Test
- Stack<Double> test = new Stack<>();
-
- test.add(2.0);
- test.add(2.0);
- tester.eval(test);
-
- assertEquals(1.0, (double) test.pop(), 0);
- }
-
- /**
- * Test for the Modulo class.
- */
- @Test
- public final void testOperatorModulo()
- {
- // Sin is tested
- BinaryOperator tester = new Modulo();
-
- // Test
- Stack<Double> test = new Stack<>();
-
- final double firstOperator = 3.0;
- test.add(firstOperator);
- test.add(2.0);
- tester.eval(test);
-
- assertEquals(1.0, (double) test.pop(), 0);
- }
-
- /**
- * Test for the Multiplication class.
- */
- @Test
- public final void testOperatorMultiplication()
- {
- // Sin is tested
- BinaryOperator tester = new Multiplication();
-
- // Test
- Stack<Double> test = new Stack<>();
-
- test.add(2.0);
- test.add(2.0);
- tester.eval(test);
-
- final double expected = 4.0;
- assertEquals(expected, (double) test.pop(), 0);
- }
-
- /**
- * Test for the Subtraction class.
- */
- @Test
- public final void testOperatorSubtraction()
- {
- // Sin is tested
- BinaryOperator tester = new Subtraction();
-
- // Test
- Stack<Double> test = new Stack<>();
-
- test.add(2.0);
- test.add(2.0);
- tester.eval(test);
-
- assertEquals(0.0, (double) test.pop(), 0);
- }
-
- /**
- * Test for the BinaryTemplate class initialized with pow.
- */
- @Test
- public final void testOperatorPow()
- {
- // Sin is tested
- BinaryOperator tester = new BinaryTemplate("pow");
-
- // Test
- Stack<Double> test = new Stack<>();
-
- final double exponent = 3.0;
-
- test.add(2.0);
- test.add(exponent);
- tester.eval(test);
-
- final double expected = 8.0;
- assertEquals(expected, (double) test.pop(), 0);
- }
-
-}