diff --git a/exercises/practice/flower-field/src/test/java/FlowerFieldBoardTest.java b/exercises/practice/flower-field/src/test/java/FlowerFieldBoardTest.java index 518b6344b..3eba013f6 100644 --- a/exercises/practice/flower-field/src/test/java/FlowerFieldBoardTest.java +++ b/exercises/practice/flower-field/src/test/java/FlowerFieldBoardTest.java @@ -1,4 +1,5 @@ import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import java.util.Arrays; @@ -10,6 +11,7 @@ public class FlowerFieldBoardTest { @Test + @DisplayName("no rows") public void testInputBoardWithNoRowsAndNoColumns() { List inputBoard = Collections.emptyList(); List expectedNumberedBoard = Collections.emptyList(); @@ -20,6 +22,7 @@ public void testInputBoardWithNoRowsAndNoColumns() { @Disabled("Remove to run test") @Test + @DisplayName("no columns") public void testInputBoardWithOneRowAndNoColumns() { List inputBoard = Collections.singletonList(""); List expectedNumberedBoard = Collections.singletonList(""); @@ -30,6 +33,7 @@ public void testInputBoardWithOneRowAndNoColumns() { @Disabled("Remove to run test") @Test + @DisplayName("no flowers") public void testInputBoardWithNoFlowers() { List inputBoard = Arrays.asList( " ", @@ -50,6 +54,7 @@ public void testInputBoardWithNoFlowers() { @Disabled("Remove to run test") @Test + @DisplayName("garden full of flowers") public void testInputBoardWithOnlyFlowers() { List inputBoard = Arrays.asList( "***", @@ -70,6 +75,7 @@ public void testInputBoardWithOnlyFlowers() { @Disabled("Remove to run test") @Test + @DisplayName("flower surrounded by spaces") public void testInputBoardWithSingleFlowerAtCenter() { List inputBoard = Arrays.asList( " ", @@ -90,6 +96,7 @@ public void testInputBoardWithSingleFlowerAtCenter() { @Disabled("Remove to run test") @Test + @DisplayName("space surrounded by flowers") public void testInputBoardWithFlowersAroundPerimeter() { List inputBoard = Arrays.asList( "***", @@ -110,6 +117,7 @@ public void testInputBoardWithFlowersAroundPerimeter() { @Disabled("Remove to run test") @Test + @DisplayName("horizontal line") public void testInputBoardWithSingleRowAndTwoFlowers() { List inputBoard = Collections.singletonList( " * * " @@ -126,6 +134,7 @@ public void testInputBoardWithSingleRowAndTwoFlowers() { @Disabled("Remove to run test") @Test + @DisplayName("horizontal line, flowers at edges") public void testInputBoardWithSingleRowAndTwoFlowersAtEdges() { List inputBoard = Collections.singletonList( "* *" @@ -142,6 +151,7 @@ public void testInputBoardWithSingleRowAndTwoFlowersAtEdges() { @Disabled("Remove to run test") @Test + @DisplayName("vertical line") public void testInputBoardWithSingleColumnAndTwoFlowers() { List inputBoard = Arrays.asList( " ", @@ -166,6 +176,7 @@ public void testInputBoardWithSingleColumnAndTwoFlowers() { @Disabled("Remove to run test") @Test + @DisplayName("vertical line, flowers at edges") public void testInputBoardWithSingleColumnAndTwoFlowersAtEdges() { List inputBoard = Arrays.asList( "*", @@ -190,6 +201,7 @@ public void testInputBoardWithSingleColumnAndTwoFlowersAtEdges() { @Disabled("Remove to run test") @Test + @DisplayName("cross") public void testInputBoardWithFlowersInCross() { List inputBoard = Arrays.asList( " * ", @@ -214,6 +226,7 @@ public void testInputBoardWithFlowersInCross() { @Disabled("Remove to run test") @Test + @DisplayName("large garden") public void testLargeInputBoard() { List inputBoard = Arrays.asList( " * * ", diff --git a/exercises/practice/food-chain/src/test/java/FoodChainTest.java b/exercises/practice/food-chain/src/test/java/FoodChainTest.java index a0f5caa57..43e7a0746 100644 --- a/exercises/practice/food-chain/src/test/java/FoodChainTest.java +++ b/exercises/practice/food-chain/src/test/java/FoodChainTest.java @@ -1,5 +1,6 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; @@ -13,6 +14,7 @@ public void setup() { } @Test + @DisplayName("fly") public void fly() { int verse = 1; String expected = "I know an old lady who swallowed a fly.\n" + @@ -23,6 +25,7 @@ public void fly() { @Test @Disabled("Remove to run test.") + @DisplayName("spider") public void spider() { int verse = 2; String expected = "I know an old lady who swallowed a spider.\n" + @@ -35,6 +38,7 @@ public void spider() { @Test @Disabled("Remove to run test.") + @DisplayName("bird") public void bird() { int verse = 3; String expected = "I know an old lady who swallowed a bird.\n" + @@ -49,6 +53,7 @@ public void bird() { @Test @Disabled("Remove to run test.") + @DisplayName("cat") public void cat() { int verse = 4; String expected = "I know an old lady who swallowed a cat.\n" + @@ -65,6 +70,7 @@ public void cat() { @Test @Disabled("Remove to run test.") + @DisplayName("dog") public void dog() { int verse = 5; String expected = "I know an old lady who swallowed a dog.\n" + @@ -81,6 +87,7 @@ public void dog() { @Test @Disabled("Remove to run test.") + @DisplayName("goat") public void goat() { int verse = 6; String expected = "I know an old lady who swallowed a goat.\n" + @@ -98,6 +105,7 @@ public void goat() { @Test @Disabled("Remove to run test.") + @DisplayName("cow") public void cow() { int verse = 7; String expected = "I know an old lady who swallowed a cow.\n" + @@ -116,6 +124,7 @@ public void cow() { @Test @Disabled("Remove to run test.") + @DisplayName("horse") public void horse() { int verse = 8; String expected = "I know an old lady who swallowed a horse.\n" + @@ -127,6 +136,7 @@ public void horse() { @Test @Disabled("Remove to run test.") + @DisplayName("multiple verses") public void multipleVerses() { int startVerse = 1; int endVerse = 3; @@ -151,6 +161,7 @@ public void multipleVerses() { @Test @Disabled("Remove to run test.") + @DisplayName("full song") public void wholeSong() { int startVerse = 1; int endVerse = 8; diff --git a/exercises/practice/forth/src/test/java/ForthEvaluatorTest.java b/exercises/practice/forth/src/test/java/ForthEvaluatorTest.java index bd36657b3..9a7c23e01 100644 --- a/exercises/practice/forth/src/test/java/ForthEvaluatorTest.java +++ b/exercises/practice/forth/src/test/java/ForthEvaluatorTest.java @@ -1,4 +1,5 @@ import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import java.util.Arrays; @@ -13,6 +14,7 @@ public class ForthEvaluatorTest { private ForthEvaluator forthEvaluator = new ForthEvaluator(); @Test + @DisplayName("numbers just get pushed onto the stack") public void testNumbersAreJustPushedOntoTheStack() { assertThat(forthEvaluator.evaluateProgram(Collections.singletonList("1 2 3 4 5"))) .containsExactly(1, 2, 3, 4, 5); @@ -20,6 +22,7 @@ public void testNumbersAreJustPushedOntoTheStack() { @Disabled("Remove to run test") @Test + @DisplayName("pushes negative numbers onto the stack") public void testNegativeNumbersArePushedOntoTheStack() { assertThat(forthEvaluator.evaluateProgram(Collections.singletonList("-1 -2 -3 -4 -5"))) .containsExactly(-1, -2, -3, -4, -5); @@ -27,6 +30,7 @@ public void testNegativeNumbersArePushedOntoTheStack() { @Disabled("Remove to run test") @Test + @DisplayName("can add two numbers") public void testTwoNumbersCanBeAdded() { assertThat(forthEvaluator.evaluateProgram(Collections.singletonList("1 2 +"))) .containsExactly(3); @@ -34,6 +38,7 @@ public void testTwoNumbersCanBeAdded() { @Disabled("Remove to run test") @Test + @DisplayName("errors if there is nothing on the stack") public void testErrorIfAdditionAttemptedWithNothingOnTheStack() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> forthEvaluator.evaluateProgram(Collections.singletonList("+"))) @@ -42,6 +47,7 @@ public void testErrorIfAdditionAttemptedWithNothingOnTheStack() { @Disabled("Remove to run test") @Test + @DisplayName("errors if there is only one value on the stack") public void testErrorIfAdditionAttemptedWithOneNumberOnTheStack() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> forthEvaluator.evaluateProgram(Collections.singletonList("1 +"))) @@ -50,6 +56,7 @@ public void testErrorIfAdditionAttemptedWithOneNumberOnTheStack() { @Disabled("Remove to run test") @Test + @DisplayName("more than two values on the stack") public void testAdditionForMoreThanTwoValuesOnTheStack() { assertThat(forthEvaluator.evaluateProgram(Collections.singletonList("1 2 3 +"))) .containsExactly(1, 5); @@ -57,6 +64,7 @@ public void testAdditionForMoreThanTwoValuesOnTheStack() { @Disabled("Remove to run test") @Test + @DisplayName("can subtract two numbers") public void testTwoNumbersCanBeSubtracted() { assertThat(forthEvaluator.evaluateProgram(Collections.singletonList("3 4 -"))) .containsExactly(-1); @@ -64,6 +72,7 @@ public void testTwoNumbersCanBeSubtracted() { @Disabled("Remove to run test") @Test + @DisplayName("errors if there is nothing on the stack") public void testErrorIfSubtractionAttemptedWithNothingOnTheStack() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> forthEvaluator.evaluateProgram(Collections.singletonList("-"))) @@ -73,6 +82,7 @@ public void testErrorIfSubtractionAttemptedWithNothingOnTheStack() { @Disabled("Remove to run test") @Test + @DisplayName("errors if there is only one value on the stack") public void testErrorIfSubtractionAttemptedWithOneNumberOnTheStack() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> forthEvaluator.evaluateProgram(Collections.singletonList("1 -"))) @@ -81,6 +91,7 @@ public void testErrorIfSubtractionAttemptedWithOneNumberOnTheStack() { @Disabled("Remove to run test") @Test + @DisplayName("more than two values on the stack") public void testSubtractionForMoreThanTwoValuesOnTheStack() { assertThat(forthEvaluator.evaluateProgram(Collections.singletonList("1 12 3 -"))) .containsExactly(1, 9); @@ -88,12 +99,14 @@ public void testSubtractionForMoreThanTwoValuesOnTheStack() { @Disabled("Remove to run test") @Test + @DisplayName("can multiply two numbers") public void testTwoNumbersCanBeMultiplied() { assertThat(forthEvaluator.evaluateProgram(Collections.singletonList("2 4 *"))).containsExactly(8); } @Disabled("Remove to run test") @Test + @DisplayName("errors if there is nothing on the stack") public void testErrorIfMultiplicationAttemptedWithNothingOnTheStack() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> forthEvaluator.evaluateProgram(Collections.singletonList("*"))) @@ -102,6 +115,7 @@ public void testErrorIfMultiplicationAttemptedWithNothingOnTheStack() { @Disabled("Remove to run test") @Test + @DisplayName("errors if there is only one value on the stack") public void testErrorIfMultiplicationAttemptedWithOneNumberOnTheStack() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> forthEvaluator.evaluateProgram(Collections.singletonList("1 *"))) @@ -110,6 +124,7 @@ public void testErrorIfMultiplicationAttemptedWithOneNumberOnTheStack() { @Disabled("Remove to run test") @Test + @DisplayName("more than two values on the stack") public void testMultiplicationForMoreThanTwoValuesOnTheStack() { assertThat(forthEvaluator.evaluateProgram(Collections.singletonList("1 2 3 *"))) .containsExactly(1, 6); @@ -117,18 +132,21 @@ public void testMultiplicationForMoreThanTwoValuesOnTheStack() { @Disabled("Remove to run test") @Test + @DisplayName("can divide two numbers") public void testTwoNumbersCanBeDivided() { assertThat(forthEvaluator.evaluateProgram(Collections.singletonList("12 3 /"))).containsExactly(4); } @Disabled("Remove to run test") @Test + @DisplayName("performs integer division") public void testThatIntegerDivisionIsUsed() { assertThat(forthEvaluator.evaluateProgram(Collections.singletonList("8 3 /"))).containsExactly(2); } @Disabled("Remove to run test") @Test + @DisplayName("errors if dividing by zero") public void testErrorIfDividingByZero() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> forthEvaluator.evaluateProgram(Collections.singletonList("4 0 /"))) @@ -137,6 +155,7 @@ public void testErrorIfDividingByZero() { @Disabled("Remove to run test") @Test + @DisplayName("errors if there is nothing on the stack") public void testErrorIfDivisionAttemptedWithNothingOnTheStack() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> forthEvaluator.evaluateProgram(Collections.singletonList("/"))) @@ -145,6 +164,7 @@ public void testErrorIfDivisionAttemptedWithNothingOnTheStack() { @Disabled("Remove to run test") @Test + @DisplayName("errors if there is only one value on the stack") public void testErrorIfDivisionAttemptedWithOneNumberOnTheStack() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> forthEvaluator.evaluateProgram(Collections.singletonList("1 /"))) @@ -153,6 +173,7 @@ public void testErrorIfDivisionAttemptedWithOneNumberOnTheStack() { @Disabled("Remove to run test") @Test + @DisplayName("more than two values on the stack") public void testDivisionForMoreThanTwoValuesOnTheStack() { assertThat(forthEvaluator.evaluateProgram(Collections.singletonList("1 12 3 /"))) .containsExactly(1, 4); @@ -160,42 +181,49 @@ public void testDivisionForMoreThanTwoValuesOnTheStack() { @Disabled("Remove to run test") @Test + @DisplayName("addition and subtraction") public void testCombinedAdditionAndSubtraction() { assertThat(forthEvaluator.evaluateProgram(Collections.singletonList("1 2 + 4 -"))).containsExactly(-1); } @Disabled("Remove to run test") @Test + @DisplayName("multiplication and division") public void testCombinedMultiplicationAndDivision() { assertThat(forthEvaluator.evaluateProgram(Collections.singletonList("2 4 * 3 /"))).containsExactly(2); } @Disabled("Remove to run test") @Test + @DisplayName("multiplication and addition") public void testCombinedMultiplicationAndAddition() { assertThat(forthEvaluator.evaluateProgram(Collections.singletonList("1 3 4 * +"))).containsExactly(13); } @Disabled("Remove to run test") @Test + @DisplayName("addition and multiplication") public void testCombinedAdditionAndMultiplication() { assertThat(forthEvaluator.evaluateProgram(Collections.singletonList("1 3 4 + *"))).containsExactly(7); } @Disabled("Remove to run test") @Test + @DisplayName("copies a value on the stack") public void testDupCopiesAValueOnTheStack() { assertThat(forthEvaluator.evaluateProgram(Collections.singletonList("1 dup"))).containsExactly(1, 1); } @Disabled("Remove to run test") @Test + @DisplayName("copies the top value on the stack") public void testDupCopiesTopValueOnTheStack() { assertThat(forthEvaluator.evaluateProgram(Collections.singletonList("1 2 dup"))).containsExactly(1, 2, 2); } @Disabled("Remove to run test") @Test + @DisplayName("errors if there is nothing on the stack") public void testErrorIfDuplicatingAttemptedWithNothingOnTheStack() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> forthEvaluator.evaluateProgram(Collections.singletonList("dup"))) @@ -204,18 +232,21 @@ public void testErrorIfDuplicatingAttemptedWithNothingOnTheStack() { @Disabled("Remove to run test") @Test + @DisplayName("removes the top value on the stack if it is the only one") public void testDropRemovesTheTopValueOnTheStackIfItIsTheOnlyOne() { assertThat(forthEvaluator.evaluateProgram(Collections.singletonList("1 drop"))).isEmpty(); } @Disabled("Remove to run test") @Test + @DisplayName("removes the top value on the stack if it is not the only one") public void testDropRemovesTheTopValueOnTheStackIfItIsNotTheOnlyOne() { assertThat(forthEvaluator.evaluateProgram(Collections.singletonList("1 2 drop"))).containsExactly(1); } @Disabled("Remove to run test") @Test + @DisplayName("errors if there is nothing on the stack") public void testErrorIfDroppingAttemptedWithNothingOnTheStack() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> forthEvaluator.evaluateProgram(Collections.singletonList("drop"))) @@ -224,12 +255,14 @@ public void testErrorIfDroppingAttemptedWithNothingOnTheStack() { @Disabled("Remove to run test") @Test + @DisplayName("swaps the top two values on the stack if they are the only ones") public void testSwapSwapsTheTopTwosValueOnTheStackIfTheyAreTheOnlyOnes() { assertThat(forthEvaluator.evaluateProgram(Collections.singletonList("1 2 swap"))).containsExactly(2, 1); } @Disabled("Remove to run test") @Test + @DisplayName("swaps the top two values on the stack if they are not the only ones") public void testSwapSwapsTheTopTwosValueOnTheStackIfTheyAreNotTheOnlyOnes() { assertThat(forthEvaluator.evaluateProgram(Collections.singletonList("1 2 3 swap"))) .containsExactly(1, 3, 2); @@ -237,6 +270,7 @@ public void testSwapSwapsTheTopTwosValueOnTheStackIfTheyAreNotTheOnlyOnes() { @Disabled("Remove to run test") @Test + @DisplayName("errors if there is nothing on the stack") public void testErrorIfSwappingAttemptedWithNothingOnTheStack() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> forthEvaluator.evaluateProgram(Collections.singletonList("swap"))) @@ -245,6 +279,7 @@ public void testErrorIfSwappingAttemptedWithNothingOnTheStack() { @Disabled("Remove to run test") @Test + @DisplayName("errors if there is only one value on the stack") public void testErrorIfSwappingAttemptedWithOneNumberOnTheStack() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> forthEvaluator.evaluateProgram(Collections.singletonList("1 swap"))) @@ -253,6 +288,7 @@ public void testErrorIfSwappingAttemptedWithOneNumberOnTheStack() { @Disabled("Remove to run test") @Test + @DisplayName("copies the second element if there are only two") public void testOverCopiesTheSecondElementIfThereAreOnlyTwo() { assertThat(forthEvaluator.evaluateProgram(Collections.singletonList("1 2 over"))) .containsExactly(1, 2, 1); @@ -260,6 +296,7 @@ public void testOverCopiesTheSecondElementIfThereAreOnlyTwo() { @Disabled("Remove to run test") @Test + @DisplayName("copies the second element if there are more than two") public void testOverCopiesTheSecondElementIfThereAreMoreThanTwo() { assertThat(forthEvaluator.evaluateProgram(Collections.singletonList("1 2 3 over"))) .containsExactly(1, 2, 3, 2); @@ -267,6 +304,7 @@ public void testOverCopiesTheSecondElementIfThereAreMoreThanTwo() { @Disabled("Remove to run test") @Test + @DisplayName("errors if there is nothing on the stack") public void testErrorIfOveringAttemptedWithNothingOnTheStack() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> forthEvaluator.evaluateProgram(Collections.singletonList("over"))) @@ -275,6 +313,7 @@ public void testErrorIfOveringAttemptedWithNothingOnTheStack() { @Disabled("Remove to run test") @Test + @DisplayName("errors if there is only one value on the stack") public void testErrorIfOveringAttemptedWithOneNumberOnTheStack() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> forthEvaluator.evaluateProgram(Collections.singletonList("1 over"))) @@ -283,6 +322,7 @@ public void testErrorIfOveringAttemptedWithOneNumberOnTheStack() { @Disabled("Remove to run test") @Test + @DisplayName("can consist of built-in words") public void testUserDefinedOperatorsCanConsistOfBuiltInOperators() { assertThat(forthEvaluator.evaluateProgram(Arrays.asList(": dup-twice dup dup ;", "1 dup-twice"))) .containsExactly(1, 1, 1); @@ -290,6 +330,7 @@ public void testUserDefinedOperatorsCanConsistOfBuiltInOperators() { @Disabled("Remove to run test") @Test + @DisplayName("execute in the right order") public void testUserDefinedOperatorsAreEvaluatedInTheCorrectOrder() { assertThat(forthEvaluator.evaluateProgram(Arrays.asList(": countup 1 2 3 ;", "countup"))) .containsExactly(1, 2, 3); @@ -297,6 +338,7 @@ public void testUserDefinedOperatorsAreEvaluatedInTheCorrectOrder() { @Disabled("Remove to run test") @Test + @DisplayName("can override other user-defined words") public void testCanRedefineAUserDefinedOperator() { assertThat(forthEvaluator.evaluateProgram(Arrays.asList(": foo dup ;", ": foo dup dup ;", "1 foo"))) .containsExactly(1, 1, 1); @@ -304,6 +346,7 @@ public void testCanRedefineAUserDefinedOperator() { @Disabled("Remove to run test") @Test + @DisplayName("can override built-in words") public void testCanOverrideBuiltInWordOperators() { assertThat(forthEvaluator.evaluateProgram(Arrays.asList(": swap dup ;", "1 swap"))) .containsExactly(1, 1); @@ -311,6 +354,7 @@ public void testCanOverrideBuiltInWordOperators() { @Disabled("Remove to run test") @Test + @DisplayName("can override built-in operators") public void testCanOverrideBuiltInArithmeticOperators() { assertThat(forthEvaluator.evaluateProgram(Arrays.asList(": + * ;", "3 4 +"))) .containsExactly(12); @@ -318,6 +362,7 @@ public void testCanOverrideBuiltInArithmeticOperators() { @Disabled("Remove to run test") @Test + @DisplayName("can use different words with the same name") public void testCanUseDifferentWordsWithTheSameName() { assertThat(forthEvaluator.evaluateProgram(Arrays.asList(": foo 5 ;", ": bar foo ;", ": foo 6 ;", "bar foo"))) .containsExactly(5, 6); @@ -325,6 +370,7 @@ public void testCanUseDifferentWordsWithTheSameName() { @Disabled("Remove to run test") @Test + @DisplayName("can define word that uses word with the same name") public void testCanDefineWordThatUsesWordWithTheSameName() { assertThat(forthEvaluator.evaluateProgram(Arrays.asList(": foo 10 ;", ": foo foo 1 + ;", "foo"))) .containsExactly(11); @@ -332,6 +378,7 @@ public void testCanDefineWordThatUsesWordWithTheSameName() { @Disabled("Remove to run test") @Test + @DisplayName("cannot redefine non-negative numbers") public void testCannotRedefineNonNegativeNumbers() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> forthEvaluator.evaluateProgram(Collections.singletonList(": 1 2 ;"))) @@ -340,6 +387,7 @@ public void testCannotRedefineNonNegativeNumbers() { @Disabled("Remove to run test") @Test + @DisplayName("cannot redefine negative numbers") public void testCannotRedefineNegativeNumbers() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> forthEvaluator.evaluateProgram(Collections.singletonList(": -1 2 ;"))) @@ -348,6 +396,7 @@ public void testCannotRedefineNegativeNumbers() { @Disabled("Remove to run test") @Test + @DisplayName("errors if executing a non-existent word") public void testErrorIfEvaluatingAnUndefinedOperator() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> forthEvaluator.evaluateProgram(Collections.singletonList("foo"))) @@ -356,6 +405,7 @@ public void testErrorIfEvaluatingAnUndefinedOperator() { @Disabled("Remove to run test") @Test + @DisplayName("DUP is case-insensitive") public void testDupIsCaseInsensitive() { assertThat(forthEvaluator.evaluateProgram(Collections.singletonList("1 DUP Dup dup"))) .containsExactly(1, 1, 1, 1); @@ -363,6 +413,7 @@ public void testDupIsCaseInsensitive() { @Disabled("Remove to run test") @Test + @DisplayName("DROP is case-insensitive") public void testDropIsCaseInsensitive() { assertThat(forthEvaluator.evaluateProgram(Collections.singletonList("1 2 3 4 DROP Drop drop"))) .containsExactly(1); @@ -370,6 +421,7 @@ public void testDropIsCaseInsensitive() { @Disabled("Remove to run test") @Test + @DisplayName("SWAP is case-insensitive") public void testSwapIsCaseInsensitive() { assertThat(forthEvaluator.evaluateProgram(Collections.singletonList("1 2 SWAP 3 Swap 4 swap"))) .containsExactly(2, 3, 4, 1); @@ -377,6 +429,7 @@ public void testSwapIsCaseInsensitive() { @Disabled("Remove to run test") @Test + @DisplayName("OVER is case-insensitive") public void testOverIsCaseInsensitive() { assertThat(forthEvaluator.evaluateProgram(Collections.singletonList("1 2 OVER Over over"))) .containsExactly(1, 2, 1, 2, 1); @@ -384,6 +437,7 @@ public void testOverIsCaseInsensitive() { @Disabled("Remove to run test") @Test + @DisplayName("user-defined words are case-insensitive") public void testUserDefinedWordsAreCaseInsensitive() { assertThat(forthEvaluator.evaluateProgram(Arrays.asList(": foo dup ;", "1 FOO Foo foo"))) .containsExactly(1, 1, 1, 1); @@ -391,6 +445,7 @@ public void testUserDefinedWordsAreCaseInsensitive() { @Disabled("Remove to run test") @Test + @DisplayName("definitions are case-insensitive") public void testDefinitionsAreCaseInsensitive() { assertThat(forthEvaluator.evaluateProgram(Arrays.asList(": SWAP DUP Dup dup ;", "1 swap"))) .containsExactly(1, 1, 1, 1); @@ -398,6 +453,7 @@ public void testDefinitionsAreCaseInsensitive() { @Disabled @Test + @DisplayName("only defines locally") public void testDefinitionsAreOnlyDefinedLocally() { ForthEvaluator firstInstance = new ForthEvaluator(); ForthEvaluator secondInstance = new ForthEvaluator();