diff --git a/bin/test/oop/ch03/chess/ChessTest.class b/bin/test/oop/ch03/chess/ChessTest.class deleted file mode 100644 index 4a250b4..0000000 Binary files a/bin/test/oop/ch03/chess/ChessTest.class and /dev/null differ diff --git a/bin/test/oop/ch05/generic/mensa/MensaTest.class b/bin/test/oop/ch05/generic/mensa/MensaTest.class deleted file mode 100644 index 8550d09..0000000 Binary files a/bin/test/oop/ch05/generic/mensa/MensaTest.class and /dev/null differ diff --git a/bin/test/oop/ch08/gui/mvc/TestModel.class b/bin/test/oop/ch08/gui/mvc/TestModel.class deleted file mode 100644 index 82a0510..0000000 Binary files a/bin/test/oop/ch08/gui/mvc/TestModel.class and /dev/null differ diff --git a/bin/test/oop/ch09/calc/test/AdHocCalculatorEdgePairTest.class b/bin/test/oop/ch09/calc/test/AdHocCalculatorEdgePairTest.class deleted file mode 100644 index 1b5b8e4..0000000 Binary files a/bin/test/oop/ch09/calc/test/AdHocCalculatorEdgePairTest.class and /dev/null differ diff --git a/bin/test/oop/ch09/calc/test/AdHocCalculatorEdgeTest.class b/bin/test/oop/ch09/calc/test/AdHocCalculatorEdgeTest.class deleted file mode 100644 index c474a6f..0000000 Binary files a/bin/test/oop/ch09/calc/test/AdHocCalculatorEdgeTest.class and /dev/null differ diff --git a/bin/test/oop/ch09/calc/test/CalculatorEdgePairTest.class b/bin/test/oop/ch09/calc/test/CalculatorEdgePairTest.class deleted file mode 100644 index 1c664cc..0000000 Binary files a/bin/test/oop/ch09/calc/test/CalculatorEdgePairTest.class and /dev/null differ diff --git a/bin/test/oop/ch09/testing/ExceptionTest.class b/bin/test/oop/ch09/testing/ExceptionTest.class deleted file mode 100644 index c68f8a1..0000000 Binary files a/bin/test/oop/ch09/testing/ExceptionTest.class and /dev/null differ diff --git a/bin/test/uebung/uebung04/tournament/TournamentTest.class b/bin/test/uebung/uebung04/tournament/TournamentTest.class deleted file mode 100644 index 1e6e1d9..0000000 Binary files a/bin/test/uebung/uebung04/tournament/TournamentTest.class and /dev/null differ diff --git a/bin/test/uebung/uebung05/logistics/ManagerTest.class b/bin/test/uebung/uebung05/logistics/ManagerTest.class index e26652b..1601994 100644 Binary files a/bin/test/uebung/uebung05/logistics/ManagerTest.class and b/bin/test/uebung/uebung05/logistics/ManagerTest.class differ diff --git a/bin/test/uebung/uebung05/logistics/storage/IntStorageTest.class b/bin/test/uebung/uebung05/logistics/storage/IntStorageTest.class index ab442b7..433eff0 100644 Binary files a/bin/test/uebung/uebung05/logistics/storage/IntStorageTest.class and b/bin/test/uebung/uebung05/logistics/storage/IntStorageTest.class differ diff --git a/bin/uebung04/ByeGame.class b/bin/uebung04/ByeGame.class index 77308b2..7a6bf38 100644 Binary files a/bin/uebung04/ByeGame.class and b/bin/uebung04/ByeGame.class differ diff --git a/bin/uebung04/OrdinaryGame.class b/bin/uebung04/OrdinaryGame.class index 2474348..ef42194 100644 Binary files a/bin/uebung04/OrdinaryGame.class and b/bin/uebung04/OrdinaryGame.class differ diff --git a/bin/uebung05/logistics/Helicopter.class b/bin/uebung05/logistics/Helicopter.class index 4bfeee0..01286a7 100644 Binary files a/bin/uebung05/logistics/Helicopter.class and b/bin/uebung05/logistics/Helicopter.class differ diff --git a/bin/uebung05/logistics/Manager.class b/bin/uebung05/logistics/Manager.class index a074bb5..822047c 100644 Binary files a/bin/uebung05/logistics/Manager.class and b/bin/uebung05/logistics/Manager.class differ diff --git a/bin/uebung05/logistics/NeedCollector.class b/bin/uebung05/logistics/NeedCollector.class index 6156901..7a00038 100644 Binary files a/bin/uebung05/logistics/NeedCollector.class and b/bin/uebung05/logistics/NeedCollector.class differ diff --git a/bin/uebung05/logistics/Tank.class b/bin/uebung05/logistics/Tank.class index 3d52ae7..3156cd8 100644 Binary files a/bin/uebung05/logistics/Tank.class and b/bin/uebung05/logistics/Tank.class differ diff --git a/bin/uebung05/logistics/Truck.class b/bin/uebung05/logistics/Truck.class index b6cb8cb..3e17873 100644 Binary files a/bin/uebung05/logistics/Truck.class and b/bin/uebung05/logistics/Truck.class differ diff --git a/bin/uebung05/logistics/Vehicle.class b/bin/uebung05/logistics/Vehicle.class index 122bb98..904d5f7 100644 Binary files a/bin/uebung05/logistics/Vehicle.class and b/bin/uebung05/logistics/Vehicle.class differ diff --git a/bin/uebung05/logistics/demo.class b/bin/uebung05/logistics/demo.class index 33773c7..9ae7dbb 100644 Binary files a/bin/uebung05/logistics/demo.class and b/bin/uebung05/logistics/demo.class differ diff --git a/bin/uebung05/logistics/material/BulletBelts.class b/bin/uebung05/logistics/material/BulletBelts.class index c4a0e4b..5828171 100644 Binary files a/bin/uebung05/logistics/material/BulletBelts.class and b/bin/uebung05/logistics/material/BulletBelts.class differ diff --git a/bin/uebung05/logistics/material/Grease.class b/bin/uebung05/logistics/material/Grease.class index 6c93add..2f18ee8 100644 Binary files a/bin/uebung05/logistics/material/Grease.class and b/bin/uebung05/logistics/material/Grease.class differ diff --git a/bin/uebung05/logistics/material/LiterDiesel.class b/bin/uebung05/logistics/material/LiterDiesel.class index f8bc02e..1d5f5d2 100644 Binary files a/bin/uebung05/logistics/material/LiterDiesel.class and b/bin/uebung05/logistics/material/LiterDiesel.class differ diff --git a/bin/uebung05/logistics/material/MetGallonsKerosene.class b/bin/uebung05/logistics/material/MetGallonsKerosene.class index cc3f964..7d8cbe2 100644 Binary files a/bin/uebung05/logistics/material/MetGallonsKerosene.class and b/bin/uebung05/logistics/material/MetGallonsKerosene.class differ diff --git a/bin/uebung05/logistics/material/Oil.class b/bin/uebung05/logistics/material/Oil.class index d0770df..f626021 100644 Binary files a/bin/uebung05/logistics/material/Oil.class and b/bin/uebung05/logistics/material/Oil.class differ diff --git a/bin/uebung05/logistics/material/RocketPods.class b/bin/uebung05/logistics/material/RocketPods.class index e305bfc..d7fdb58 100644 Binary files a/bin/uebung05/logistics/material/RocketPods.class and b/bin/uebung05/logistics/material/RocketPods.class differ diff --git a/bin/uebung05/logistics/material/ShellBatches.class b/bin/uebung05/logistics/material/ShellBatches.class index 10ace74..c0991d0 100644 Binary files a/bin/uebung05/logistics/material/ShellBatches.class and b/bin/uebung05/logistics/material/ShellBatches.class differ diff --git a/bin/uebung05/logistics/quantities/NeedCollector.class b/bin/uebung05/logistics/quantities/NeedCollector.class index 165c8db..40f73f4 100644 Binary files a/bin/uebung05/logistics/quantities/NeedCollector.class and b/bin/uebung05/logistics/quantities/NeedCollector.class differ diff --git a/bin/uebung05/logistics/storage/FloatStorage.class b/bin/uebung05/logistics/storage/FloatStorage.class index 912a91f..94770e7 100644 Binary files a/bin/uebung05/logistics/storage/FloatStorage.class and b/bin/uebung05/logistics/storage/FloatStorage.class differ diff --git a/bin/uebung05/logistics/storage/IntStorage.class b/bin/uebung05/logistics/storage/IntStorage.class index 7e5e75e..19ea91d 100644 Binary files a/bin/uebung05/logistics/storage/IntStorage.class and b/bin/uebung05/logistics/storage/IntStorage.class differ diff --git a/bin/uebung07/quantities/plain/Time.class b/bin/uebung07/quantities/plain/Time.class index f266978..73a6f04 100644 Binary files a/bin/uebung07/quantities/plain/Time.class and b/bin/uebung07/quantities/plain/Time.class differ diff --git a/bin/uebung07/quantities/plain/TimeUnit.class b/bin/uebung07/quantities/plain/TimeUnit.class deleted file mode 100644 index abc9576..0000000 Binary files a/bin/uebung07/quantities/plain/TimeUnit.class and /dev/null differ diff --git a/bin/uebung09/chess/Board.class b/bin/uebung09/chess/Board.class index bfa82bb..8dee0ab 100644 Binary files a/bin/uebung09/chess/Board.class and b/bin/uebung09/chess/Board.class differ diff --git a/bin/uebung09/iterator/Array2dIterator.class b/bin/uebung09/iterator/Array2dIterator.class index 6dff3bd..b957bf4 100644 Binary files a/bin/uebung09/iterator/Array2dIterator.class and b/bin/uebung09/iterator/Array2dIterator.class differ diff --git a/src/test/oop/ch03/chess/ChessTest.java b/src/test/oop/ch03/chess/ChessTest.java deleted file mode 100644 index 4b46c23..0000000 --- a/src/test/oop/ch03/chess/ChessTest.java +++ /dev/null @@ -1,168 +0,0 @@ -package oop.ch03.chess; - -import org.junit.After; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - -import java.io.ByteArrayOutputStream; -import java.io.PrintStream; - -import static org.junit.Assert.assertEquals; - -public class ChessTest { - // Das Zeilenende wird auf Windows-Systemen anders codiert als auf Nicht-Windows-Systemen. - // Die folgende Zeile ermittelt die aktuelle Codierung. - // EOL = "End of Line" - private static final String LS = System.lineSeparator(); - private static final String HE = " 1 2 3 4 5 6 7 8" + LS; - private static final String LI = " +---+---+---+---+---+---+---+---+" + LS; - private static final String EMP = " | | | | | | | | |" + LS; - private static final String WK1 = " | n | | | | | | | |" + LS; - private static final String WQ3 = " | | | q | | | | | |" + LS; - private static final String CO1 = " | | | n | | N | Q | | |" + LS; - private static final String INIT_BOARD = board(EMP, EMP, EMP, EMP, EMP, EMP, EMP, EMP); - private static final String WK61_BOARD = board(EMP, EMP, EMP, EMP, EMP, WK1, EMP, EMP); - private static final String APP1_BOARD = board(EMP, EMP, EMP, EMP, WQ3, CO1, EMP, EMP); - private static final String CHECK_TEXT1 = "white queen at (4, 2)" + LS + - " cannot capture black queen at (8, 6)" + LS + - " cannot capture white knight at (6, 4)" + LS + - "black queen at (8, 6)" + LS + - " cannot capture white queen at (4, 2)" + LS + - " can capture white knight at (6, 4)" + LS + - "white knight at (6, 4)" + LS + - " cannot capture white queen at (4, 2)" + LS + - " cannot capture black queen at (8, 6)" + LS; - private static final String CHECK_TEXT2 = "white knight at (6, 3)" + LS + - " cannot capture black knight at (6, 5)" + LS + - " cannot capture black queen at (6, 6)" + LS + - " cannot capture white queen at (5, 3)" + LS + - "black knight at (6, 5)" + LS + - " cannot capture white knight at (6, 3)" + LS + - " cannot capture black queen at (6, 6)" + LS + - " can capture white queen at (5, 3)" + LS + - "black queen at (6, 6)" + LS + - " cannot capture white knight at (6, 3)" + LS + - " cannot capture black knight at (6, 5)" + LS + - " cannot capture white queen at (5, 3)" + LS + - "white queen at (5, 3)" + LS + - " cannot capture white knight at (6, 3)" + LS + - " cannot capture black knight at (6, 5)" + LS + - " cannot capture black queen at (6, 6)" + LS; - - private static String board(String... s) { - if (s.length != 8) - throw new IllegalArgumentException("Expected 8, but got " + s.length + " arguments"); - StringBuilder sb = new StringBuilder(); - sb.append(HE).append(LI); - for (int i = 1; i <= 8; i++) - sb.append(i).append(s[i - 1]).append(LI); - return sb.toString(); - } - - private Board board; - - private final ByteArrayOutputStream printed = new ByteArrayOutputStream(); - private final PrintStream printStream = new PrintStream(printed, true); - - @Before - public void setup() { - board = new Board(); - printed.reset(); - System.setOut(printStream); - } - - @After - public void tearDown() { - printStream.close(); - } - - @Test - public void testEmpty() { - board.printBoard(); - assertEquals(INIT_BOARD, printed.toString()); - } - - @Test(expected = IllegalArgumentException.class) - public void testInvalidPos1() { - new Knight(Color.white, board, 0, 4); - } - - @Test(expected = IllegalArgumentException.class) - public void testInvalidPos2() { - new Queen(Color.white, board, 0, 4); - } - - @Test - public void testWhiteknight() { - final Piece knight = new Knight(Color.white, board, 6, 1); - checkPieces(1); - assertEquals(knight, board.pieceAt(6, 1)); - board.printBoard(); - assertEquals(WK61_BOARD, printed.toString()); - } - - @Test - public void test3Pieces() { - final Piece queen1 = new Queen(Color.white, board, 4, 2); - final Piece queen2 = new Queen(Color.black, board, 8, 6); - final Piece knight = new Knight(Color.white, board, 6, 4); - Assert.assertFalse(queen1.canCapture(queen2)); - Assert.assertFalse(queen1.canCapture(knight)); - Assert.assertFalse(queen2.canCapture(queen1)); - Assert.assertTrue(queen2.canCapture(knight)); - Assert.assertFalse(knight.canCapture(queen1)); - Assert.assertFalse(knight.canCapture(queen2)); - checkPieces(3); - assertEquals(queen1, board.pieceAt(4, 2)); - assertEquals(queen2, board.pieceAt(8, 6)); - assertEquals(knight, board.pieceAt(6, 4)); - board.check(); - assertEquals(CHECK_TEXT1, printed.toString()); - } - - @Test - public void test4Pieces() { - final Piece knight1 = new Knight(Color.white, board, 6, 3); - final Piece knight2 = new Knight(Color.black, board, 6, 5); - final Piece queen1 = new Queen(Color.black, board, 6, 6); - final Piece queen2 = new Queen(Color.white, board, 5, 3); - checkPieces(4); - assertEquals(knight1, board.pieceAt(6, 3)); - assertEquals(knight2, board.pieceAt(6, 5)); - assertEquals(queen1, board.pieceAt(6, 6)); - assertEquals(queen2, board.pieceAt(5, 3)); - board.printBoard(); - assertEquals(APP1_BOARD, printed.toString()); - Assert.assertFalse(knight1.canCapture(knight2)); - Assert.assertFalse(knight1.canCapture(queen1)); - Assert.assertFalse(knight1.canCapture(queen2)); - Assert.assertFalse(knight2.canCapture(knight1)); - Assert.assertFalse(knight2.canCapture(queen1)); - Assert.assertTrue(knight2.canCapture(queen2)); - Assert.assertFalse(queen1.canCapture(knight1)); - Assert.assertFalse(queen1.canCapture(knight2)); - Assert.assertFalse(queen1.canCapture(queen2)); - Assert.assertFalse(queen2.canCapture(knight1)); - Assert.assertFalse(queen2.canCapture(knight2)); - Assert.assertFalse(queen2.canCapture(queen1)); - printed.reset(); - board.check(); - assertEquals(CHECK_TEXT2, printed.toString()); - } - - private void checkPieces(int expectedNumPieces) { - int numPieces = 0; - for (int row = 1; row < 9; row++) - for (int col = 1; col < 9; col++) - if (board.pieceAt(row, col) != null) - numPieces++; - assertEquals(expectedNumPieces, numPieces); - } - - @Test - public void testRunWithErrors() { - final Piece rook = new Rook(Color.white, board, 1, 1); - assertEquals(rook, board.pieceAt(1, 1)); - } -} \ No newline at end of file diff --git a/src/test/oop/ch05/generic/mensa/MensaTest.java b/src/test/oop/ch05/generic/mensa/MensaTest.java deleted file mode 100644 index b3a3e06..0000000 --- a/src/test/oop/ch05/generic/mensa/MensaTest.java +++ /dev/null @@ -1,80 +0,0 @@ -package oop.ch05.generic.mensa; - -import oop.ch05.generic.secured.AuthorizationException; -import org.junit.Before; -import org.junit.Test; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThrows; - -public class MensaTest { - private static final String CONF_ACCOUNT = "33-1298"; - private static final String OTHER_ACCOUNT = "33-1299"; - private AccountManagement accountMgt; - private VendingMachine vm1; - private VendingMachine vm2; - private VendingMachine tumVM; - private CashPoint unibwMensa; - - private AccountCard conf; - private MensaCard frankSmith; - private CashCard hansMueller; - private CashCard peterSchmidt; - private CashCard thomasMayer; - - @Before - public void setup() { - accountMgt = new AccountManagement(4711, "UniBw admin"); - - vm1 = new VendingMachine("left", 4711); - vm2 = new VendingMachine("right", 4711); - tumVM = new VendingMachine("TUM Mensa", 3141); - unibwMensa = new CashPoint("UniBw Mensa", 4711, accountMgt); - - conf = new AccountCard("conference", CONF_ACCOUNT, 42); - frankSmith = new CountCard("Frank Smith", Color.gray); - hansMueller = new CashCard("Hans Müller", Color.green, 4711); - peterSchmidt = new CashCard("Peter Schmidt", Color.green, 4711); - thomasMayer = new CashCard("Thomas Mayer", Color.blue, 4711); - } - - @Test - public void testPayment() throws AuthorizationException, RejectedException { - vm1.deposit(hansMueller, 10); - vm1.deposit(peterSchmidt, 5); - vm2.deposit(thomasMayer, 2); - assertThrows(AuthorizationException.class, () -> tumVM.deposit(hansMueller, 10)); - - assertEquals(15, vm1.getEuros()); - assertEquals(2, vm2.getEuros()); - assertEquals(0, tumVM.getEuros()); - assertEquals(1000, hansMueller.getBalance()); - assertEquals(500, peterSchmidt.getBalance()); - assertEquals(200, thomasMayer.getBalance()); - - hansMueller.pass(unibwMensa); - assertEquals(733, hansMueller.getBalance()); - assertEquals(1, unibwMensa.getCounter()); - assertEquals(267, unibwMensa.getCents()); - - frankSmith.pass(unibwMensa); - assertEquals(0, accountMgt.getAmount(CONF_ACCOUNT)); - assertThrows(RejectedException.class, () -> conf.pass(unibwMensa)); - assertThrows(RejectedException.class, () -> thomasMayer.pass(unibwMensa)); - hansMueller.pass(unibwMensa); - hansMueller.pass(unibwMensa); - assertEquals(199, hansMueller.getBalance()); - - assertThrows(RejectedException.class, () -> hansMueller.pass(unibwMensa)); - - accountMgt.deposit(CONF_ACCOUNT, 1000); - accountMgt.deposit(OTHER_ACCOUNT, 2000); - assertEquals(100000, accountMgt.getAmount(CONF_ACCOUNT)); - assertEquals(200000, accountMgt.getAmount(OTHER_ACCOUNT)); - - conf.pass(unibwMensa); - assertEquals(99505, accountMgt.getAmount(CONF_ACCOUNT)); - assertEquals(200000, accountMgt.getAmount(OTHER_ACCOUNT)); - assertEquals(5, unibwMensa.getCounter()); - } -} diff --git a/src/test/oop/ch08/gui/mvc/TestModel.java b/src/test/oop/ch08/gui/mvc/TestModel.java deleted file mode 100644 index 2275ed6..0000000 --- a/src/test/oop/ch08/gui/mvc/TestModel.java +++ /dev/null @@ -1,24 +0,0 @@ -package oop.ch08.gui.mvc; - -import oop.ch08.gui.mvc.model.CounterModel; -import org.junit.Test; - -import static org.junit.Assert.assertEquals; - -public class TestModel { - @Test - public void testInitWithZero() { - final CounterModel model = new CounterModel(); - assertEquals(0, model.getCounter()); - } - - @Test - public void testInc() { - final CounterModel model = new CounterModel(); - int counter = model.getCounter(); - model.increment(); - assertEquals(++counter, model.getCounter()); - model.increment(); - assertEquals(++counter, model.getCounter()); - } -} diff --git a/src/test/oop/ch09/calc/test/AdHocCalculatorEdgePairTest.java b/src/test/oop/ch09/calc/test/AdHocCalculatorEdgePairTest.java deleted file mode 100644 index df6d4ff..0000000 --- a/src/test/oop/ch09/calc/test/AdHocCalculatorEdgePairTest.java +++ /dev/null @@ -1,2040 +0,0 @@ -package oop.ch09.calc.test; - -import oop.ch06.calc.AdHocCalculator; -import oop.ch06.calc.Ops; -import org.junit.Before; -import org.junit.Test; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -public class AdHocCalculatorEdgePairTest { - private AdHocCalculator calc; - - @Before - public void setup() { - calc = new AdHocCalculator(); - calc.digit(6); - calc.binOp(Ops.MULT); - calc.digit(7); - calc.eval(); - } - - @Test - public void test0() { - calc.unOp(Ops.SQRT); - assertEquals(6.48074069840786, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.digit(4); - assertEquals(4.0, calc.getValue(), 1e-10); - calc.digit(5); - assertEquals(45.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(45.0, calc.getValue(), 1e-10); - calc.unOp(Ops.CHANGE_SIGN); - assertEquals(-45.0, calc.getValue(), 1e-10); - calc.binOp(Ops.MINUS); - assertEquals(-45.0, calc.getValue(), 1e-10); - calc.digit(6); - assertEquals(6.0, calc.getValue(), 1e-10); - calc.binOp(Ops.MINUS); - assertEquals(-51.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.unOp(Ops.EXP); - assertEquals(1.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.binOp(Ops.PLUS); - assertEquals(-51.0, calc.getValue(), 1e-10); - calc.binOp(Ops.PLUS); - assertEquals(-51.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(-102.0, calc.getValue(), 1e-10); - calc.unOp(Ops.EXP); - assertEquals(5.0345753587649823E-45, calc.getValue(), 1e-10); - calc.unOp(Ops.CHANGE_SIGN); - assertEquals(-5.0345753587649823E-45, calc.getValue(), 1e-10); - calc.digit(2); - assertEquals(2.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.digit(7); - assertEquals(7.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(7.0, calc.getValue(), 1e-10); - calc.digit(8); - assertEquals(8.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.binOp(Ops.MULT); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.binOp(Ops.PLUS); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.binOp(Ops.PLUS); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.eval(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.digit(3); - assertEquals(0.3, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.digit(5); - assertEquals(5.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(5.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(5.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.unOp(Ops.CHANGE_SIGN); - assertEquals(-0.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.binOp(Ops.PLUS); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.binOp(Ops.MINUS); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.unOp(Ops.CHANGE_SIGN); - assertEquals(-0.0, calc.getValue(), 1e-10); - calc.digit(2); - assertEquals(2.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.unOp(Ops.EXP); - assertEquals(1.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(-1.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.unOp(Ops.CHANGE_SIGN); - assertEquals(-0.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.digit(5); - assertEquals(5.0, calc.getValue(), 1e-10); - calc.unOp(Ops.CHANGE_SIGN); - assertEquals(-5.0, calc.getValue(), 1e-10); - calc.unOp(Ops.CHANGE_SIGN); - assertEquals(5.0, calc.getValue(), 1e-10); - calc.binOp(Ops.DIV); - assertEquals(5.0, calc.getValue(), 1e-10); - calc.unOp(Ops.EXP); - assertEquals(148.4131591025766, calc.getValue(), 1e-10); - calc.binOp(Ops.MULT); - assertEquals(0.03368973499542734, calc.getValue(), 1e-10); - calc.binOp(Ops.PLUS); - assertEquals(0.03368973499542734, calc.getValue(), 1e-10); - calc.unOp(Ops.SQRT); - assertEquals(0.1835476368560144, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.eval(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.binOp(Ops.MINUS); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.binOp(Ops.MULT); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.binOp(Ops.PLUS); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.binOp(Ops.PLUS); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test1() { - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.binOp(Ops.MULT); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.digit(6); - assertEquals(0.6, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.eval(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.digit(3); - assertEquals(3.0, calc.getValue(), 1e-10); - calc.binOp(Ops.MINUS); - assertEquals(3.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.digit(7); - assertEquals(7.0, calc.getValue(), 1e-10); - calc.unOp(Ops.EXP); - assertEquals(1096.6331584284585, calc.getValue(), 1e-10); - calc.binOp(Ops.MULT); - assertEquals(-1093.6331584284585, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(1196033.485214206, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.unOp(Ops.CHANGE_SIGN); - assertEquals(-0.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test2() { - calc.eval(); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test3() { - calc.eval(); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.unOp(Ops.EXP); - assertEquals(1.73927494152050099E18, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(1.73927494152050099E18, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.digit(7); - assertEquals(7.0, calc.getValue(), 1e-10); - } - - @Test - public void test4() { - calc.eval(); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(42.0, calc.getValue(), 1e-10); - } - - @Test - public void test5() { - calc.binOp(Ops.MINUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.binOp(Ops.MINUS); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.digit(9); - assertEquals(9.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(9.0, calc.getValue(), 1e-10); - calc.unOp(Ops.CHANGE_SIGN); - assertEquals(-9.0, calc.getValue(), 1e-10); - calc.binOp(Ops.MINUS); - assertEquals(51.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(51.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(51.0, calc.getValue(), 1e-10); - } - - @Test - public void test6() { - calc.binOp(Ops.MULT); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.eval(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.digit(9); - assertEquals(9.0, calc.getValue(), 1e-10); - } - - @Test - public void test7() { - calc.binOp(Ops.MINUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test8() { - calc.binOp(Ops.PLUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(4); - assertEquals(4.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.binOp(Ops.MULT); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.unOp(Ops.SQRT); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.unOp(Ops.EXP); - assertEquals(1.0, calc.getValue(), 1e-10); - } - - @Test - public void test9() { - calc.binOp(Ops.DIV); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(1.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test10() { - calc.binOp(Ops.MINUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(7); - assertEquals(7.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(35.0, calc.getValue(), 1e-10); - calc.digit(4); - assertEquals(4.0, calc.getValue(), 1e-10); - } - - @Test - public void test11() { - calc.binOp(Ops.MULT); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.digit(4); - assertEquals(4.0, calc.getValue(), 1e-10); - } - - @Test - public void test12() { - calc.binOp(Ops.MULT); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(9); - assertEquals(9.0, calc.getValue(), 1e-10); - calc.digit(3); - assertEquals(93.0, calc.getValue(), 1e-10); - calc.unOp(Ops.EXP); - assertEquals(2.451245542920086E40, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test13() { - calc.binOp(Ops.PLUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.eval(); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test14() { - calc.binOp(Ops.DIV); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(1.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(1.0, calc.getValue(), 1e-10); - } - - @Test - public void test15() { - calc.binOp(Ops.DIV); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(5); - assertEquals(5.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.eval(); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test16() { - calc.binOp(Ops.PLUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.unOp(Ops.CHANGE_SIGN); - assertEquals(-42.0, calc.getValue(), 1e-10); - calc.unOp(Ops.CHANGE_SIGN); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(84.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(84.0, calc.getValue(), 1e-10); - } - - @Test - public void test17() { - calc.binOp(Ops.MULT); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(1764.0, calc.getValue(), 1e-10); - calc.binOp(Ops.MINUS); - assertEquals(1764.0, calc.getValue(), 1e-10); - } - - @Test - public void test18() { - calc.binOp(Ops.PLUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.unOp(Ops.CHANGE_SIGN); - assertEquals(-42.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test19() { - calc.binOp(Ops.PLUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test20() { - calc.digit(9); - assertEquals(9.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.unOp(Ops.EXP); - assertEquals(1.0, calc.getValue(), 1e-10); - } - - @Test - public void test21() { - calc.digit(3); - assertEquals(3.0, calc.getValue(), 1e-10); - calc.unOp(Ops.EXP); - assertEquals(20.085536923187668, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test22() { - calc.digit(1); - assertEquals(1.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test23() { - calc.digit(6); - assertEquals(6.0, calc.getValue(), 1e-10); - calc.unOp(Ops.CHANGE_SIGN); - assertEquals(-6.0, calc.getValue(), 1e-10); - calc.binOp(Ops.MULT); - assertEquals(-6.0, calc.getValue(), 1e-10); - } - - @Test - public void test24() { - calc.digit(9); - assertEquals(9.0, calc.getValue(), 1e-10); - calc.binOp(Ops.MULT); - assertEquals(9.0, calc.getValue(), 1e-10); - calc.digit(3); - assertEquals(3.0, calc.getValue(), 1e-10); - } - - @Test - public void test25() { - calc.digit(3); - assertEquals(3.0, calc.getValue(), 1e-10); - calc.binOp(Ops.PLUS); - assertEquals(3.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(6.0, calc.getValue(), 1e-10); - } - - @Test - public void test26() { - calc.digit(4); - assertEquals(4.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(4.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test27() { - calc.digit(7); - assertEquals(7.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(7.0, calc.getValue(), 1e-10); - calc.binOp(Ops.MULT); - assertEquals(7.0, calc.getValue(), 1e-10); - calc.binOp(Ops.MINUS); - assertEquals(7.0, calc.getValue(), 1e-10); - } - - @Test - public void test28() { - calc.digit(4); - assertEquals(4.0, calc.getValue(), 1e-10); - calc.unOp(Ops.SQRT); - assertEquals(2.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(2.0, calc.getValue(), 1e-10); - } - - @Test - public void test29() { - calc.digit(4); - assertEquals(4.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test30() { - calc.digit(8); - assertEquals(8.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.binOp(Ops.MULT); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test31() { - calc.digit(1); - assertEquals(1.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test32() { - calc.digit(3); - assertEquals(3.0, calc.getValue(), 1e-10); - calc.binOp(Ops.DIV); - assertEquals(3.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test33() { - calc.digit(9); - assertEquals(9.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(9.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test34() { - calc.digit(6); - assertEquals(6.0, calc.getValue(), 1e-10); - calc.digit(9); - assertEquals(69.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(69.0, calc.getValue(), 1e-10); - calc.unOp(Ops.CHANGE_SIGN); - assertEquals(-69.0, calc.getValue(), 1e-10); - } - - @Test - public void test35() { - calc.digit(6); - assertEquals(6.0, calc.getValue(), 1e-10); - calc.binOp(Ops.MULT); - assertEquals(6.0, calc.getValue(), 1e-10); - calc.binOp(Ops.MINUS); - assertEquals(6.0, calc.getValue(), 1e-10); - } - - @Test - public void test36() { - calc.digit(9); - assertEquals(9.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test37() { - calc.digit(2); - assertEquals(2.0, calc.getValue(), 1e-10); - calc.binOp(Ops.MULT); - assertEquals(2.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test38() { - calc.digit(2); - assertEquals(2.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(2.0, calc.getValue(), 1e-10); - calc.digit(3); - assertEquals(2.3, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(2.3, calc.getValue(), 1e-10); - calc.binOp(Ops.DIV); - assertEquals(2.3, calc.getValue(), 1e-10); - } - - @Test - public void test39() { - calc.digit(4); - assertEquals(4.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test40() { - calc.digit(9); - assertEquals(9.0, calc.getValue(), 1e-10); - calc.unOp(Ops.SQRT); - assertEquals(3.0, calc.getValue(), 1e-10); - calc.digit(3); - assertEquals(3.0, calc.getValue(), 1e-10); - } - - @Test - public void test41() { - calc.digit(8); - assertEquals(8.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.unOp(Ops.CHANGE_SIGN); - assertEquals(-0.0, calc.getValue(), 1e-10); - } - - @Test - public void test42() { - calc.digit(3); - assertEquals(3.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(3.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(3.0, calc.getValue(), 1e-10); - } - - @Test - public void test43() { - calc.digit(8); - assertEquals(8.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(8.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test44() { - calc.digit(7); - assertEquals(7.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(7.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test45() { - calc.digit(5); - assertEquals(5.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(5.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.unOp(Ops.EXP); - assertEquals(1.0, calc.getValue(), 1e-10); - } - - @Test - public void test46() { - calc.digit(1); - assertEquals(1.0, calc.getValue(), 1e-10); - calc.digit(2); - assertEquals(12.0, calc.getValue(), 1e-10); - calc.binOp(Ops.MINUS); - assertEquals(12.0, calc.getValue(), 1e-10); - calc.unOp(Ops.SQRT); - assertEquals(3.4641016151377544, calc.getValue(), 1e-10); - } - - @Test - public void test47() { - calc.digit(6); - assertEquals(6.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.eval(); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test48() { - calc.digit(1); - assertEquals(1.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(1.0, calc.getValue(), 1e-10); - calc.binOp(Ops.DIV); - assertEquals(1.0, calc.getValue(), 1e-10); - } - - @Test - public void test49() { - calc.digit(9); - assertEquals(9.0, calc.getValue(), 1e-10); - calc.unOp(Ops.EXP); - assertEquals(8103.083927575384, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test50() { - calc.digit(7); - assertEquals(7.0, calc.getValue(), 1e-10); - calc.digit(8); - assertEquals(78.0, calc.getValue(), 1e-10); - calc.unOp(Ops.SQRT); - assertEquals(8.831760866327848, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test51() { - calc.digit(4); - assertEquals(4.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.binOp(Ops.MULT); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test52() { - calc.digit(7); - assertEquals(7.0, calc.getValue(), 1e-10); - calc.digit(2); - assertEquals(72.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.digit(3); - assertEquals(3.0, calc.getValue(), 1e-10); - } - - @Test - public void test53() { - calc.digit(6); - assertEquals(6.0, calc.getValue(), 1e-10); - calc.digit(4); - assertEquals(64.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.eval(); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test54() { - calc.digit(4); - assertEquals(4.0, calc.getValue(), 1e-10); - calc.digit(2); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(1); - assertEquals(421.0, calc.getValue(), 1e-10); - } - - @Test - public void test62() { - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.binOp(Ops.PLUS); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test63() { - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test64() { - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.unOp(Ops.EXP); - assertEquals(1.0, calc.getValue(), 1e-10); - } - - @Test - public void test65() { - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test66() { - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.unOp(Ops.CHANGE_SIGN); - assertEquals(-0.0, calc.getValue(), 1e-10); - calc.unOp(Ops.SQRT); - assertEquals(-0.0, calc.getValue(), 1e-10); - } - - @Test - public void test67() { - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.binOp(Ops.MINUS); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.unOp(Ops.EXP); - assertEquals(1.0, calc.getValue(), 1e-10); - } - - @Test - public void test68() { - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.binOp(Ops.MINUS); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.digit(7); - assertEquals(7.0, calc.getValue(), 1e-10); - } - - @Test - public void test69() { - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.digit(1); - assertEquals(1.0, calc.getValue(), 1e-10); - } - - @Test - public void test70() { - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test71() { - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.digit(3); - assertEquals(0.3, calc.getValue(), 1e-10); - calc.digit(3); - assertEquals(0.33, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.unOp(Ops.SQRT); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test72() { - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.unOp(Ops.SQRT); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test73() { - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.binOp(Ops.PLUS); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test74() { - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.unOp(Ops.EXP); - assertEquals(1.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(1.0, calc.getValue(), 1e-10); - } - - @Test - public void test75() { - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.digit(7); - assertEquals(0.7, calc.getValue(), 1e-10); - calc.binOp(Ops.MULT); - assertEquals(0.7, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test76() { - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.unOp(Ops.CHANGE_SIGN); - assertEquals(-0.0, calc.getValue(), 1e-10); - calc.digit(3); - assertEquals(3.0, calc.getValue(), 1e-10); - } - - @Test - public void test77() { - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test78() { - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.digit(9); - assertEquals(0.9, calc.getValue(), 1e-10); - calc.unOp(Ops.EXP); - assertEquals(2.45960311115695, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test79() { - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.binOp(Ops.MINUS); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test80() { - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test81() { - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test82() { - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test83() { - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test84() { - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.eval(); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test85() { - calc.binOp(Ops.MINUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.unOp(Ops.SQRT); - assertEquals(6.48074069840786, calc.getValue(), 1e-10); - calc.digit(4); - assertEquals(4.0, calc.getValue(), 1e-10); - calc.unOp(Ops.CHANGE_SIGN); - assertEquals(-4.0, calc.getValue(), 1e-10); - calc.unOp(Ops.EXP); - assertEquals(0.01831563888873418, calc.getValue(), 1e-10); - calc.digit(4); - assertEquals(4.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(4.0, calc.getValue(), 1e-10); - calc.digit(7); - assertEquals(4.7, calc.getValue(), 1e-10); - calc.unOp(Ops.EXP); - assertEquals(109.94717245212352, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.eval(); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test86() { - calc.binOp(Ops.DIV); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.unOp(Ops.SQRT); - assertEquals(6.48074069840786, calc.getValue(), 1e-10); - calc.unOp(Ops.EXP); - assertEquals(652.4540390039687, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.binOp(Ops.PLUS); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test87() { - calc.binOp(Ops.MULT); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.unOp(Ops.SQRT); - assertEquals(6.48074069840786, calc.getValue(), 1e-10); - calc.unOp(Ops.SQRT); - assertEquals(2.5457298950218306, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test88() { - calc.binOp(Ops.MINUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.unOp(Ops.SQRT); - assertEquals(6.48074069840786, calc.getValue(), 1e-10); - calc.unOp(Ops.SQRT); - assertEquals(2.5457298950218306, calc.getValue(), 1e-10); - calc.unOp(Ops.EXP); - assertEquals(12.752532700090239, calc.getValue(), 1e-10); - calc.binOp(Ops.PLUS); - assertEquals(29.24746729990976, calc.getValue(), 1e-10); - calc.digit(1); - assertEquals(1.0, calc.getValue(), 1e-10); - } - - @Test - public void test89() { - calc.binOp(Ops.DIV); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.unOp(Ops.SQRT); - assertEquals(6.48074069840786, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.unOp(Ops.SQRT); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test90() { - calc.binOp(Ops.MINUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.unOp(Ops.SQRT); - assertEquals(6.48074069840786, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(35.51925930159214, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test91() { - calc.binOp(Ops.DIV); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.unOp(Ops.SQRT); - assertEquals(6.48074069840786, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test92() { - calc.binOp(Ops.PLUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.unOp(Ops.SQRT); - assertEquals(6.48074069840786, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.digit(3); - assertEquals(0.3, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.eval(); - assertEquals(42.0, calc.getValue(), 1e-10); - } - - @Test - public void test93() { - calc.binOp(Ops.PLUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.unOp(Ops.EXP); - assertEquals(1.73927494152050099E18, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(1.73927494152050099E18, calc.getValue(), 1e-10); - calc.unOp(Ops.CHANGE_SIGN); - assertEquals(-1.73927494152050099E18, calc.getValue(), 1e-10); - } - - @Test - public void test94() { - calc.binOp(Ops.DIV); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.unOp(Ops.SQRT); - assertEquals(6.48074069840786, calc.getValue(), 1e-10); - calc.unOp(Ops.SQRT); - assertEquals(2.5457298950218306, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.eval(); - assertTrue(Double.isNaN(calc.getValue())); - calc.digit(6); - assertTrue(Double.isNaN(calc.getValue())); - } - - @Test - public void test95() { - calc.binOp(Ops.MULT); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.unOp(Ops.CHANGE_SIGN); - assertEquals(-42.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.digit(2); - assertEquals(2.0, calc.getValue(), 1e-10); - } - - @Test - public void test96() { - calc.binOp(Ops.MINUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.unOp(Ops.CHANGE_SIGN); - assertEquals(-42.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.binOp(Ops.PLUS); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test97() { - calc.binOp(Ops.MULT); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.unOp(Ops.CHANGE_SIGN); - assertEquals(-42.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(-1764.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test98() { - calc.binOp(Ops.PLUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.unOp(Ops.SQRT); - assertEquals(6.48074069840786, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.digit(8); - assertEquals(8.0, calc.getValue(), 1e-10); - } - - @Test - public void test99() { - calc.binOp(Ops.DIV); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.unOp(Ops.EXP); - assertEquals(1.73927494152050099E18, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(2.4147993510032952E-17, calc.getValue(), 1e-10); - calc.binOp(Ops.MULT); - assertEquals(2.4147993510032952E-17, calc.getValue(), 1e-10); - } - - @Test - public void test100() { - calc.binOp(Ops.MULT); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.unOp(Ops.CHANGE_SIGN); - assertEquals(-42.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test101() { - calc.binOp(Ops.PLUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.unOp(Ops.SQRT); - assertEquals(6.48074069840786, calc.getValue(), 1e-10); - calc.binOp(Ops.PLUS); - assertEquals(48.48074069840786, calc.getValue(), 1e-10); - calc.unOp(Ops.EXP); - assertEquals(1.1347969605334383E21, calc.getValue(), 1e-10); - } - - @Test - public void test102() { - calc.binOp(Ops.PLUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.unOp(Ops.CHANGE_SIGN); - assertEquals(-42.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.unOp(Ops.SQRT); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test103() { - calc.binOp(Ops.MINUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.unOp(Ops.CHANGE_SIGN); - assertEquals(-42.0, calc.getValue(), 1e-10); - calc.digit(5); - assertEquals(5.0, calc.getValue(), 1e-10); - calc.digit(1); - assertEquals(51.0, calc.getValue(), 1e-10); - calc.digit(5); - assertEquals(515.0, calc.getValue(), 1e-10); - calc.binOp(Ops.MULT); - assertEquals(-473.0, calc.getValue(), 1e-10); - calc.binOp(Ops.MULT); - assertEquals(-473.0, calc.getValue(), 1e-10); - } - - @Test - public void test104() { - calc.binOp(Ops.MULT); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.unOp(Ops.SQRT); - assertEquals(6.48074069840786, calc.getValue(), 1e-10); - calc.binOp(Ops.MULT); - assertEquals(272.19110933313016, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test105() { - calc.binOp(Ops.MULT); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.unOp(Ops.SQRT); - assertEquals(6.48074069840786, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test106() { - calc.binOp(Ops.MINUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.unOp(Ops.CHANGE_SIGN); - assertEquals(-42.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(84.0, calc.getValue(), 1e-10); - calc.digit(3); - assertEquals(3.0, calc.getValue(), 1e-10); - } - - @Test - public void test107() { - calc.binOp(Ops.MULT); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.unOp(Ops.EXP); - assertEquals(1.73927494152050099E18, calc.getValue(), 1e-10); - calc.binOp(Ops.MINUS); - assertEquals(7.304954754386104E19, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test108() { - calc.binOp(Ops.MULT); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.unOp(Ops.CHANGE_SIGN); - assertEquals(-42.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.eval(); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test109() { - calc.binOp(Ops.DIV); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.unOp(Ops.CHANGE_SIGN); - assertEquals(-42.0, calc.getValue(), 1e-10); - calc.digit(2); - assertEquals(2.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test110() { - calc.binOp(Ops.MULT); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.unOp(Ops.SQRT); - assertEquals(6.48074069840786, calc.getValue(), 1e-10); - calc.digit(4); - assertEquals(4.0, calc.getValue(), 1e-10); - calc.binOp(Ops.DIV); - assertEquals(168.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test111() { - calc.binOp(Ops.DIV); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.unOp(Ops.CHANGE_SIGN); - assertEquals(-42.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.unOp(Ops.EXP); - assertEquals(1.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(42.0, calc.getValue(), 1e-10); - } - - @Test - public void test112() { - calc.binOp(Ops.PLUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.unOp(Ops.EXP); - assertEquals(1.73927494152050099E18, calc.getValue(), 1e-10); - calc.digit(2); - assertEquals(2.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(44.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test113() { - calc.binOp(Ops.PLUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(7); - assertEquals(7.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test114() { - calc.binOp(Ops.MINUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(9); - assertEquals(9.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.binOp(Ops.MINUS); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test115() { - calc.binOp(Ops.MULT); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(6); - assertEquals(6.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(6.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(252.0, calc.getValue(), 1e-10); - calc.unOp(Ops.EXP); - assertEquals(2.7682763318657856E109, calc.getValue(), 1e-10); - } - - @Test - public void test116() { - calc.binOp(Ops.MINUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(4); - assertEquals(4.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(4.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.unOp(Ops.EXP); - assertEquals(1.0, calc.getValue(), 1e-10); - } - - @Test - public void test117() { - calc.binOp(Ops.DIV); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(3); - assertEquals(3.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(3.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test118() { - calc.binOp(Ops.DIV); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(4); - assertEquals(4.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test119() { - calc.binOp(Ops.MULT); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(6); - assertEquals(6.0, calc.getValue(), 1e-10); - calc.binOp(Ops.MULT); - assertEquals(252.0, calc.getValue(), 1e-10); - calc.digit(2); - assertEquals(2.0, calc.getValue(), 1e-10); - } - - @Test - public void test120() { - calc.binOp(Ops.MULT); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(4); - assertEquals(4.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test121() { - calc.binOp(Ops.PLUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(1); - assertEquals(1.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(43.0, calc.getValue(), 1e-10); - calc.binOp(Ops.MULT); - assertEquals(43.0, calc.getValue(), 1e-10); - } - - @Test - public void test122() { - calc.binOp(Ops.PLUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(6); - assertEquals(6.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test123() { - calc.binOp(Ops.PLUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(3); - assertEquals(3.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.unOp(Ops.EXP); - assertEquals(1.0, calc.getValue(), 1e-10); - } - - @Test - public void test124() { - calc.binOp(Ops.MINUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(6); - assertEquals(6.0, calc.getValue(), 1e-10); - calc.binOp(Ops.MINUS); - assertEquals(36.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test125() { - calc.binOp(Ops.DIV); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(7); - assertEquals(7.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(6.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test126() { - calc.binOp(Ops.PLUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(7); - assertEquals(7.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test127() { - calc.binOp(Ops.MINUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(1); - assertEquals(1.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(41.0, calc.getValue(), 1e-10); - calc.unOp(Ops.SQRT); - assertEquals(6.4031242374328485, calc.getValue(), 1e-10); - } - - @Test - public void test128() { - calc.binOp(Ops.MINUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(5); - assertEquals(5.0, calc.getValue(), 1e-10); - calc.digit(4); - assertEquals(54.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.digit(4); - assertEquals(4.0, calc.getValue(), 1e-10); - } - - @Test - public void test129() { - calc.binOp(Ops.MULT); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(3); - assertEquals(3.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(3.0, calc.getValue(), 1e-10); - calc.binOp(Ops.MULT); - assertEquals(126.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test130() { - calc.binOp(Ops.PLUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(8); - assertEquals(8.0, calc.getValue(), 1e-10); - calc.unOp(Ops.SQRT); - assertEquals(2.8284271247461903, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(44.82842712474619, calc.getValue(), 1e-10); - } - - @Test - public void test131() { - calc.binOp(Ops.MINUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(9); - assertEquals(9.0, calc.getValue(), 1e-10); - calc.binOp(Ops.DIV); - assertEquals(33.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(1.0, calc.getValue(), 1e-10); - } - - @Test - public void test132() { - calc.binOp(Ops.PLUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(6); - assertEquals(6.0, calc.getValue(), 1e-10); - calc.unOp(Ops.CHANGE_SIGN); - assertEquals(-6.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test133() { - calc.binOp(Ops.MULT); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(8); - assertEquals(8.0, calc.getValue(), 1e-10); - calc.unOp(Ops.EXP); - assertEquals(2980.9579870417283, calc.getValue(), 1e-10); - calc.digit(1); - assertEquals(1.0, calc.getValue(), 1e-10); - } - - @Test - public void test134() { - calc.binOp(Ops.DIV); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(7); - assertEquals(7.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.eval(); - assertTrue(Double.isNaN(calc.getValue())); - } - - @Test - public void test135() { - calc.binOp(Ops.MULT); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(1); - assertEquals(1.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(42.0, calc.getValue(), 1e-10); - } - - @Test - public void test136() { - calc.binOp(Ops.PLUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(7); - assertEquals(7.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.digit(4); - assertEquals(4.0, calc.getValue(), 1e-10); - } - - @Test - public void test137() { - calc.binOp(Ops.MULT); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(2); - assertEquals(2.0, calc.getValue(), 1e-10); - calc.digit(7); - assertEquals(27.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(27.0, calc.getValue(), 1e-10); - } - - @Test - public void test138() { - calc.binOp(Ops.PLUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(3); - assertEquals(3.0, calc.getValue(), 1e-10); - calc.digit(1); - assertEquals(31.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(73.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test139() { - calc.binOp(Ops.PLUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(1); - assertEquals(1.0, calc.getValue(), 1e-10); - calc.binOp(Ops.MINUS); - assertEquals(43.0, calc.getValue(), 1e-10); - calc.unOp(Ops.CHANGE_SIGN); - assertEquals(-43.0, calc.getValue(), 1e-10); - } - - @Test - public void test140() { - calc.binOp(Ops.MULT); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(3); - assertEquals(3.0, calc.getValue(), 1e-10); - calc.unOp(Ops.EXP); - assertEquals(20.085536923187668, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test141() { - calc.binOp(Ops.MINUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(7); - assertEquals(7.0, calc.getValue(), 1e-10); - calc.digit(5); - assertEquals(75.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test142() { - calc.binOp(Ops.MULT); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.binOp(Ops.PLUS); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.digit(3); - assertEquals(3.0, calc.getValue(), 1e-10); - } - - @Test - public void test143() { - calc.binOp(Ops.MULT); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.binOp(Ops.PLUS); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test144() { - calc.binOp(Ops.MINUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.binOp(Ops.MINUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test145() { - calc.binOp(Ops.MINUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test146() { - calc.binOp(Ops.MULT); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.binOp(Ops.MULT); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test147() { - calc.binOp(Ops.DIV); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.eval(); - assertTrue(Double.isNaN(calc.getValue())); - calc.binOp(Ops.MINUS); - assertTrue(Double.isNaN(calc.getValue())); - } - - @Test - public void test148() { - calc.binOp(Ops.PLUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.binOp(Ops.MULT); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test149() { - calc.binOp(Ops.MULT); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test150() { - calc.binOp(Ops.MINUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.digit(6); - assertEquals(0.6, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.eval(); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test151() { - calc.binOp(Ops.PLUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test152() { - calc.binOp(Ops.DIV); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.unOp(Ops.EXP); - assertEquals(1.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test153() { - calc.binOp(Ops.MULT); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.digit(7); - assertEquals(7.0, calc.getValue(), 1e-10); - } - - @Test - public void test154() { - calc.binOp(Ops.MINUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.unOp(Ops.EXP); - assertEquals(1.0, calc.getValue(), 1e-10); - calc.unOp(Ops.CHANGE_SIGN); - assertEquals(-1.0, calc.getValue(), 1e-10); - } - - @Test - public void test155() { - calc.binOp(Ops.MINUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.digit(4); - assertEquals(0.4, calc.getValue(), 1e-10); - calc.binOp(Ops.MINUS); - assertEquals(41.6, calc.getValue(), 1e-10); - } - - @Test - public void test156() { - calc.binOp(Ops.PLUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.unOp(Ops.SQRT); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.digit(7); - assertEquals(7.0, calc.getValue(), 1e-10); - } - - @Test - public void test157() { - calc.binOp(Ops.MULT); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test158() { - calc.binOp(Ops.DIV); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.digit(6); - assertEquals(6.0, calc.getValue(), 1e-10); - } - - @Test - public void test159() { - calc.binOp(Ops.MINUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.unOp(Ops.CHANGE_SIGN); - assertEquals(-0.0, calc.getValue(), 1e-10); - } - - @Test - public void test160() { - calc.binOp(Ops.MULT); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.digit(9); - assertEquals(0.9, calc.getValue(), 1e-10); - calc.digit(7); - assertEquals(0.97, calc.getValue(), 1e-10); - } -} diff --git a/src/test/oop/ch09/calc/test/AdHocCalculatorEdgeTest.java b/src/test/oop/ch09/calc/test/AdHocCalculatorEdgeTest.java deleted file mode 100644 index 3d7efc8..0000000 --- a/src/test/oop/ch09/calc/test/AdHocCalculatorEdgeTest.java +++ /dev/null @@ -1,280 +0,0 @@ -package oop.ch09.calc.test; - -import oop.ch06.calc.AdHocCalculator; -import oop.ch06.calc.Ops; -import org.junit.Before; -import org.junit.Test; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -public class AdHocCalculatorEdgeTest { - private AdHocCalculator calc; - - @Before - public void setup() { - calc = new AdHocCalculator(); - calc.digit(6); - calc.binOp(Ops.MULT); - calc.digit(7); - calc.eval(); - } - - @Test - public void test0() { - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.digit(6); - assertEquals(6.0, calc.getValue(), 1e-10); - calc.digit(2); - assertEquals(62.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(62.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.unOp(Ops.EXP); - assertEquals(1.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.binOp(Ops.MINUS); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test1() { - calc.binOp(Ops.DIV); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.unOp(Ops.SQRT); - assertEquals(6.48074069840786, calc.getValue(), 1e-10); - calc.unOp(Ops.SQRT); - assertEquals(2.5457298950218306, calc.getValue(), 1e-10); - calc.digit(8); - assertEquals(8.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(5.25, calc.getValue(), 1e-10); - } - - @Test - public void test2() { - calc.binOp(Ops.PLUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.binOp(Ops.DIV); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test3() { - calc.binOp(Ops.MULT); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test4() { - calc.binOp(Ops.PLUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.digit(5); - assertEquals(5.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test5() { - calc.digit(6); - assertEquals(6.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test6() { - calc.digit(3); - assertEquals(3.0, calc.getValue(), 1e-10); - calc.binOp(Ops.DIV); - assertEquals(3.0, calc.getValue(), 1e-10); - } - - @Test - public void test7() { - calc.digit(7); - assertEquals(7.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test8() { - calc.digit(9); - assertEquals(9.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(9.0, calc.getValue(), 1e-10); - } - - @Test - public void test9() { - calc.digit(5); - assertEquals(5.0, calc.getValue(), 1e-10); - calc.unOp(Ops.CHANGE_SIGN); - assertEquals(-5.0, calc.getValue(), 1e-10); - } - - @Test - public void test11() { - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.binOp(Ops.PLUS); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test12() { - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.digit(2); - assertEquals(0.2, calc.getValue(), 1e-10); - calc.unOp(Ops.EXP); - assertEquals(1.2214027581601699, calc.getValue(), 1e-10); - } - - @Test - public void test13() { - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test14() { - calc.binOp(Ops.DIV); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.unOp(Ops.SQRT); - assertEquals(6.48074069840786, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test15() { - calc.binOp(Ops.MINUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.unOp(Ops.EXP); - assertEquals(1.73927494152050099E18, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(-1.73927494152050099E18, calc.getValue(), 1e-10); - } - - @Test - public void test16() { - calc.binOp(Ops.MINUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.unOp(Ops.EXP); - assertEquals(1.73927494152050099E18, calc.getValue(), 1e-10); - calc.binOp(Ops.MINUS); - assertEquals(-1.73927494152050099E18, calc.getValue(), 1e-10); - } - - @Test - public void test17() { - calc.binOp(Ops.DIV); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.unOp(Ops.EXP); - assertEquals(1.73927494152050099E18, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test18() { - calc.binOp(Ops.DIV); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.unOp(Ops.SQRT); - assertEquals(6.48074069840786, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.binOp(Ops.PLUS); - assertTrue(Double.isNaN(calc.getValue())); - } - - @Test - public void test19() { - calc.binOp(Ops.DIV); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(2); - assertEquals(2.0, calc.getValue(), 1e-10); - calc.digit(5); - assertEquals(25.0, calc.getValue(), 1e-10); - calc.unOp(Ops.CHANGE_SIGN); - assertEquals(-25.0, calc.getValue(), 1e-10); - } - - @Test - public void test20() { - calc.binOp(Ops.PLUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(9); - assertEquals(9.0, calc.getValue(), 1e-10); - calc.binOp(Ops.PLUS); - assertEquals(51.0, calc.getValue(), 1e-10); - } - - @Test - public void test21() { - calc.binOp(Ops.MULT); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(7); - assertEquals(7.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(7.0, calc.getValue(), 1e-10); - calc.unOp(Ops.SQRT); - assertEquals(2.6457513110645907, calc.getValue(), 1e-10); - } - - @Test - public void test22() { - calc.binOp(Ops.PLUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(3); - assertEquals(3.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test23() { - calc.binOp(Ops.MULT); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.digit(3); - assertEquals(0.3, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test24() { - calc.binOp(Ops.PLUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(42.0, calc.getValue(), 1e-10); - } -} diff --git a/src/test/oop/ch09/calc/test/CalculatorEdgePairTest.java b/src/test/oop/ch09/calc/test/CalculatorEdgePairTest.java deleted file mode 100644 index f3254d6..0000000 --- a/src/test/oop/ch09/calc/test/CalculatorEdgePairTest.java +++ /dev/null @@ -1,2040 +0,0 @@ -package oop.ch09.calc.test; - -import oop.ch06.calc.Ops; -import oop.ch07.calc.Calculator; -import org.junit.Before; -import org.junit.Test; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -public class CalculatorEdgePairTest { - private Calculator calc; - - @Before - public void setup() { - calc = new Calculator(); - calc.digit(6); - calc.binOp(Ops.MULT); - calc.digit(7); - calc.eval(); - } - - @Test - public void test0() { - calc.unOp(Ops.SQRT); - assertEquals(6.48074069840786, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.digit(4); - assertEquals(4.0, calc.getValue(), 1e-10); - calc.digit(5); - assertEquals(45.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(45.0, calc.getValue(), 1e-10); - calc.unOp(Ops.CHANGE_SIGN); - assertEquals(-45.0, calc.getValue(), 1e-10); - calc.binOp(Ops.MINUS); - assertEquals(-45.0, calc.getValue(), 1e-10); - calc.digit(6); - assertEquals(6.0, calc.getValue(), 1e-10); - calc.binOp(Ops.MINUS); - assertEquals(-51.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.unOp(Ops.EXP); - assertEquals(1.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.binOp(Ops.PLUS); - assertEquals(-51.0, calc.getValue(), 1e-10); - calc.binOp(Ops.PLUS); - assertEquals(-51.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(-102.0, calc.getValue(), 1e-10); - calc.unOp(Ops.EXP); - assertEquals(5.0345753587649823E-45, calc.getValue(), 1e-10); - calc.unOp(Ops.CHANGE_SIGN); - assertEquals(-5.0345753587649823E-45, calc.getValue(), 1e-10); - calc.digit(2); - assertEquals(2.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.digit(7); - assertEquals(7.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(7.0, calc.getValue(), 1e-10); - calc.digit(8); - assertEquals(8.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.binOp(Ops.MULT); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.binOp(Ops.PLUS); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.binOp(Ops.PLUS); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.eval(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.digit(3); - assertEquals(0.3, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.digit(5); - assertEquals(5.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(5.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(5.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.unOp(Ops.CHANGE_SIGN); - assertEquals(-0.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.binOp(Ops.PLUS); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.binOp(Ops.MINUS); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.unOp(Ops.CHANGE_SIGN); - assertEquals(-0.0, calc.getValue(), 1e-10); - calc.digit(2); - assertEquals(2.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.unOp(Ops.EXP); - assertEquals(1.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(-1.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.unOp(Ops.CHANGE_SIGN); - assertEquals(-0.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.digit(5); - assertEquals(5.0, calc.getValue(), 1e-10); - calc.unOp(Ops.CHANGE_SIGN); - assertEquals(-5.0, calc.getValue(), 1e-10); - calc.unOp(Ops.CHANGE_SIGN); - assertEquals(5.0, calc.getValue(), 1e-10); - calc.binOp(Ops.DIV); - assertEquals(5.0, calc.getValue(), 1e-10); - calc.unOp(Ops.EXP); - assertEquals(148.4131591025766, calc.getValue(), 1e-10); - calc.binOp(Ops.MULT); - assertEquals(0.03368973499542734, calc.getValue(), 1e-10); - calc.binOp(Ops.PLUS); - assertEquals(0.03368973499542734, calc.getValue(), 1e-10); - calc.unOp(Ops.SQRT); - assertEquals(0.1835476368560144, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.eval(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.binOp(Ops.MINUS); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.binOp(Ops.MULT); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.binOp(Ops.PLUS); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.binOp(Ops.PLUS); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test1() { - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.binOp(Ops.MULT); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.digit(6); - assertEquals(0.6, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.eval(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.digit(3); - assertEquals(3.0, calc.getValue(), 1e-10); - calc.binOp(Ops.MINUS); - assertEquals(3.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.digit(7); - assertEquals(7.0, calc.getValue(), 1e-10); - calc.unOp(Ops.EXP); - assertEquals(1096.6331584284585, calc.getValue(), 1e-10); - calc.binOp(Ops.MULT); - assertEquals(-1093.6331584284585, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(1196033.485214206, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.unOp(Ops.CHANGE_SIGN); - assertEquals(-0.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test2() { - calc.eval(); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test3() { - calc.eval(); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.unOp(Ops.EXP); - assertEquals(1.73927494152050099E18, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(1.73927494152050099E18, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.digit(7); - assertEquals(7.0, calc.getValue(), 1e-10); - } - - @Test - public void test4() { - calc.eval(); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(42.0, calc.getValue(), 1e-10); - } - - @Test - public void test5() { - calc.binOp(Ops.MINUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.binOp(Ops.MINUS); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.digit(9); - assertEquals(9.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(9.0, calc.getValue(), 1e-10); - calc.unOp(Ops.CHANGE_SIGN); - assertEquals(-9.0, calc.getValue(), 1e-10); - calc.binOp(Ops.MINUS); - assertEquals(51.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(51.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(51.0, calc.getValue(), 1e-10); - } - - @Test - public void test6() { - calc.binOp(Ops.MULT); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.eval(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.digit(9); - assertEquals(9.0, calc.getValue(), 1e-10); - } - - @Test - public void test7() { - calc.binOp(Ops.MINUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test8() { - calc.binOp(Ops.PLUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(4); - assertEquals(4.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.binOp(Ops.MULT); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.unOp(Ops.SQRT); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.unOp(Ops.EXP); - assertEquals(1.0, calc.getValue(), 1e-10); - } - - @Test - public void test9() { - calc.binOp(Ops.DIV); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(1.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test10() { - calc.binOp(Ops.MINUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(7); - assertEquals(7.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(35.0, calc.getValue(), 1e-10); - calc.digit(4); - assertEquals(4.0, calc.getValue(), 1e-10); - } - - @Test - public void test11() { - calc.binOp(Ops.MULT); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.digit(4); - assertEquals(4.0, calc.getValue(), 1e-10); - } - - @Test - public void test12() { - calc.binOp(Ops.MULT); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(9); - assertEquals(9.0, calc.getValue(), 1e-10); - calc.digit(3); - assertEquals(93.0, calc.getValue(), 1e-10); - calc.unOp(Ops.EXP); - assertEquals(2.451245542920086E40, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test13() { - calc.binOp(Ops.PLUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.eval(); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test14() { - calc.binOp(Ops.DIV); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(1.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(1.0, calc.getValue(), 1e-10); - } - - @Test - public void test15() { - calc.binOp(Ops.DIV); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(5); - assertEquals(5.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.eval(); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test16() { - calc.binOp(Ops.PLUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.unOp(Ops.CHANGE_SIGN); - assertEquals(-42.0, calc.getValue(), 1e-10); - calc.unOp(Ops.CHANGE_SIGN); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(84.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(84.0, calc.getValue(), 1e-10); - } - - @Test - public void test17() { - calc.binOp(Ops.MULT); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(1764.0, calc.getValue(), 1e-10); - calc.binOp(Ops.MINUS); - assertEquals(1764.0, calc.getValue(), 1e-10); - } - - @Test - public void test18() { - calc.binOp(Ops.PLUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.unOp(Ops.CHANGE_SIGN); - assertEquals(-42.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test19() { - calc.binOp(Ops.PLUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test20() { - calc.digit(9); - assertEquals(9.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.unOp(Ops.EXP); - assertEquals(1.0, calc.getValue(), 1e-10); - } - - @Test - public void test21() { - calc.digit(3); - assertEquals(3.0, calc.getValue(), 1e-10); - calc.unOp(Ops.EXP); - assertEquals(20.085536923187668, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test22() { - calc.digit(1); - assertEquals(1.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test23() { - calc.digit(6); - assertEquals(6.0, calc.getValue(), 1e-10); - calc.unOp(Ops.CHANGE_SIGN); - assertEquals(-6.0, calc.getValue(), 1e-10); - calc.binOp(Ops.MULT); - assertEquals(-6.0, calc.getValue(), 1e-10); - } - - @Test - public void test24() { - calc.digit(9); - assertEquals(9.0, calc.getValue(), 1e-10); - calc.binOp(Ops.MULT); - assertEquals(9.0, calc.getValue(), 1e-10); - calc.digit(3); - assertEquals(3.0, calc.getValue(), 1e-10); - } - - @Test - public void test25() { - calc.digit(3); - assertEquals(3.0, calc.getValue(), 1e-10); - calc.binOp(Ops.PLUS); - assertEquals(3.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(6.0, calc.getValue(), 1e-10); - } - - @Test - public void test26() { - calc.digit(4); - assertEquals(4.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(4.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test27() { - calc.digit(7); - assertEquals(7.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(7.0, calc.getValue(), 1e-10); - calc.binOp(Ops.MULT); - assertEquals(7.0, calc.getValue(), 1e-10); - calc.binOp(Ops.MINUS); - assertEquals(7.0, calc.getValue(), 1e-10); - } - - @Test - public void test28() { - calc.digit(4); - assertEquals(4.0, calc.getValue(), 1e-10); - calc.unOp(Ops.SQRT); - assertEquals(2.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(2.0, calc.getValue(), 1e-10); - } - - @Test - public void test29() { - calc.digit(4); - assertEquals(4.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test30() { - calc.digit(8); - assertEquals(8.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.binOp(Ops.MULT); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test31() { - calc.digit(1); - assertEquals(1.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test32() { - calc.digit(3); - assertEquals(3.0, calc.getValue(), 1e-10); - calc.binOp(Ops.DIV); - assertEquals(3.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test33() { - calc.digit(9); - assertEquals(9.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(9.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test34() { - calc.digit(6); - assertEquals(6.0, calc.getValue(), 1e-10); - calc.digit(9); - assertEquals(69.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(69.0, calc.getValue(), 1e-10); - calc.unOp(Ops.CHANGE_SIGN); - assertEquals(-69.0, calc.getValue(), 1e-10); - } - - @Test - public void test35() { - calc.digit(6); - assertEquals(6.0, calc.getValue(), 1e-10); - calc.binOp(Ops.MULT); - assertEquals(6.0, calc.getValue(), 1e-10); - calc.binOp(Ops.MINUS); - assertEquals(6.0, calc.getValue(), 1e-10); - } - - @Test - public void test36() { - calc.digit(9); - assertEquals(9.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test37() { - calc.digit(2); - assertEquals(2.0, calc.getValue(), 1e-10); - calc.binOp(Ops.MULT); - assertEquals(2.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test38() { - calc.digit(2); - assertEquals(2.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(2.0, calc.getValue(), 1e-10); - calc.digit(3); - assertEquals(2.3, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(2.3, calc.getValue(), 1e-10); - calc.binOp(Ops.DIV); - assertEquals(2.3, calc.getValue(), 1e-10); - } - - @Test - public void test39() { - calc.digit(4); - assertEquals(4.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test40() { - calc.digit(9); - assertEquals(9.0, calc.getValue(), 1e-10); - calc.unOp(Ops.SQRT); - assertEquals(3.0, calc.getValue(), 1e-10); - calc.digit(3); - assertEquals(3.0, calc.getValue(), 1e-10); - } - - @Test - public void test41() { - calc.digit(8); - assertEquals(8.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.unOp(Ops.CHANGE_SIGN); - assertEquals(-0.0, calc.getValue(), 1e-10); - } - - @Test - public void test42() { - calc.digit(3); - assertEquals(3.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(3.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(3.0, calc.getValue(), 1e-10); - } - - @Test - public void test43() { - calc.digit(8); - assertEquals(8.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(8.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test44() { - calc.digit(7); - assertEquals(7.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(7.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test45() { - calc.digit(5); - assertEquals(5.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(5.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.unOp(Ops.EXP); - assertEquals(1.0, calc.getValue(), 1e-10); - } - - @Test - public void test46() { - calc.digit(1); - assertEquals(1.0, calc.getValue(), 1e-10); - calc.digit(2); - assertEquals(12.0, calc.getValue(), 1e-10); - calc.binOp(Ops.MINUS); - assertEquals(12.0, calc.getValue(), 1e-10); - calc.unOp(Ops.SQRT); - assertEquals(3.4641016151377544, calc.getValue(), 1e-10); - } - - @Test - public void test47() { - calc.digit(6); - assertEquals(6.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.eval(); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test48() { - calc.digit(1); - assertEquals(1.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(1.0, calc.getValue(), 1e-10); - calc.binOp(Ops.DIV); - assertEquals(1.0, calc.getValue(), 1e-10); - } - - @Test - public void test49() { - calc.digit(9); - assertEquals(9.0, calc.getValue(), 1e-10); - calc.unOp(Ops.EXP); - assertEquals(8103.083927575384, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test50() { - calc.digit(7); - assertEquals(7.0, calc.getValue(), 1e-10); - calc.digit(8); - assertEquals(78.0, calc.getValue(), 1e-10); - calc.unOp(Ops.SQRT); - assertEquals(8.831760866327848, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test51() { - calc.digit(4); - assertEquals(4.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.binOp(Ops.MULT); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test52() { - calc.digit(7); - assertEquals(7.0, calc.getValue(), 1e-10); - calc.digit(2); - assertEquals(72.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.digit(3); - assertEquals(3.0, calc.getValue(), 1e-10); - } - - @Test - public void test53() { - calc.digit(6); - assertEquals(6.0, calc.getValue(), 1e-10); - calc.digit(4); - assertEquals(64.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.eval(); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test54() { - calc.digit(4); - assertEquals(4.0, calc.getValue(), 1e-10); - calc.digit(2); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(1); - assertEquals(421.0, calc.getValue(), 1e-10); - } - - @Test - public void test62() { - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.binOp(Ops.PLUS); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test63() { - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test64() { - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.unOp(Ops.EXP); - assertEquals(1.0, calc.getValue(), 1e-10); - } - - @Test - public void test65() { - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test66() { - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.unOp(Ops.CHANGE_SIGN); - assertEquals(-0.0, calc.getValue(), 1e-10); - calc.unOp(Ops.SQRT); - assertEquals(-0.0, calc.getValue(), 1e-10); - } - - @Test - public void test67() { - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.binOp(Ops.MINUS); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.unOp(Ops.EXP); - assertEquals(1.0, calc.getValue(), 1e-10); - } - - @Test - public void test68() { - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.binOp(Ops.MINUS); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.digit(7); - assertEquals(7.0, calc.getValue(), 1e-10); - } - - @Test - public void test69() { - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.digit(1); - assertEquals(1.0, calc.getValue(), 1e-10); - } - - @Test - public void test70() { - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test71() { - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.digit(3); - assertEquals(0.3, calc.getValue(), 1e-10); - calc.digit(3); - assertEquals(0.33, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.unOp(Ops.SQRT); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test72() { - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.unOp(Ops.SQRT); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test73() { - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.binOp(Ops.PLUS); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test74() { - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.unOp(Ops.EXP); - assertEquals(1.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(1.0, calc.getValue(), 1e-10); - } - - @Test - public void test75() { - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.digit(7); - assertEquals(0.7, calc.getValue(), 1e-10); - calc.binOp(Ops.MULT); - assertEquals(0.7, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test76() { - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.unOp(Ops.CHANGE_SIGN); - assertEquals(-0.0, calc.getValue(), 1e-10); - calc.digit(3); - assertEquals(3.0, calc.getValue(), 1e-10); - } - - @Test - public void test77() { - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test78() { - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.digit(9); - assertEquals(0.9, calc.getValue(), 1e-10); - calc.unOp(Ops.EXP); - assertEquals(2.45960311115695, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test79() { - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.binOp(Ops.MINUS); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test80() { - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test81() { - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test82() { - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test83() { - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test84() { - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.eval(); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test85() { - calc.binOp(Ops.MINUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.unOp(Ops.SQRT); - assertEquals(6.48074069840786, calc.getValue(), 1e-10); - calc.digit(4); - assertEquals(4.0, calc.getValue(), 1e-10); - calc.unOp(Ops.CHANGE_SIGN); - assertEquals(-4.0, calc.getValue(), 1e-10); - calc.unOp(Ops.EXP); - assertEquals(0.01831563888873418, calc.getValue(), 1e-10); - calc.digit(4); - assertEquals(4.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(4.0, calc.getValue(), 1e-10); - calc.digit(7); - assertEquals(4.7, calc.getValue(), 1e-10); - calc.unOp(Ops.EXP); - assertEquals(109.94717245212352, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.eval(); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test86() { - calc.binOp(Ops.DIV); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.unOp(Ops.SQRT); - assertEquals(6.48074069840786, calc.getValue(), 1e-10); - calc.unOp(Ops.EXP); - assertEquals(652.4540390039687, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.binOp(Ops.PLUS); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test87() { - calc.binOp(Ops.MULT); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.unOp(Ops.SQRT); - assertEquals(6.48074069840786, calc.getValue(), 1e-10); - calc.unOp(Ops.SQRT); - assertEquals(2.5457298950218306, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test88() { - calc.binOp(Ops.MINUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.unOp(Ops.SQRT); - assertEquals(6.48074069840786, calc.getValue(), 1e-10); - calc.unOp(Ops.SQRT); - assertEquals(2.5457298950218306, calc.getValue(), 1e-10); - calc.unOp(Ops.EXP); - assertEquals(12.752532700090239, calc.getValue(), 1e-10); - calc.binOp(Ops.PLUS); - assertEquals(29.24746729990976, calc.getValue(), 1e-10); - calc.digit(1); - assertEquals(1.0, calc.getValue(), 1e-10); - } - - @Test - public void test89() { - calc.binOp(Ops.DIV); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.unOp(Ops.SQRT); - assertEquals(6.48074069840786, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.unOp(Ops.SQRT); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test90() { - calc.binOp(Ops.MINUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.unOp(Ops.SQRT); - assertEquals(6.48074069840786, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(35.51925930159214, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test91() { - calc.binOp(Ops.DIV); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.unOp(Ops.SQRT); - assertEquals(6.48074069840786, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test92() { - calc.binOp(Ops.PLUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.unOp(Ops.SQRT); - assertEquals(6.48074069840786, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.digit(3); - assertEquals(0.3, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.eval(); - assertEquals(42.0, calc.getValue(), 1e-10); - } - - @Test - public void test93() { - calc.binOp(Ops.PLUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.unOp(Ops.EXP); - assertEquals(1.73927494152050099E18, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(1.73927494152050099E18, calc.getValue(), 1e-10); - calc.unOp(Ops.CHANGE_SIGN); - assertEquals(-1.73927494152050099E18, calc.getValue(), 1e-10); - } - - @Test - public void test94() { - calc.binOp(Ops.DIV); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.unOp(Ops.SQRT); - assertEquals(6.48074069840786, calc.getValue(), 1e-10); - calc.unOp(Ops.SQRT); - assertEquals(2.5457298950218306, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.eval(); - assertTrue(Double.isNaN(calc.getValue())); - calc.digit(6); - assertTrue(Double.isNaN(calc.getValue())); - } - - @Test - public void test95() { - calc.binOp(Ops.MULT); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.unOp(Ops.CHANGE_SIGN); - assertEquals(-42.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.digit(2); - assertEquals(2.0, calc.getValue(), 1e-10); - } - - @Test - public void test96() { - calc.binOp(Ops.MINUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.unOp(Ops.CHANGE_SIGN); - assertEquals(-42.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.binOp(Ops.PLUS); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test97() { - calc.binOp(Ops.MULT); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.unOp(Ops.CHANGE_SIGN); - assertEquals(-42.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(-1764.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test98() { - calc.binOp(Ops.PLUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.unOp(Ops.SQRT); - assertEquals(6.48074069840786, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.digit(8); - assertEquals(8.0, calc.getValue(), 1e-10); - } - - @Test - public void test99() { - calc.binOp(Ops.DIV); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.unOp(Ops.EXP); - assertEquals(1.73927494152050099E18, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(2.4147993510032952E-17, calc.getValue(), 1e-10); - calc.binOp(Ops.MULT); - assertEquals(2.4147993510032952E-17, calc.getValue(), 1e-10); - } - - @Test - public void test100() { - calc.binOp(Ops.MULT); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.unOp(Ops.CHANGE_SIGN); - assertEquals(-42.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test101() { - calc.binOp(Ops.PLUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.unOp(Ops.SQRT); - assertEquals(6.48074069840786, calc.getValue(), 1e-10); - calc.binOp(Ops.PLUS); - assertEquals(48.48074069840786, calc.getValue(), 1e-10); - calc.unOp(Ops.EXP); - assertEquals(1.1347969605334383E21, calc.getValue(), 1e-10); - } - - @Test - public void test102() { - calc.binOp(Ops.PLUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.unOp(Ops.CHANGE_SIGN); - assertEquals(-42.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.unOp(Ops.SQRT); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test103() { - calc.binOp(Ops.MINUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.unOp(Ops.CHANGE_SIGN); - assertEquals(-42.0, calc.getValue(), 1e-10); - calc.digit(5); - assertEquals(5.0, calc.getValue(), 1e-10); - calc.digit(1); - assertEquals(51.0, calc.getValue(), 1e-10); - calc.digit(5); - assertEquals(515.0, calc.getValue(), 1e-10); - calc.binOp(Ops.MULT); - assertEquals(-473.0, calc.getValue(), 1e-10); - calc.binOp(Ops.MULT); - assertEquals(-473.0, calc.getValue(), 1e-10); - } - - @Test - public void test104() { - calc.binOp(Ops.MULT); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.unOp(Ops.SQRT); - assertEquals(6.48074069840786, calc.getValue(), 1e-10); - calc.binOp(Ops.MULT); - assertEquals(272.19110933313016, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test105() { - calc.binOp(Ops.MULT); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.unOp(Ops.SQRT); - assertEquals(6.48074069840786, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test106() { - calc.binOp(Ops.MINUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.unOp(Ops.CHANGE_SIGN); - assertEquals(-42.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(84.0, calc.getValue(), 1e-10); - calc.digit(3); - assertEquals(3.0, calc.getValue(), 1e-10); - } - - @Test - public void test107() { - calc.binOp(Ops.MULT); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.unOp(Ops.EXP); - assertEquals(1.73927494152050099E18, calc.getValue(), 1e-10); - calc.binOp(Ops.MINUS); - assertEquals(7.304954754386104E19, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test108() { - calc.binOp(Ops.MULT); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.unOp(Ops.CHANGE_SIGN); - assertEquals(-42.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.eval(); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test109() { - calc.binOp(Ops.DIV); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.unOp(Ops.CHANGE_SIGN); - assertEquals(-42.0, calc.getValue(), 1e-10); - calc.digit(2); - assertEquals(2.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test110() { - calc.binOp(Ops.MULT); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.unOp(Ops.SQRT); - assertEquals(6.48074069840786, calc.getValue(), 1e-10); - calc.digit(4); - assertEquals(4.0, calc.getValue(), 1e-10); - calc.binOp(Ops.DIV); - assertEquals(168.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test111() { - calc.binOp(Ops.DIV); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.unOp(Ops.CHANGE_SIGN); - assertEquals(-42.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.unOp(Ops.EXP); - assertEquals(1.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(42.0, calc.getValue(), 1e-10); - } - - @Test - public void test112() { - calc.binOp(Ops.PLUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.unOp(Ops.EXP); - assertEquals(1.73927494152050099E18, calc.getValue(), 1e-10); - calc.digit(2); - assertEquals(2.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(44.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test113() { - calc.binOp(Ops.PLUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(7); - assertEquals(7.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test114() { - calc.binOp(Ops.MINUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(9); - assertEquals(9.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.binOp(Ops.MINUS); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test115() { - calc.binOp(Ops.MULT); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(6); - assertEquals(6.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(6.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(252.0, calc.getValue(), 1e-10); - calc.unOp(Ops.EXP); - assertEquals(2.7682763318657856E109, calc.getValue(), 1e-10); - } - - @Test - public void test116() { - calc.binOp(Ops.MINUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(4); - assertEquals(4.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(4.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.unOp(Ops.EXP); - assertEquals(1.0, calc.getValue(), 1e-10); - } - - @Test - public void test117() { - calc.binOp(Ops.DIV); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(3); - assertEquals(3.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(3.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test118() { - calc.binOp(Ops.DIV); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(4); - assertEquals(4.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test119() { - calc.binOp(Ops.MULT); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(6); - assertEquals(6.0, calc.getValue(), 1e-10); - calc.binOp(Ops.MULT); - assertEquals(252.0, calc.getValue(), 1e-10); - calc.digit(2); - assertEquals(2.0, calc.getValue(), 1e-10); - } - - @Test - public void test120() { - calc.binOp(Ops.MULT); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(4); - assertEquals(4.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test121() { - calc.binOp(Ops.PLUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(1); - assertEquals(1.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(43.0, calc.getValue(), 1e-10); - calc.binOp(Ops.MULT); - assertEquals(43.0, calc.getValue(), 1e-10); - } - - @Test - public void test122() { - calc.binOp(Ops.PLUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(6); - assertEquals(6.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test123() { - calc.binOp(Ops.PLUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(3); - assertEquals(3.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.unOp(Ops.EXP); - assertEquals(1.0, calc.getValue(), 1e-10); - } - - @Test - public void test124() { - calc.binOp(Ops.MINUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(6); - assertEquals(6.0, calc.getValue(), 1e-10); - calc.binOp(Ops.MINUS); - assertEquals(36.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test125() { - calc.binOp(Ops.DIV); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(7); - assertEquals(7.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(6.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test126() { - calc.binOp(Ops.PLUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(7); - assertEquals(7.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test127() { - calc.binOp(Ops.MINUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(1); - assertEquals(1.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(41.0, calc.getValue(), 1e-10); - calc.unOp(Ops.SQRT); - assertEquals(6.4031242374328485, calc.getValue(), 1e-10); - } - - @Test - public void test128() { - calc.binOp(Ops.MINUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(5); - assertEquals(5.0, calc.getValue(), 1e-10); - calc.digit(4); - assertEquals(54.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.digit(4); - assertEquals(4.0, calc.getValue(), 1e-10); - } - - @Test - public void test129() { - calc.binOp(Ops.MULT); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(3); - assertEquals(3.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(3.0, calc.getValue(), 1e-10); - calc.binOp(Ops.MULT); - assertEquals(126.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test130() { - calc.binOp(Ops.PLUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(8); - assertEquals(8.0, calc.getValue(), 1e-10); - calc.unOp(Ops.SQRT); - assertEquals(2.8284271247461903, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(44.82842712474619, calc.getValue(), 1e-10); - } - - @Test - public void test131() { - calc.binOp(Ops.MINUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(9); - assertEquals(9.0, calc.getValue(), 1e-10); - calc.binOp(Ops.DIV); - assertEquals(33.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(1.0, calc.getValue(), 1e-10); - } - - @Test - public void test132() { - calc.binOp(Ops.PLUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(6); - assertEquals(6.0, calc.getValue(), 1e-10); - calc.unOp(Ops.CHANGE_SIGN); - assertEquals(-6.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test133() { - calc.binOp(Ops.MULT); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(8); - assertEquals(8.0, calc.getValue(), 1e-10); - calc.unOp(Ops.EXP); - assertEquals(2980.9579870417283, calc.getValue(), 1e-10); - calc.digit(1); - assertEquals(1.0, calc.getValue(), 1e-10); - } - - @Test - public void test134() { - calc.binOp(Ops.DIV); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(7); - assertEquals(7.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.eval(); - assertTrue(Double.isNaN(calc.getValue())); - } - - @Test - public void test135() { - calc.binOp(Ops.MULT); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(1); - assertEquals(1.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(42.0, calc.getValue(), 1e-10); - } - - @Test - public void test136() { - calc.binOp(Ops.PLUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(7); - assertEquals(7.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.digit(4); - assertEquals(4.0, calc.getValue(), 1e-10); - } - - @Test - public void test137() { - calc.binOp(Ops.MULT); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(2); - assertEquals(2.0, calc.getValue(), 1e-10); - calc.digit(7); - assertEquals(27.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(27.0, calc.getValue(), 1e-10); - } - - @Test - public void test138() { - calc.binOp(Ops.PLUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(3); - assertEquals(3.0, calc.getValue(), 1e-10); - calc.digit(1); - assertEquals(31.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(73.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test139() { - calc.binOp(Ops.PLUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(1); - assertEquals(1.0, calc.getValue(), 1e-10); - calc.binOp(Ops.MINUS); - assertEquals(43.0, calc.getValue(), 1e-10); - calc.unOp(Ops.CHANGE_SIGN); - assertEquals(-43.0, calc.getValue(), 1e-10); - } - - @Test - public void test140() { - calc.binOp(Ops.MULT); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(3); - assertEquals(3.0, calc.getValue(), 1e-10); - calc.unOp(Ops.EXP); - assertEquals(20.085536923187668, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test141() { - calc.binOp(Ops.MINUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.digit(7); - assertEquals(7.0, calc.getValue(), 1e-10); - calc.digit(5); - assertEquals(75.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test142() { - calc.binOp(Ops.MULT); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.binOp(Ops.PLUS); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.digit(3); - assertEquals(3.0, calc.getValue(), 1e-10); - } - - @Test - public void test143() { - calc.binOp(Ops.MULT); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.binOp(Ops.PLUS); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test144() { - calc.binOp(Ops.MINUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.binOp(Ops.MINUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test145() { - calc.binOp(Ops.MINUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test146() { - calc.binOp(Ops.MULT); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.binOp(Ops.MULT); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test147() { - calc.binOp(Ops.DIV); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.eval(); - assertTrue(Double.isNaN(calc.getValue())); - calc.binOp(Ops.MINUS); - assertTrue(Double.isNaN(calc.getValue())); - } - - @Test - public void test148() { - calc.binOp(Ops.PLUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.binOp(Ops.MULT); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test149() { - calc.binOp(Ops.MULT); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test150() { - calc.binOp(Ops.MINUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.digit(6); - assertEquals(0.6, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.eval(); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test151() { - calc.binOp(Ops.PLUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - } - - @Test - public void test152() { - calc.binOp(Ops.DIV); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.unOp(Ops.EXP); - assertEquals(1.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test153() { - calc.binOp(Ops.MULT); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.clear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.digit(7); - assertEquals(7.0, calc.getValue(), 1e-10); - } - - @Test - public void test154() { - calc.binOp(Ops.MINUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.unOp(Ops.EXP); - assertEquals(1.0, calc.getValue(), 1e-10); - calc.unOp(Ops.CHANGE_SIGN); - assertEquals(-1.0, calc.getValue(), 1e-10); - } - - @Test - public void test155() { - calc.binOp(Ops.MINUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.digit(4); - assertEquals(0.4, calc.getValue(), 1e-10); - calc.binOp(Ops.MINUS); - assertEquals(41.6, calc.getValue(), 1e-10); - } - - @Test - public void test156() { - calc.binOp(Ops.PLUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.unOp(Ops.SQRT); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.digit(7); - assertEquals(7.0, calc.getValue(), 1e-10); - } - - @Test - public void test157() { - calc.binOp(Ops.MULT); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.eval(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - } - - @Test - public void test158() { - calc.binOp(Ops.DIV); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.digit(6); - assertEquals(6.0, calc.getValue(), 1e-10); - } - - @Test - public void test159() { - calc.binOp(Ops.MINUS); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.allClear(); - assertEquals(0.0, calc.getValue(), 1e-20); - calc.unOp(Ops.CHANGE_SIGN); - assertEquals(-0.0, calc.getValue(), 1e-10); - } - - @Test - public void test160() { - calc.binOp(Ops.MULT); - assertEquals(42.0, calc.getValue(), 1e-10); - calc.dot(); - assertEquals(0.0, calc.getValue(), 1e-10); - calc.digit(9); - assertEquals(0.9, calc.getValue(), 1e-10); - calc.digit(7); - assertEquals(0.97, calc.getValue(), 1e-10); - } -} diff --git a/src/test/oop/ch09/testing/ExceptionTest.java b/src/test/oop/ch09/testing/ExceptionTest.java deleted file mode 100644 index 20533be..0000000 --- a/src/test/oop/ch09/testing/ExceptionTest.java +++ /dev/null @@ -1,34 +0,0 @@ -package oop.ch09.testing; - -import org.junit.Test; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -public class ExceptionTest { - @Test - public void testDivZero1() { - int zero = 0; - int result = 4 / zero; - assertTrue(true); - } - - @Test - public void testDivZero2() { - int zero = 0; - try { - int result = 4 / zero; - fail("ArithmeticException kam nicht"); - } - catch (ArithmeticException ex) { - assertEquals("/ by zero", ex.getMessage()); - } - } - - @Test(expected = ArithmeticException.class) - public void testDivZero2b() { - int zero = 0; - int result = 4 / zero; - } -} diff --git a/src/test/uebung/uebung04/tournament/TournamentTest.java b/src/test/uebung/uebung04/tournament/TournamentTest.java deleted file mode 100644 index 5dbff2d..0000000 --- a/src/test/uebung/uebung04/tournament/TournamentTest.java +++ /dev/null @@ -1,134 +0,0 @@ -package test.uebung.uebung04.tournament; - -import org.junit.Before; -import org.junit.Test; - -import java.util.Collection; -import java.util.HashSet; -import java.util.Set; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThrows; - -public class TournamentTest { - - private static final String BORGHOFF = "Prof. Borghoff"; - private static final String HOMMEL = "Prof. Hommel"; - private static final String KOCH = "Prof. Koch"; - private static final String MINAS = "Prof. Minas"; - private static final String BUCHENRIEDER = "Prof. Buchenrieder"; - private static final String DREO = "Prof. Dreo"; - private static final String ROSE = "Prof. Rose"; - private static final String SIEGLE = "Prof. Siegle"; - private static final String TEEGE = "Prof. Teege"; - private static final Set SET1 = Set.of(BORGHOFF, HOMMEL, KOCH, MINAS, BUCHENRIEDER, DREO, ROSE, SIEGLE, TEEGE); - private static final Set SET2 = Set.of(BORGHOFF, MINAS, SIEGLE, HOMMEL, DREO); - private static final Set SET3 = Set.of(BORGHOFF, MINAS, SIEGLE); - private static final Set SET4 = Set.of(MINAS, SIEGLE); - private static final Set SET5 = Set.of(MINAS); - - private Tournament tournament; - private Game r1s1; - private Game r1s2; - private Game r1s3; - private Game r1s4; - private Game r2s1; - private Game r2s2; - private Game r3s1; - private Game r4s1; - - @Before - public void setup() { - r1s1 = new SeededGame(HOMMEL, KOCH); - r1s2 = new SeededGame(MINAS, BUCHENRIEDER); - r1s3 = new SeededGame(DREO, ROSE); - r1s4 = new SeededGame(SIEGLE, TEEGE); - r2s1 = new ByeGame(BORGHOFF, r1s1); - r2s2 = new OrdinaryGame(r1s2, r1s3); - r3s1 = new OrdinaryGame(r2s1, r2s2); - r4s1 = new OrdinaryGame(r3s1, r1s4); - tournament = new Tournament("UniBw Sportschießen", r4s1); - } - - @Test - public void testBeforeFirstRound() { - assertEquals(SET1, asSet(tournament.getAllPlayers())); - assertEquals(SET1, asSet(tournament.getRemainingPlayers())); - } - - @Test - public void testFirstRound() { - r1s1.setWinner(HOMMEL); - r1s2.setWinner(MINAS); - r1s3.setWinner(DREO); - r1s4.setWinner(SIEGLE); - assertEquals(SET1, asSet(tournament.getAllPlayers())); - assertEquals(SET2, asSet(tournament.getRemainingPlayers())); - } - - @Test - public void testSecondRound() { - r1s1.setWinner(HOMMEL); - r1s2.setWinner(MINAS); - r1s3.setWinner(DREO); - r1s4.setWinner(SIEGLE); - r2s1.setWinner(BORGHOFF); - r2s2.setWinner(MINAS); - assertEquals(SET1, asSet(tournament.getAllPlayers())); - assertEquals(SET3, asSet(tournament.getRemainingPlayers())); - } - - @Test - public void testThirdRound() { - r1s1.setWinner(HOMMEL); - r1s2.setWinner(MINAS); - r1s3.setWinner(DREO); - r1s4.setWinner(SIEGLE); - r2s1.setWinner(BORGHOFF); - r2s2.setWinner(MINAS); - r3s1.setWinner(MINAS); - assertEquals(SET1, asSet(tournament.getAllPlayers())); - assertEquals(SET4, asSet(tournament.getRemainingPlayers())); - } - - @Test - public void testCompleteTournament() { - r1s1.setWinner(HOMMEL); - r1s2.setWinner(MINAS); - r1s3.setWinner(DREO); - r1s4.setWinner(SIEGLE); - r2s1.setWinner(BORGHOFF); - r2s2.setWinner(MINAS); - r3s1.setWinner(MINAS); - r4s1.setWinner(MINAS); - assertEquals(SET1, asSet(tournament.getAllPlayers())); - assertEquals(SET5, asSet(tournament.getRemainingPlayers())); - } - - @Test - public void testException() { - r1s1.setWinner(HOMMEL); - r1s2.setWinner(MINAS); - r1s3.setWinner(DREO); - r1s4.setWinner(SIEGLE); - r2s1.setWinner(BORGHOFF); - r2s2.setWinner(MINAS); - r3s1.setWinner(MINAS); - assertThrows(IllegalArgumentException.class, () -> r4s1.setWinner(BUCHENRIEDER)); - } - - @Test(expected = IllegalStateException.class) - public void testException2() { - r4s1.setWinner(MINAS); - } - - @Test - public void testException3() { - r1s1.setWinner(HOMMEL); - assertThrows(IllegalStateException.class, () -> r1s1.setWinner(HOMMEL)); - } - - private static Set asSet(Collection collection) { - return new HashSet<>(collection); - } -} diff --git a/src/test/uebung/uebung05/logistics/ManagerTest.java b/src/test/uebung/uebung05/logistics/ManagerTest.java index 0eb3a56..9038428 100644 --- a/src/test/uebung/uebung05/logistics/ManagerTest.java +++ b/src/test/uebung/uebung05/logistics/ManagerTest.java @@ -1,13 +1,18 @@ -package logistics; +package test.uebung.uebung05.logistics; + +import uebung05.logistics.Helicopter; +import uebung05.logistics.Manager; +import uebung05.logistics.Tank; +import uebung05.logistics.material.BulletBelts; +import uebung05.logistics.material.Grease; +import uebung05.logistics.material.LiterDiesel; +import uebung05.logistics.material.MetGallonsKerosene; +import uebung05.logistics.material.Oil; +import uebung05.logistics.material.RocketPods; +import uebung05.logistics.material.ShellBatches; +import uebung05.logistics.quantities.NeedCollector; + -import logistics.material.BulletBelts; -import logistics.material.Grease; -import logistics.material.LiterDiesel; -import logistics.material.MetGallonsKerosene; -import logistics.material.Oil; -import logistics.material.RocketPods; -import logistics.material.ShellBatches; -import logistics.quantities.NeedCollector; import org.junit.Before; import org.junit.Test; diff --git a/src/test/uebung/uebung05/logistics/storage/IntStorageTest.java b/src/test/uebung/uebung05/logistics/storage/IntStorageTest.java index b6ca56a..5f85bfa 100644 --- a/src/test/uebung/uebung05/logistics/storage/IntStorageTest.java +++ b/src/test/uebung/uebung05/logistics/storage/IntStorageTest.java @@ -1,6 +1,8 @@ package test.uebung.uebung05.logistics.storage; -import uebung05.*; +import uebung05.logistics.material.Oil; +import uebung05.logistics.storage.IntStorage; + import org.junit.Before; import org.junit.Test; diff --git a/src/uebung04/ByeGame.java b/src/uebung04/ByeGame.java index dbb47f1..a0797a4 100644 --- a/src/uebung04/ByeGame.java +++ b/src/uebung04/ByeGame.java @@ -1,20 +1,26 @@ package uebung04; +import java.util.ArrayList; + public class ByeGame extends Game{ private String player1; + private String player2; - public ByeGame(String player1, Game player2){ + public ByeGame(String player1, String player2){ this.player1 = player1; this.player2 = player2; } public String getPlayer1(){return player1;} + public String getPlayer2(){return player2;} - public ??? getPlayer2(){ - return player2.getAllPlayers(); + @Override + public ArrayList getAllPlayers() { + // TODO Auto-generated method stub + throw new UnsupportedOperationException("Unimplemented method 'getAllPlayers'"); } diff --git a/src/uebung04/OrdinaryGame.java b/src/uebung04/OrdinaryGame.java index 3d718aa..7bf948f 100644 --- a/src/uebung04/OrdinaryGame.java +++ b/src/uebung04/OrdinaryGame.java @@ -7,7 +7,7 @@ public class OrdinaryGame extends Game{ private final int id; - public OrdinaryGame(Game player1, Game player2){ + public OrdinaryGame(String player1, String player2){ this.player1 = player1; this.player2 = player2; @@ -15,18 +15,16 @@ public class OrdinaryGame extends Game{ counter++; } - public ArrayList getPlayer1(){ - return player1.getAllPlayers(); + public String getPlayer1(){ + return null; } - public ArrayList getPlayer2(){ - return player2.getAllPlayers(); + public String getPlayer2(){ + return null; } public ArrayList getAllPlayers(){ - ArrayList rtn = player1.getAllPlayers(); - rtn.addAll(player2.getAllPlayers()); - return rtn; + return null; } } diff --git a/src/uebung05/logistics/Demo.java b/src/uebung05/logistics/Demo.java index 9081424..e1278cc 100755 --- a/src/uebung05/logistics/Demo.java +++ b/src/uebung05/logistics/Demo.java @@ -1,8 +1,8 @@ -package logistics; +package uebung05.logistics; -import logistics.material.BulletBelts; -import logistics.material.LiterDiesel; -import logistics.material.RocketPods; +import uebung05.logistics.material.BulletBelts; +import uebung05.logistics.material.LiterDiesel; +import uebung05.logistics.material.RocketPods; class demo { diff --git a/src/uebung05/logistics/Helicopter.java b/src/uebung05/logistics/Helicopter.java index 8d53e33..2243148 100755 --- a/src/uebung05/logistics/Helicopter.java +++ b/src/uebung05/logistics/Helicopter.java @@ -1,13 +1,13 @@ -package logistics; +package uebung05.logistics; -import logistics.material.BulletBelts; -import logistics.material.MetGallonsKerosene; -import logistics.material.RocketPods; -import logistics.quantities.FloatUnit; -import logistics.quantities.IntUnit; -import logistics.quantities.NeedCollector; -import logistics.storage.FloatStorage; -import logistics.storage.IntStorage; +import uebung05.logistics.material.BulletBelts; +import uebung05.logistics.material.MetGallonsKerosene; +import uebung05.logistics.material.RocketPods; +import uebung05.logistics.quantities.FloatUnit; +import uebung05.logistics.quantities.IntUnit; +import uebung05.logistics.quantities.NeedCollector; +import uebung05.logistics.storage.FloatStorage; +import uebung05.logistics.storage.IntStorage; /** * The Helicopter class represents a helicopter in the logistics system. diff --git a/src/uebung05/logistics/Manager.java b/src/uebung05/logistics/Manager.java index b954c8e..16d4780 100755 --- a/src/uebung05/logistics/Manager.java +++ b/src/uebung05/logistics/Manager.java @@ -1,9 +1,9 @@ -package logistics; +package uebung05.logistics; -import logistics.quantities.FloatUnit; -import logistics.quantities.IntUnit; -import logistics.quantities.NeedCollector; -import logistics.quantities.Unit; +import uebung05.logistics.quantities.FloatUnit; +import uebung05.logistics.quantities.IntUnit; +import uebung05.logistics.quantities.NeedCollector; +import uebung05.logistics.quantities.Unit; import java.util.ArrayList; import java.util.List; @@ -63,7 +63,7 @@ public class Manager { * * @return The NeedCollector object containing the needs of all the vehicles */ - NeedCollector collectNeeds() { + public NeedCollector collectNeeds() { NeedCollector collector = new NeedCollector(); for (Vehicle vehicle : vehicles) { vehicle.reportNeeds(collector); diff --git a/src/uebung05/logistics/NeedCollector.java b/src/uebung05/logistics/NeedCollector.java index 0aec1bc..4e7427f 100755 --- a/src/uebung05/logistics/NeedCollector.java +++ b/src/uebung05/logistics/NeedCollector.java @@ -1,7 +1,7 @@ -package logistics; +package uebung05.logistics; -import logistics.quantities.FloatUnit; -import logistics.quantities.IntUnit; +import uebung05.logistics.quantities.FloatUnit; +import uebung05.logistics.quantities.IntUnit; import java.util.HashMap; import java.util.Map; diff --git a/src/uebung05/logistics/Tank.java b/src/uebung05/logistics/Tank.java index 489875a..cb8a2df 100755 --- a/src/uebung05/logistics/Tank.java +++ b/src/uebung05/logistics/Tank.java @@ -1,13 +1,13 @@ -package logistics; +package uebung05.logistics; -import logistics.material.BulletBelts; -import logistics.material.LiterDiesel; -import logistics.material.ShellBatches; -import logistics.quantities.FloatUnit; -import logistics.quantities.IntUnit; -import logistics.quantities.NeedCollector; -import logistics.storage.FloatStorage; -import logistics.storage.IntStorage; +import uebung05.logistics.material.BulletBelts; +import uebung05.logistics.material.LiterDiesel; +import uebung05.logistics.material.ShellBatches; +import uebung05.logistics.quantities.FloatUnit; +import uebung05.logistics.quantities.IntUnit; +import uebung05.logistics.quantities.NeedCollector; +import uebung05.logistics.storage.FloatStorage; +import uebung05.logistics.storage.IntStorage; /** * The Tank class represents a tank in the logistics system. diff --git a/src/uebung05/logistics/Truck.java b/src/uebung05/logistics/Truck.java index 83deb6e..7b47e12 100755 --- a/src/uebung05/logistics/Truck.java +++ b/src/uebung05/logistics/Truck.java @@ -1,12 +1,12 @@ -package logistics; +package uebung05.logistics; -import logistics.material.BulletBelts; -import logistics.material.LiterDiesel; -import logistics.quantities.FloatUnit; -import logistics.quantities.IntUnit; -import logistics.quantities.NeedCollector; -import logistics.storage.FloatStorage; -import logistics.storage.IntStorage; +import uebung05.logistics.material.BulletBelts; +import uebung05.logistics.material.LiterDiesel; +import uebung05.logistics.quantities.FloatUnit; +import uebung05.logistics.quantities.IntUnit; +import uebung05.logistics.quantities.NeedCollector; +import uebung05.logistics.storage.FloatStorage; +import uebung05.logistics.storage.IntStorage; /** * The Truck class represents a truck in the logistics system. diff --git a/src/uebung05/logistics/Vehicle.java b/src/uebung05/logistics/Vehicle.java index 6ae0002..04a3735 100755 --- a/src/uebung05/logistics/Vehicle.java +++ b/src/uebung05/logistics/Vehicle.java @@ -1,11 +1,11 @@ -package logistics; +package uebung05.logistics; -import logistics.material.Grease; -import logistics.material.Oil; -import logistics.quantities.FloatUnit; -import logistics.quantities.IntUnit; -import logistics.quantities.NeedCollector; -import logistics.storage.IntStorage; +import uebung05.logistics.material.Grease; +import uebung05.logistics.material.Oil; +import uebung05.logistics.quantities.FloatUnit; +import uebung05.logistics.quantities.IntUnit; +import uebung05.logistics.quantities.NeedCollector; +import uebung05.logistics.storage.IntStorage; /** * The Vehicle abstract class represents a vehicle in the logistics system. diff --git a/src/uebung05/logistics/material/BulletBelts.java b/src/uebung05/logistics/material/BulletBelts.java index 7df7b9b..45e166c 100755 --- a/src/uebung05/logistics/material/BulletBelts.java +++ b/src/uebung05/logistics/material/BulletBelts.java @@ -1,6 +1,6 @@ -package logistics.material; +package uebung05.logistics.material; -import logistics.quantities.IntUnit; +import uebung05.logistics.quantities.IntUnit; /** * The BulletBelts class represents a unit of measurement for 7.62 bullets. @@ -11,7 +11,7 @@ import logistics.quantities.IntUnit; */ public class BulletBelts implements IntUnit { - private static BulletBelts INSTANCE; + public static BulletBelts INSTANCE; private BulletBelts() {} diff --git a/src/uebung05/logistics/material/Grease.java b/src/uebung05/logistics/material/Grease.java index d752195..c0eef9c 100755 --- a/src/uebung05/logistics/material/Grease.java +++ b/src/uebung05/logistics/material/Grease.java @@ -1,6 +1,6 @@ -package logistics.material; +package uebung05.logistics.material; -import logistics.quantities.IntUnit; +import uebung05.logistics.quantities.IntUnit; /** * The Grease class represents a unit of measurement for grease. @@ -11,7 +11,7 @@ import logistics.quantities.IntUnit; */ public class Grease implements IntUnit { - private static Grease INSTANCE; + public static Grease INSTANCE; private Grease() {} diff --git a/src/uebung05/logistics/material/LiterDiesel.java b/src/uebung05/logistics/material/LiterDiesel.java index 2e16e58..31f638d 100755 --- a/src/uebung05/logistics/material/LiterDiesel.java +++ b/src/uebung05/logistics/material/LiterDiesel.java @@ -1,6 +1,6 @@ -package logistics.material; +package uebung05.logistics.material; -import logistics.quantities.FloatUnit; +import uebung05.logistics.quantities.FloatUnit; /** * The LiterDiesel class represents a unit of measurement for diesel fuel. @@ -11,7 +11,7 @@ import logistics.quantities.FloatUnit; */ public class LiterDiesel implements FloatUnit { - private static LiterDiesel INSTANCE; + public static LiterDiesel INSTANCE; private LiterDiesel() {} diff --git a/src/uebung05/logistics/material/MetGallonsKerosene.java b/src/uebung05/logistics/material/MetGallonsKerosene.java index a50399c..b8e7f1c 100755 --- a/src/uebung05/logistics/material/MetGallonsKerosene.java +++ b/src/uebung05/logistics/material/MetGallonsKerosene.java @@ -1,6 +1,6 @@ -package logistics.material; +package uebung05.logistics.material; -import logistics.quantities.FloatUnit; +import uebung05.logistics.quantities.FloatUnit; /** * The MetGallonsKerosene class represents a unit of measurement for kerosene. @@ -11,7 +11,7 @@ import logistics.quantities.FloatUnit; */ public class MetGallonsKerosene implements FloatUnit { - private static MetGallonsKerosene INSTANCE; + public static MetGallonsKerosene INSTANCE; private MetGallonsKerosene() {} diff --git a/src/uebung05/logistics/material/Oil.java b/src/uebung05/logistics/material/Oil.java index 4f991b1..6bb60ae 100755 --- a/src/uebung05/logistics/material/Oil.java +++ b/src/uebung05/logistics/material/Oil.java @@ -1,6 +1,6 @@ -package logistics.material; +package uebung05.logistics.material; -import logistics.quantities.IntUnit; +import uebung05.logistics.quantities.IntUnit; /** * The Oil class represents a unit of measurement for oil. @@ -11,7 +11,7 @@ import logistics.quantities.IntUnit; */ public class Oil implements IntUnit { - private static Oil INSTANCE; + public static Oil INSTANCE; private Oil() {} diff --git a/src/uebung05/logistics/material/RocketPods.java b/src/uebung05/logistics/material/RocketPods.java index 44f07b3..a3a07d6 100755 --- a/src/uebung05/logistics/material/RocketPods.java +++ b/src/uebung05/logistics/material/RocketPods.java @@ -1,6 +1,6 @@ -package logistics.material; +package uebung05.logistics.material; -import logistics.quantities.IntUnit; +import uebung05.logistics.quantities.IntUnit; /** * The RocketPods class represents a unit of measurement for 70mm rocket pods. @@ -11,7 +11,7 @@ import logistics.quantities.IntUnit; */ public class RocketPods implements IntUnit { - private static RocketPods INSTANCE; + public static RocketPods INSTANCE; private RocketPods() {} diff --git a/src/uebung05/logistics/material/ShellBatches.java b/src/uebung05/logistics/material/ShellBatches.java index ee6f820..0f14656 100755 --- a/src/uebung05/logistics/material/ShellBatches.java +++ b/src/uebung05/logistics/material/ShellBatches.java @@ -1,6 +1,6 @@ -package logistics.material; +package uebung05.logistics.material; -import logistics.quantities.IntUnit; +import uebung05.logistics.quantities.IntUnit; /** * The ShellBatches class represents a unit of measurement for 120mm shell batches. @@ -11,7 +11,7 @@ import logistics.quantities.IntUnit; */ public class ShellBatches implements IntUnit { - private static ShellBatches INSTANCE; + public static ShellBatches INSTANCE; private ShellBatches() {} diff --git a/src/uebung05/logistics/quantities/FloatUnit.java b/src/uebung05/logistics/quantities/FloatUnit.java index 69d5cf3..1d60f93 100755 --- a/src/uebung05/logistics/quantities/FloatUnit.java +++ b/src/uebung05/logistics/quantities/FloatUnit.java @@ -1,4 +1,4 @@ -package logistics.quantities; +package uebung05.logistics.quantities; /** * @author Nikolaus Köberlein diff --git a/src/uebung05/logistics/quantities/IntUnit.java b/src/uebung05/logistics/quantities/IntUnit.java index 1b6ed1f..27da450 100755 --- a/src/uebung05/logistics/quantities/IntUnit.java +++ b/src/uebung05/logistics/quantities/IntUnit.java @@ -1,4 +1,4 @@ -package logistics.quantities; +package uebung05.logistics.quantities; /** * @author Nikolaus Köberlein diff --git a/src/uebung05/logistics/quantities/NeedCollector.java b/src/uebung05/logistics/quantities/NeedCollector.java index 00b0597..8edf4e8 100755 --- a/src/uebung05/logistics/quantities/NeedCollector.java +++ b/src/uebung05/logistics/quantities/NeedCollector.java @@ -1,12 +1,12 @@ -package logistics.quantities; +package uebung05.logistics.quantities; -import logistics.material.BulletBelts; -import logistics.material.Grease; -import logistics.material.LiterDiesel; -import logistics.material.MetGallonsKerosene; -import logistics.material.Oil; -import logistics.material.RocketPods; -import logistics.material.ShellBatches; +import uebung05.logistics.material.BulletBelts; +import uebung05.logistics.material.Grease; +import uebung05.logistics.material.LiterDiesel; +import uebung05.logistics.material.MetGallonsKerosene; +import uebung05.logistics.material.Oil; +import uebung05.logistics.material.RocketPods; +import uebung05.logistics.material.ShellBatches; import java.util.HashMap; import java.util.Map; diff --git a/src/uebung05/logistics/quantities/Unit.java b/src/uebung05/logistics/quantities/Unit.java index 258b194..db0f6e5 100755 --- a/src/uebung05/logistics/quantities/Unit.java +++ b/src/uebung05/logistics/quantities/Unit.java @@ -1,4 +1,4 @@ -package logistics.quantities; +package uebung05.logistics.quantities; /** * @author Nikolaus Köberlein diff --git a/src/uebung05/logistics/storage/FloatStorage.java b/src/uebung05/logistics/storage/FloatStorage.java index 9c42a30..f57805c 100755 --- a/src/uebung05/logistics/storage/FloatStorage.java +++ b/src/uebung05/logistics/storage/FloatStorage.java @@ -1,7 +1,7 @@ -package logistics.storage; +package uebung05.logistics.storage; -import logistics.quantities.FloatUnit; -import logistics.quantities.NeedCollector; +import uebung05.logistics.quantities.FloatUnit; +import uebung05.logistics.quantities.NeedCollector; /** * The FloatStorage class represents a floating-point storage for a specific FloatUnit object. diff --git a/src/uebung05/logistics/storage/IntStorage.java b/src/uebung05/logistics/storage/IntStorage.java index 0092f91..435f3e5 100755 --- a/src/uebung05/logistics/storage/IntStorage.java +++ b/src/uebung05/logistics/storage/IntStorage.java @@ -1,7 +1,7 @@ -package logistics.storage; +package uebung05.logistics.storage; -import logistics.quantities.IntUnit; -import logistics.quantities.NeedCollector; +import uebung05.logistics.quantities.IntUnit; +import uebung05.logistics.quantities.NeedCollector; /** * The IntStorage class represents an integer storage for a specific IntUnit object. diff --git a/src/uebung07/quantities/plain/TimeUnit.java b/src/uebung07/quantities/plain/TimeUnit.java deleted file mode 100644 index 9e4523b..0000000 --- a/src/uebung07/quantities/plain/TimeUnit.java +++ /dev/null @@ -1,5 +0,0 @@ -package uebung07.quantities.plain; - -public class TimeUnit extends Unit{ - -} diff --git a/src/uebung09/chess/Board.java b/src/uebung09/chess/Board.java index c14dd7f..b0744ce 100644 --- a/src/uebung09/chess/Board.java +++ b/src/uebung09/chess/Board.java @@ -9,7 +9,7 @@ import uebung09.iterator.Array2dIterator; public class Board implements Iterable{ private final Piece[][] field = new Piece[8][8]; - //private final List pieces = new ArrayList<>(); + private final List pieces = new ArrayList<>(); void add(Piece piece) { @@ -42,7 +42,7 @@ public class Board implements Iterable{ } public void check() { - for (Piece p1 : iterator()) { + for (Piece p1 : pieces) { System.out.println(p1.toString()); for (Piece p2 : pieces) if (p1 != p2) diff --git a/src/uebung09/iterator/Array2dIterator.java b/src/uebung09/iterator/Array2dIterator.java index 7ca27e3..8cb6fa4 100644 --- a/src/uebung09/iterator/Array2dIterator.java +++ b/src/uebung09/iterator/Array2dIterator.java @@ -1,39 +1,70 @@ package uebung09.iterator; +import java.util.ArrayList; import java.util.Iterator; public class Array2dIterator implements Iterator{ private T[][] array; + private ArrayList list; private int index = 0; public Array2dIterator(T[][] array) { this.array = array; + list = flatten(); } @Override public boolean hasNext() { - for (int i = 0; i < array.length; i++) { - for (int j = 0; j < array[i].length; j++) { - if (array[i][j+1] != null) { - return true; - } - if (array[i+1][j] != null) { - return true; - } - } + // for (int i = 0; i < array.length; i++) { + // for (int j = 0; j < array[i].length; j++) { + // if (array[i][j+1] != null) { + // return true; + // } + // if (array[i+1][j] != null) { + // return true; + // } + // } + // } + // return false; + + + if (list.get(index+1) != null) { + return true; + } else { + return false; } - return false; } @Override public T next() { - for (int i = 0; i < array.length; i++) { - for (int j = 0; j < array[i].length; j++) { - - } - } - return null; + // for (int i = 0; i < array.length; i++) { + // for (int j = 0; j < array[i].length; j++) { + // if (array[i][j+1] != null) { + // return array[i][j+1]; + // } + + // } + // if (array[i+1][0] != null) { + // return array[i+1][0]; + // } + // } + // return null; + + + return list.get(index++); + } + private ArrayList flatten(){ + ArrayList list = new ArrayList<>(); + + for (int i = 0; i < array.length; i++) { + for (int j = 0; j < array[i].length; j++) { + list.add(array[i][j]); + } + } + + return list; + } }