Skip to content
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -14,6 +15,7 @@ public void setUp() {
}

@Test
@DisplayName("no rows")
public void testInputWithNoRowsContainsNoRectangles() {
String[] inputGrid = new String[]{};

Expand All @@ -22,6 +24,7 @@ public void testInputWithNoRowsContainsNoRectangles() {

@Disabled("Remove to run test")
@Test
@DisplayName("no columns")
public void testInputWithNoColumnsContainsNoRectangles() {
String[] inputGrid = new String[]{""};

Expand All @@ -30,6 +33,7 @@ public void testInputWithNoColumnsContainsNoRectangles() {

@Disabled("Remove to run test")
@Test
@DisplayName("no rectangles")
public void testNonTrivialInputWithNoRectangles() {
String[] inputGrid = new String[]{" "};

Expand All @@ -38,6 +42,7 @@ public void testNonTrivialInputWithNoRectangles() {

@Disabled("Remove to run test")
@Test
@DisplayName("one rectangle")
public void testInputWithOneRectangle() {
String[] inputGrid = new String[]{
"+-+",
Expand All @@ -50,6 +55,7 @@ public void testInputWithOneRectangle() {

@Disabled("Remove to run test")
@Test
@DisplayName("two rectangles without shared parts")
public void testInputWithTwoRectanglesWithoutSharedEdges() {
String[] inputGrid = new String[]{
" +-+",
Expand All @@ -64,6 +70,7 @@ public void testInputWithTwoRectanglesWithoutSharedEdges() {

@Disabled("Remove to run test")
@Test
@DisplayName("five rectangles with shared parts")
public void testInputWithFiveRectanglesWithSharedEdges() {
String[] inputGrid = new String[]{
" +-+",
Expand All @@ -78,6 +85,7 @@ public void testInputWithFiveRectanglesWithSharedEdges() {

@Disabled("Remove to run test")
@Test
@DisplayName("rectangle of height 1 is counted")
public void testThatRectangleOfHeightOneIsCounted() {
String[] inputGrid = new String[]{
"+--+",
Expand All @@ -89,6 +97,7 @@ public void testThatRectangleOfHeightOneIsCounted() {

@Disabled("Remove to run test")
@Test
@DisplayName("rectangle of width 1 is counted")
public void testThatRectangleOfWidthOneIsCounted() {
String[] inputGrid = new String[]{
"++",
Expand All @@ -101,6 +110,7 @@ public void testThatRectangleOfWidthOneIsCounted() {

@Disabled("Remove to run test")
@Test
@DisplayName("1x1 square is counted")
public void testThatOneByOneSquareIsCounted() {
String[] inputGrid = new String[]{
"++",
Expand All @@ -112,6 +122,7 @@ public void testThatOneByOneSquareIsCounted() {

@Disabled("Remove to run test")
@Test
@DisplayName("only complete rectangles are counted")
public void testThatIncompleteRectanglesAreNotCounted() {
String[] inputGrid = new String[]{
" +-+",
Expand All @@ -126,6 +137,7 @@ public void testThatIncompleteRectanglesAreNotCounted() {

@Disabled("Remove to run test")
@Test
@DisplayName("rectangles can be of different sizes")
public void testThatRectanglesOfDifferentSizesAreAllCounted() {
String[] inputGrid = new String[]{
"+------+----+",
Expand All @@ -140,6 +152,7 @@ public void testThatRectanglesOfDifferentSizesAreAllCounted() {

@Disabled("Remove to run test")
@Test
@DisplayName("corner is required for a rectangle to be complete")
public void testThatIntersectionsWithoutCornerCharacterDoNotCountAsRectangleCorners() {
String[] inputGrid = new String[]{
"+------+----+",
Expand All @@ -154,6 +167,7 @@ public void testThatIntersectionsWithoutCornerCharacterDoNotCountAsRectangleCorn

@Disabled("Remove to run test")
@Test
@DisplayName("large input with many rectangles")
public void testLargeInputWithManyRectangles() {
String[] inputGrid = new String[]{
"+---+--+----+",
Expand All @@ -171,6 +185,7 @@ public void testLargeInputWithManyRectangles() {

@Disabled("Remove to run test")
@Test
@DisplayName("rectangles must have four sides")
public void testRectanglesMustHaveFourSides() {
String[] inputGrid = new String[]{
"+-+ +-+",
Expand Down
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;


Expand All @@ -12,6 +13,7 @@
public class RelativeDistanceTest {

@Test
@DisplayName("Direct parent-child relation")
public void testDirectParentChildRelation() {
Map<String, List<String>> familyTree = new HashMap<>() {
{
Expand All @@ -26,6 +28,7 @@ public void testDirectParentChildRelation() {

@Disabled("Remove to run test")
@Test
@DisplayName("Sibling relationship")
public void testSiblingRelationship() {
Map<String, List<String>> familyTree = new HashMap<>() {
{
Expand All @@ -39,6 +42,7 @@ public void testSiblingRelationship() {

@Disabled("Remove to run test")
@Test
@DisplayName("Two degrees of separation, grandchild")
public void testTwoDegreesOfSeparationGrandchild() {
Map<String, List<String>> familyTree = new HashMap<>() {
{
Expand All @@ -53,6 +57,7 @@ public void testTwoDegreesOfSeparationGrandchild() {

@Disabled("Remove to run test")
@Test
@DisplayName("Unrelated individuals")
public void testUnrelatedIndividuals() {
Map<String, List<String>> familyTree = new HashMap<>() {
{
Expand All @@ -67,6 +72,7 @@ public void testUnrelatedIndividuals() {

@Disabled("Remove to run test")
@Test
@DisplayName("Complex graph, cousins")
public void testComplexGraphCousins() {
Map<String, List<String>> familyTree = new HashMap<>() {
{
Expand Down Expand Up @@ -131,6 +137,7 @@ public void testComplexGraphCousins() {

@Disabled("Remove to run test")
@Test
@DisplayName("Complex graph, no shortcut, far removed nephew")
public void testComplexGraphNoShortcutFarRemovedNephew() {
Map<String, List<String>> familyTree = new HashMap<>() {
{
Expand Down Expand Up @@ -194,6 +201,10 @@ public void testComplexGraphNoShortcutFarRemovedNephew() {

@Disabled("Remove to run test")
@Test
@DisplayName(
"Complex graph, some shortcuts, cross-down and cross-up, " +
"cousins several times removed, with unrelated family tree"
)
public void testComplexGraphSomeShortcutsCrossDownAndCrossUpCousinsSeveralTimesRemovedWithUnrelatedFamilyTree() {
Map<String, List<String>> familyTree = new HashMap<>() {
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import org.junit.jupiter.api.BeforeEach;
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.assertThat;

Expand All @@ -13,6 +14,7 @@ public void setup() {
}

@Test
@DisplayName("Brown and black")
public void testBrownAndBlack() {
assertThat(
resistorColorDuo.value(new String[]{"brown", "black"})
Expand All @@ -21,6 +23,7 @@ public void testBrownAndBlack() {

@Disabled("Remove to run test")
@Test
@DisplayName("Blue and grey")
public void testBlueAndGrey() {
assertThat(
resistorColorDuo.value(new String[]{ "blue", "grey" })
Expand All @@ -29,6 +32,7 @@ public void testBlueAndGrey() {

@Disabled("Remove to run test")
@Test
@DisplayName("Yellow and violet")
public void testYellowAndViolet() {
assertThat(
resistorColorDuo.value(new String[]{ "yellow", "violet" })
Expand All @@ -37,6 +41,7 @@ public void testYellowAndViolet() {

@Disabled("Remove to run test")
@Test
@DisplayName("Orange and orange")
public void testOrangeAndOrange() {
assertThat(
resistorColorDuo.value(new String[]{ "orange", "orange" })
Expand All @@ -45,6 +50,7 @@ public void testOrangeAndOrange() {

@Disabled("Remove to run test")
@Test
@DisplayName("White and red")
public void testWhiteAndRed() {
assertThat(
resistorColorDuo.value(new String[]{ "white", "red" })
Expand All @@ -53,6 +59,7 @@ public void testWhiteAndRed() {

@Disabled("Remove to run test")
@Test
@DisplayName("Black and brown, one-digit")
public void testBlackAndBrownOneDigit() {
assertThat(
resistorColorDuo.value(new String[]{ "black", "brown" })
Expand All @@ -61,6 +68,7 @@ public void testBlackAndBrownOneDigit() {

@Disabled("Remove to run test")
@Test
@DisplayName("Ignore additional colors")
public void testIgnoreAdditionalColors() {
assertThat(
resistorColorDuo.value(new String[]{ "green", "brown", "orange" })
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import org.junit.jupiter.api.BeforeEach;
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.assertThat;

Expand All @@ -13,6 +14,7 @@ public void setup() {
}

@Test
@DisplayName("Orange and orange and black")
public void testOrangeAndOrangeAndBlack() {
assertThat(
resistorColorTrio.label(new String[]{"orange", "orange", "black"})
Expand All @@ -21,6 +23,7 @@ public void testOrangeAndOrangeAndBlack() {

@Disabled("Remove to run test")
@Test
@DisplayName("Blue and grey and brown")
public void testBlueAndGreyAndBrown() {
assertThat(
resistorColorTrio.label(new String[]{"blue", "grey", "brown"})
Expand All @@ -29,6 +32,7 @@ public void testBlueAndGreyAndBrown() {

@Disabled("Remove to run test")
@Test
@DisplayName("Red and black and red")
public void testRedAndBlackAndRed() {
assertThat(
resistorColorTrio.label(new String[]{"red", "black", "red"})
Expand All @@ -37,6 +41,7 @@ public void testRedAndBlackAndRed() {

@Disabled("Remove to run test")
@Test
@DisplayName("Green and brown and orange")
public void testGreenAndBrownAndOrange() {
assertThat(
resistorColorTrio.label(new String[]{"green", "brown", "orange"})
Expand All @@ -45,6 +50,7 @@ public void testGreenAndBrownAndOrange() {

@Disabled("Remove to run test")
@Test
@DisplayName("Yellow and violet and yellow")
public void testYellowAndVioletAndYellow() {
assertThat(
resistorColorTrio.label(new String[]{"yellow", "violet", "yellow"})
Expand All @@ -53,6 +59,7 @@ public void testYellowAndVioletAndYellow() {

@Disabled("Remove to run test")
@Test
@DisplayName("Blue and violet and blue")
public void testBlueAndVioletAndBlue() {
assertThat(
resistorColorTrio.label(new String[]{"blue", "violet", "blue"})
Expand All @@ -61,6 +68,7 @@ public void testBlueAndVioletAndBlue() {

@Disabled("Remove to run test")
@Test
@DisplayName("Minimum possible value")
public void testBlackAndBlackAndBlack() {
assertThat(
resistorColorTrio.label(new String[]{"black", "black", "black"})
Expand All @@ -69,6 +77,7 @@ public void testBlackAndBlackAndBlack() {

@Disabled("Remove to run test")
@Test
@DisplayName("Maximum possible value")
public void testWhiteAndWhiteAndWhite() {
assertThat(
resistorColorTrio.label(new String[]{"white", "white", "white"})
Expand All @@ -77,6 +86,7 @@ public void testWhiteAndWhiteAndWhite() {

@Disabled("Remove to run test")
@Test
@DisplayName("First two colors make an invalid octal number")
public void testFirstTwoColorsMakeAnInvalidOctalNumber() {
assertThat(
resistorColorTrio.label(new String[]{"black", "grey", "black"})
Expand All @@ -85,6 +95,7 @@ public void testFirstTwoColorsMakeAnInvalidOctalNumber() {

@Disabled("Remove to run test")
@Test
@DisplayName("Ignore extra colors")
public void testIgnoreExtraColors() {
assertThat(
resistorColorTrio.label(new String[]{"blue", "green", "yellow", "orange"})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import org.junit.jupiter.api.BeforeEach;
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.assertThat;

public class ResistorColorTest {
Expand All @@ -13,24 +14,28 @@ public void setup() {
}

@Test
@DisplayName("Black")
public void testBlackColorCode() {
assertThat(resistorColor.colorCode("black")).isEqualTo(0);
}

@Disabled("Remove to run test")
@Test
@DisplayName("white")
public void testWhiteColorCode() {
assertThat(resistorColor.colorCode("white")).isEqualTo(9);
}

@Disabled("Remove to run test")
@Test
@DisplayName("Orange")
public void testOrangeColorCode() {
assertThat(resistorColor.colorCode("orange")).isEqualTo(3);
}

@Disabled("Remove to run test")
@Test
@DisplayName("Colors")
public void testColors() {
assertThat(resistorColor.colors()).containsExactly(
"black", "brown", "red", "orange", "yellow", "green", "blue", "violet", "grey", "white"
Expand Down
Loading