Skip to content
Merged
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
a0f584c
add displayname annotations to saddle-points
bibekparajuli123 Oct 4, 2025
0a098ef
add displayname annotations to satellite
bibekparajuli123 Oct 4, 2025
c048f85
add displayname annotations to say
bibekparajuli123 Oct 4, 2025
e6aacce
add displayname annotations to scrabble-score
bibekparajuli123 Oct 4, 2025
2a23ce1
add displayname annotations to secret-handshake
bibekparajuli123 Oct 4, 2025
73c8426
add displayname annotations to series
bibekparajuli123 Oct 4, 2025
0777959
add displayname annotations to sgf-parsing
bibekparajuli123 Oct 4, 2025
8ad1a07
add displayname annotations to sieve
bibekparajuli123 Oct 4, 2025
5e8cf64
add displayname annotations to simple-cipher
bibekparajuli123 Oct 4, 2025
261e102
add displayname annotations to space-age
bibekparajuli123 Oct 4, 2025
b3d2f42
add displayname annotations to spiral-matrix
bibekparajuli123 Oct 4, 2025
dffcd30
add displayname annotations to state-of-tic-tac-toe
bibekparajuli123 Oct 4, 2025
4070bda
add displayname annotations to saddle-points
bibekparajuli123 Oct 4, 2025
f2108c2
add displayname annotations to satellite
bibekparajuli123 Oct 4, 2025
aa07c52
add displayname annotations to say
bibekparajuli123 Oct 4, 2025
fea5f1c
add displayname annotations to scrabble-score
bibekparajuli123 Oct 4, 2025
26e78d8
add displayname annotations to secret-handshake
bibekparajuli123 Oct 4, 2025
34c29de
add displayname annotations to series
bibekparajuli123 Oct 4, 2025
330b39f
add displayname annotations to sgf-parsing
bibekparajuli123 Oct 4, 2025
bae3583
add displayname annotations to sieve
bibekparajuli123 Oct 4, 2025
9e9ac3a
add displayname annotations to simple-cipher
bibekparajuli123 Oct 4, 2025
55e2834
add displayname annotations to space-age
bibekparajuli123 Oct 4, 2025
2968323
add displayname annotations to spiral-matrix
bibekparajuli123 Oct 4, 2025
ec69d7e
add displayname annotations to state-of-tic-tac-toe
bibekparajuli123 Oct 4, 2025
6c55b7f
:wq
bibekparajuli123 Oct 7, 2025
0045faa
simple-cipher
bibekparajuli123 Oct 7, 2025
dc33076
say
bibekparajuli123 Oct 7, 2025
91e7110
Update exercises/practice/simple-cipher/src/test/java/SimpleCipherTes…
bibekparajuli123 Oct 7, 2025
13984bf
Apply suggestion from @jagdish-15
jagdish-15 Oct 7, 2025
bc73b1f
Apply suggestion from @jagdish-15
jagdish-15 Oct 7, 2025
f43812c
Apply suggestion from @jagdish-15
jagdish-15 Oct 7, 2025
49f5da8
Remove accidently added duplicate tests
jagdish-15 Oct 7, 2025
a1daed0
Removing leading spaces in empty lines
jagdish-15 Oct 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions exercises/practice/saddle-points/src/test/java/MatrixTest.java
Original file line number Diff line number Diff line change
@@ -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.ArrayList;
Expand All @@ -12,6 +13,7 @@
public class MatrixTest {

@Test
@DisplayName("Can identify single saddle point")
public void testCanIdentifySingleSaddlePoint() {
Matrix matrix = new Matrix(Arrays.asList(
Arrays.asList(9, 8, 7),
Expand All @@ -26,6 +28,7 @@ public void testCanIdentifySingleSaddlePoint() {

@Disabled("Remove to run test")
@Test
@DisplayName("Can identify that empty matrix has no saddle points")
public void testCanIdentifyThatEmptyMatrixHasNoSaddlePoints() {
Matrix matrix = new Matrix(new ArrayList<>());

Expand All @@ -36,6 +39,7 @@ public void testCanIdentifyThatEmptyMatrixHasNoSaddlePoints() {

@Disabled("Remove to run test")
@Test
@DisplayName("Can identify lack of saddle points when there are none")
public void testCanIdentifyLackOfSaddlePointsWhenThereAreNone() {
Matrix matrix = new Matrix(Arrays.asList(
Arrays.asList(1, 2, 3),
Expand All @@ -50,6 +54,7 @@ public void testCanIdentifyLackOfSaddlePointsWhenThereAreNone() {

@Disabled("Remove to run test")
@Test
@DisplayName("Can identify multiple saddle points in a column")
public void testCanIdentifyMultipleSaddlePointsInAColumn() {
Matrix matrix = new Matrix(Arrays.asList(
Arrays.asList(4, 5, 4),
Expand All @@ -68,6 +73,7 @@ public void testCanIdentifyMultipleSaddlePointsInAColumn() {

@Disabled("Remove to run test")
@Test
@DisplayName("Can identify multiple saddle points in a Row")
public void testCanIdentifyMultipleSaddlePointsInARow() {
Matrix matrix = new Matrix(Arrays.asList(
Arrays.asList(6, 7, 8),
Expand All @@ -86,6 +92,7 @@ public void testCanIdentifyMultipleSaddlePointsInARow() {

@Disabled("Remove to run test")
@Test
@DisplayName("Can identify saddle point in bottom right corner")
public void testCanIdentifySaddlePointInBottomRightCorner() {
Matrix matrix = new Matrix(Arrays.asList(
Arrays.asList(8, 7, 9),
Expand All @@ -100,6 +107,7 @@ public void testCanIdentifySaddlePointInBottomRightCorner() {

@Disabled("Remove to run test")
@Test
@DisplayName("Can identify saddle points in a non square matrix")
public void testCanIdentifySaddlePointsInANonSquareMatrix() {
Matrix matrix = new Matrix(Arrays.asList(
Arrays.asList(3, 1, 3),
Expand All @@ -116,6 +124,7 @@ public void testCanIdentifySaddlePointsInANonSquareMatrix() {

@Disabled("Remove to run test")
@Test
@DisplayName("Can identify that saddle points in a single column matrix are those with the minimum value")
public void testCanIdentifyThatSaddlePointsInASingleColumnMatrixAreThoseWithMinimumValue() {
Matrix matrix = new Matrix(Arrays.asList(
Collections.singletonList(2),
Expand All @@ -134,6 +143,7 @@ public void testCanIdentifyThatSaddlePointsInASingleColumnMatrixAreThoseWithMini

@Disabled("Remove to run test")
@Test
@DisplayName("Can identify that saddle points in a single row matrix are those with the maximum value")
public void testCanIdentifyThatSaddlePointsInASingleRowMatrixAreThoseWithMaximumValue() {
Matrix matrix = new Matrix(Arrays.asList(
Arrays.asList(2, 5, 3, 5)
Expand Down
7 changes: 7 additions & 0 deletions exercises/practice/satellite/src/test/java/SatelliteTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@

import java.util.List;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;

public class SatelliteTest {
Satellite satellite = new Satellite();

@Test
@DisplayName("Empty tree")
public void emptyTree() {
List<Character> preorder = List.of();
List<Character> inorder = List.of();
Expand All @@ -22,6 +24,7 @@ public void emptyTree() {

@Disabled("Remove to run test")
@Test
@DisplayName("Tree with one item")
public void treeWithOneItem() {
List<Character> preorder = List.of('a');
List<Character> inorder = List.of('a');
Expand All @@ -35,6 +38,7 @@ public void treeWithOneItem() {

@Disabled("Remove to run test")
@Test
@DisplayName("Tree with many items")
public void treeWithManyItems() {
List<Character> preorder = List.of('a', 'i', 'x', 'f', 'r');
List<Character> inorder = List.of('i', 'a', 'f', 'x', 'r');
Expand All @@ -48,6 +52,7 @@ public void treeWithManyItems() {

@Disabled("Remove to run test")
@Test
@DisplayName("Reject traversals of different length")
public void rejectTraversalsOfDifferentLengths() {
List<Character> preorder = List.of('a', 'b');
List<Character> inorder = List.of('b', 'a', 'r');
Expand All @@ -60,6 +65,7 @@ public void rejectTraversalsOfDifferentLengths() {

@Disabled("Remove to run test")
@Test
@DisplayName("Reject inconsistent traversals of same length")
public void rejectInconsistentTraversalsOfSameLength() {
List<Character> preorder = List.of('x', 'y', 'z');
List<Character> inorder = List.of('a', 'b', 'c');
Expand All @@ -71,6 +77,7 @@ public void rejectInconsistentTraversalsOfSameLength() {

@Disabled("Remove to run test")
@Test
@DisplayName("Reject traversals with repeated items")
public void rejectTraversalsWithRepeatedItems() {
List<Character> preorder = List.of('a', 'b', 'a');
List<Character> inorder = List.of('b', 'a', 'a');
Expand Down
22 changes: 21 additions & 1 deletion exercises/practice/say/src/test/java/SayTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import org.junit.jupiter.api.Test;
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.*;

Expand All @@ -8,102 +9,119 @@ public class SayTest {
private Say say = new Say();

@Test
@DisplayName("zero")
public void zero() {
assertThat(say.say(0)).isEqualTo("zero");
}

@Disabled("Remove to run test")
@Test
@DisplayName("one")
public void one() {
assertThat(say.say(1)).isEqualTo("one");
}

@Disabled("Remove to run test")
@Test
@DisplayName("fourteen")
public void fourteen() {
assertThat(say.say(14)).isEqualTo("fourteen");
}

@Disabled("Remove to run test")
@Test
@DisplayName("twenty")
public void twenty() {
assertThat(say.say(20)).isEqualTo("twenty");
}

@Disabled("Remove to run test")
@Test
@DisplayName("twenty-two")
public void twentyTwo() {
assertThat(say.say(22)).isEqualTo("twenty-two");
}

@Disabled("Remove to run test")
@Test
@DisplayName("thirty")
public void thirty() {
assertThat(say.say(30)).isEqualTo("thirty");
}

@Disabled("Remove to run test")
@Test
@DisplayName("ninety-nine")
public void ninetyNine() {
assertThat(say.say(99)).isEqualTo("ninety-nine");
}

@Disabled("Remove to run test")
@Test
@DisplayName("one hundred")
public void oneHundred() {
assertThat(say.say(100)).isEqualTo("one hundred");
}

@Disabled("Remove to run test")
@Test
@DisplayName("one hundred twenty-three")
public void oneHundredTwentyThree() {
assertThat(say.say(123)).isEqualTo("one hundred twenty-three");
}

@Disabled("Remove to run test")
@Test
@DisplayName("two hundred")
public void twoHundred() {
assertThat(say.say(200)).isEqualTo("two hundred");
}

@Disabled("Remove to run test")
@Test
@DisplayName("nine hundred ninety-nine")
public void nineHundredNinetyNine() {
assertThat(say.say(999)).isEqualTo("nine hundred ninety-nine");
}

@Disabled("Remove to run test")
@Test
@DisplayName("one thousand")
public void oneThousand() {
assertThat(say.say(1_000)).isEqualTo("one thousand");
}

@Disabled("Remove to run test")
@Test
@DisplayName("one thousand two hundred thirty-four")
public void oneThousandTwoHundredThirtyFour() {
assertThat(say.say(1_234)).isEqualTo("one thousand two hundred thirty-four");
}

@Disabled("Remove to run test")
@Test
@DisplayName("one million")
public void oneMillion() {
assertThat(say.say(1_000_000)).isEqualTo("one million");
}

@Disabled("Remove to run test")
@Test
@DisplayName("one million two thousand three hundred forty-five")
public void oneMillionTwoThousandThreeHundredFortyFive() {
assertThat(say.say(1_002_345)).isEqualTo("one million two thousand three hundred forty-five");
}

@Disabled("Remove to run test")
@Test
@DisplayName("one billion")
public void oneBillion() {
assertThat(say.say(1_000_000_000)).isEqualTo("one billion");
}

@Disabled("Remove to run test")
@Test
@DisplayName("a big number")
public void nineHundredEightySevenBillionSixHundredFiftyFourThreeHundredTwentyOneThousandOneHundredTwentyThree() {
assertThat(say.say(987_654_321_123L))
.isEqualTo("nine hundred eighty-seven billion six hundred fifty-four million" +
Expand All @@ -112,13 +130,15 @@ public void nineHundredEightySevenBillionSixHundredFiftyFourThreeHundredTwentyOn

@Disabled("Remove to run test")
@Test
@DisplayName("numbers below zero are out of range")
public void illegalNegativeNumber() {
assertThatExceptionOfType(IllegalArgumentException.class)
.isThrownBy(() -> say.say(-1));
}

@Disabled("Remove to run test")
@Test
@DisplayName("numbers above 999,999,999,999 are out of range")
public void illegalTooBigNumber() {
assertThatExceptionOfType(IllegalArgumentException.class)
.isThrownBy(() -> say.say(1_000_000_000_000L));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,81 +1,93 @@
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;

public class ScrabbleScoreTest {

@Test
@DisplayName("lowercase letter")
public void testALowerCaseLetter() {
Scrabble scrabble = new Scrabble("a");
assertThat(scrabble.getScore()).isEqualTo(1);
}

@Disabled("Remove to run test")
@Test
@DisplayName("uppercase letter")
public void testAUpperCaseLetter() {
Scrabble scrabble = new Scrabble("A");
assertThat(scrabble.getScore()).isEqualTo(1);
}

@Disabled("Remove to run test")
@Test
@DisplayName("valuable letter")
public void testAValuableLetter() {
Scrabble scrabble = new Scrabble("f");
assertThat(scrabble.getScore()).isEqualTo(4);
}

@Disabled("Remove to run test")
@Test
@DisplayName("short word")
public void testAShortWord() {
Scrabble scrabble = new Scrabble("at");
assertThat(scrabble.getScore()).isEqualTo(2);
}

@Disabled("Remove to run test")
@Test
@DisplayName("short, valuable word")
public void testAShortValuableWord() {
Scrabble scrabble = new Scrabble("zoo");
assertThat(scrabble.getScore()).isEqualTo(12);
}

@Disabled("Remove to run test")
@Test
@DisplayName("medium word")
public void testAMediumWord() {
Scrabble scrabble = new Scrabble("street");
assertThat(scrabble.getScore()).isEqualTo(6);
}

@Disabled("Remove to run test")
@Test
@DisplayName("medium, valuable word")
public void testAMediumValuableWord() {
Scrabble scrabble = new Scrabble("quirky");
assertThat(scrabble.getScore()).isEqualTo(22);
}

@Disabled("Remove to run test")
@Test
@DisplayName("long, mixed-case word")
public void testALongMixCaseWord() {
Scrabble scrabble = new Scrabble("OxyphenButazone");
assertThat(scrabble.getScore()).isEqualTo(41);
}

@Disabled("Remove to run test")
@Test
@DisplayName("english-like word")
public void testAEnglishLikeWord() {
Scrabble scrabble = new Scrabble("pinata");
assertThat(scrabble.getScore()).isEqualTo(8);
}

@Disabled("Remove to run test")
@Test
@DisplayName("empty input")
public void testAnEmptyInput() {
Scrabble scrabble = new Scrabble("");
assertThat(scrabble.getScore()).isEqualTo(0);
}

@Disabled("Remove to run test")
@Test
@DisplayName("entire alphabet available")
public void testEntireAlphabetAvailable() {
Scrabble scrabble = new Scrabble("abcdefghijklmnopqrstuvwxyz");
assertThat(scrabble.getScore()).isEqualTo(87);
Expand Down
Loading
Loading