Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions exercises/practice/flower-field/.meta/tests.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,6 @@ description = "cross"

[dd9d4ca8-9e68-4f78-a677-a2a70fd7a7b8]
description = "large garden"

[6e4ac13a-3e43-4728-a2e3-3551d4b1a996]
description = "multiple adjacent flowers"
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;

Expand All @@ -24,8 +23,8 @@ public void testInputBoardWithNoRowsAndNoColumns() {
@Test
@DisplayName("no columns")
public void testInputBoardWithOneRowAndNoColumns() {
List<String> inputBoard = Collections.singletonList("");
List<String> expectedNumberedBoard = Collections.singletonList("");
List<String> inputBoard = List.of("");
List<String> expectedNumberedBoard = List.of("");
List<String> actualNumberedBoard = new FlowerFieldBoard(inputBoard).withNumbers();

assertThat(actualNumberedBoard).isEqualTo(expectedNumberedBoard);
Expand All @@ -35,13 +34,13 @@ public void testInputBoardWithOneRowAndNoColumns() {
@Test
@DisplayName("no flowers")
public void testInputBoardWithNoFlowers() {
List<String> inputBoard = Arrays.asList(
List<String> inputBoard = List.of(
" ",
" ",
" "
);

List<String> expectedNumberedBoard = Arrays.asList(
List<String> expectedNumberedBoard = List.of(
" ",
" ",
" "
Expand All @@ -56,13 +55,13 @@ public void testInputBoardWithNoFlowers() {
@Test
@DisplayName("garden full of flowers")
public void testInputBoardWithOnlyFlowers() {
List<String> inputBoard = Arrays.asList(
List<String> inputBoard = List.of(
"***",
"***",
"***"
);

List<String> expectedNumberedBoard = Arrays.asList(
List<String> expectedNumberedBoard = List.of(
"***",
"***",
"***"
Expand All @@ -77,13 +76,13 @@ public void testInputBoardWithOnlyFlowers() {
@Test
@DisplayName("flower surrounded by spaces")
public void testInputBoardWithSingleFlowerAtCenter() {
List<String> inputBoard = Arrays.asList(
List<String> inputBoard = List.of(
" ",
" * ",
" "
);

List<String> expectedNumberedBoard = Arrays.asList(
List<String> expectedNumberedBoard = List.of(
"111",
"1*1",
"111"
Expand All @@ -98,13 +97,13 @@ public void testInputBoardWithSingleFlowerAtCenter() {
@Test
@DisplayName("space surrounded by flowers")
public void testInputBoardWithFlowersAroundPerimeter() {
List<String> inputBoard = Arrays.asList(
List<String> inputBoard = List.of(
"***",
"* *",
"***"
);

List<String> expectedNumberedBoard = Arrays.asList(
List<String> expectedNumberedBoard = List.of(
"***",
"*8*",
"***"
Expand All @@ -119,11 +118,11 @@ public void testInputBoardWithFlowersAroundPerimeter() {
@Test
@DisplayName("horizontal line")
public void testInputBoardWithSingleRowAndTwoFlowers() {
List<String> inputBoard = Collections.singletonList(
List<String> inputBoard = List.of(
" * * "
);

List<String> expectedNumberedBoard = Collections.singletonList(
List<String> expectedNumberedBoard = List.of(
"1*2*1"
);

Expand All @@ -136,11 +135,11 @@ public void testInputBoardWithSingleRowAndTwoFlowers() {
@Test
@DisplayName("horizontal line, flowers at edges")
public void testInputBoardWithSingleRowAndTwoFlowersAtEdges() {
List<String> inputBoard = Collections.singletonList(
List<String> inputBoard = List.of(
"* *"
);

List<String> expectedNumberedBoard = Collections.singletonList(
List<String> expectedNumberedBoard = List.of(
"*1 1*"
);

Expand All @@ -153,15 +152,15 @@ public void testInputBoardWithSingleRowAndTwoFlowersAtEdges() {
@Test
@DisplayName("vertical line")
public void testInputBoardWithSingleColumnAndTwoFlowers() {
List<String> inputBoard = Arrays.asList(
List<String> inputBoard = List.of(
" ",
"*",
" ",
"*",
" "
);

List<String> expectedNumberedBoard = Arrays.asList(
List<String> expectedNumberedBoard = List.of(
"1",
"*",
"2",
Expand All @@ -178,15 +177,15 @@ public void testInputBoardWithSingleColumnAndTwoFlowers() {
@Test
@DisplayName("vertical line, flowers at edges")
public void testInputBoardWithSingleColumnAndTwoFlowersAtEdges() {
List<String> inputBoard = Arrays.asList(
List<String> inputBoard = List.of(
"*",
" ",
" ",
" ",
"*"
);

List<String> expectedNumberedBoard = Arrays.asList(
List<String> expectedNumberedBoard = List.of(
"*",
"1",
" ",
Expand All @@ -203,15 +202,15 @@ public void testInputBoardWithSingleColumnAndTwoFlowersAtEdges() {
@Test
@DisplayName("cross")
public void testInputBoardWithFlowersInCross() {
List<String> inputBoard = Arrays.asList(
List<String> inputBoard = List.of(
" * ",
" * ",
"*****",
" * ",
" * "
);

List<String> expectedNumberedBoard = Arrays.asList(
List<String> expectedNumberedBoard = List.of(
" 2*2 ",
"25*52",
"*****",
Expand All @@ -228,7 +227,7 @@ public void testInputBoardWithFlowersInCross() {
@Test
@DisplayName("large garden")
public void testLargeInputBoard() {
List<String> inputBoard = Arrays.asList(
List<String> inputBoard = List.of(
" * * ",
" * ",
" * ",
Expand All @@ -237,7 +236,7 @@ public void testLargeInputBoard() {
" "
);

List<String> expectedNumberedBoard = Arrays.asList(
List<String> expectedNumberedBoard = List.of(
"1*22*1",
"12*322",
" 123*2",
Expand All @@ -251,4 +250,20 @@ public void testLargeInputBoard() {
assertThat(actualNumberedBoard).isEqualTo(expectedNumberedBoard);
}

@Disabled("Remove to run test")
@Test
@DisplayName("multiple adjacent flowers")
public void testMultipleAdjacentFlowers() {
List<String> inputBoard = List.of(
" ** "
);

List<String> expectedNumberedBoard = List.of(
"1**1"
);

List<String> actualNumberedBoard = new FlowerFieldBoard(inputBoard).withNumbers();

assertThat(actualNumberedBoard).isEqualTo(expectedNumberedBoard);
}
}