001 package de.hska.java.aufgaben.interfaces;
002
003 import junit.framework.TestCase;
004
005 /**
006 * JUnit-Testklasse für DezimalzahlArray
007 * @author Christian Pape
008 *
009 */
010 public class DezimalzahlArrayTest extends TestCase {
011
012 public void testAddieren() {
013 Dezimalzahl zahl1 = new DezimalzahlArray(1234L);
014 Dezimalzahl zahl2 = new DezimalzahlArray(1111L);
015
016 assertEquals(2345.0, zahl1.addieren(zahl2).getDouble(), 0.001);
017
018 }
019
020 public void testGetDouble() {
021 Dezimalzahl zahl = new DezimalzahlArray(1234L);
022 assertEquals(1234.0, zahl.getDouble(), 0.001);
023 }
024
025 public void testMultiplizieren() {
026 Dezimalzahl zahl1 = new DezimalzahlArray(12L);
027 Dezimalzahl zahl2 = new DezimalzahlArray(11L);
028
029 assertEquals(132.0, zahl1.multiplizieren(zahl2).getDouble(), 0.001);
030
031 }
032
033 public void testMultiplizieren1() {
034 Dezimalzahl zahl1 = new DezimalzahlArray(1001L);
035 Dezimalzahl zahl2 = new DezimalzahlArray(22L);
036
037 assertEquals(22022.0, zahl1.multiplizieren(zahl2).getDouble(), 0.001);
038 }
039
040 public void testToString() {
041 Dezimalzahl zahl = new DezimalzahlArray(1234L);
042
043 assertEquals("1234", zahl.toString());
044 }
045
046 }