diff options
| author | Stefan Suhren <suhren.stefan@fh-swf.de> | 2015-01-12 19:31:40 +0100 |
|---|---|---|
| committer | Stefan Suhren <suhren.stefan@fh-swf.de> | 2015-01-12 19:31:40 +0100 |
| commit | b2a66673c2d7d67fbb967c17c038814c4cec166c (patch) | |
| tree | b549a511feb65c090a6da94131770c4783564e79 /src/de/fhswf/in/inf/java1/aufgabe13/UnaryOperatorTests.java | |
| parent | ad9ec8854341770a84700d3df18c3a044a14f673 (diff) | |
| download | Java1-b2a66673c2d7d67fbb967c17c038814c4cec166c.tar.gz Java1-b2a66673c2d7d67fbb967c17c038814c4cec166c.zip | |
Assignment No.13 first implementation.
Diffstat (limited to 'src/de/fhswf/in/inf/java1/aufgabe13/UnaryOperatorTests.java')
| -rw-r--r-- | src/de/fhswf/in/inf/java1/aufgabe13/UnaryOperatorTests.java | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/src/de/fhswf/in/inf/java1/aufgabe13/UnaryOperatorTests.java b/src/de/fhswf/in/inf/java1/aufgabe13/UnaryOperatorTests.java new file mode 100644 index 0000000..997f71e --- /dev/null +++ b/src/de/fhswf/in/inf/java1/aufgabe13/UnaryOperatorTests.java @@ -0,0 +1,60 @@ +/** + * + */ +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.UnaryOperator; +import de.fhswf.in.inf.java1.aufgabe12.UnaryTemplate; + +/** + * Tests the BinaryOperators. + * + * @author $Author: $ + * @version $Revision: $, $Date: $ UTC + */ +public class UnaryOperatorTests +{ + + /** + * Test for the UnaryTemplate class initialized with sin. + */ + @Test + public final void testOperatorSin() + { + // Sin is tested + UnaryOperator tester = new UnaryTemplate("sin"); + + // Test + Stack<Double> test = new Stack<>(); + + test.add(0.0); + tester.eval(test); + + assertEquals(0.0, (double) test.pop(), 0); + } + + /** + * Test for the UnaryTemplate class initialized with cos. + */ + @Test + public final void testOperatorCos() + { + // Cos is tested + UnaryOperator tester = new UnaryTemplate("cos"); + + // Test + Stack<Double> test = new Stack<>(); + + test.add(0.0); + tester.eval(test); + + assertEquals(1.0, (double) test.pop(), 0); + } + +} |
