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
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 static org.assertj.core.api.Assertions.assertThat;
Expand All @@ -24,6 +25,7 @@ private void assertComplexNumbersEqual(ComplexNumber c1, ComplexNumber c2) {
// Tests

@Test
@DisplayName("Real part of a purely real number")
public void testRealPartOfPurelyRealNumber() {
double expected = 1.0;
double actual = new ComplexNumber(1.0, 0).getReal();
Expand All @@ -32,6 +34,7 @@ public void testRealPartOfPurelyRealNumber() {

@Disabled("Remove to run test")
@Test
@DisplayName("Real part of a purely imaginary number")
public void testRealPartOfPurelyImaginaryNumber() {
double expected = 0.0;
double actual = new ComplexNumber(0, 1.0).getReal();
Expand All @@ -40,6 +43,7 @@ public void testRealPartOfPurelyImaginaryNumber() {

@Disabled("Remove to run test")
@Test
@DisplayName("Real part of a number with real and imaginary part")
public void testRealPartOfNumberWithRealAndImaginaryParts() {
double expected = 1.0;
double actual = new ComplexNumber(1.0, 2.0).getReal();
Expand All @@ -48,6 +52,7 @@ public void testRealPartOfNumberWithRealAndImaginaryParts() {

@Disabled("Remove to run test")
@Test
@DisplayName("Imaginary part of a purely real number")
public void testImaginaryPartOfPurelyRealNumber() {
double expected = 0.0;
double actual = new ComplexNumber(1.0, 0).getImaginary();
Expand All @@ -56,6 +61,7 @@ public void testImaginaryPartOfPurelyRealNumber() {

@Disabled("Remove to run test")
@Test
@DisplayName("Imaginary part of a purely imaginary number")
public void testImaginaryPartOfPurelyImaginaryNumber() {
double expected = 1.0;
double actual = new ComplexNumber(0, 1.0).getImaginary();
Expand All @@ -64,6 +70,7 @@ public void testImaginaryPartOfPurelyImaginaryNumber() {

@Disabled("Remove to run test")
@Test
@DisplayName("Imaginary part of a number with real and imaginary part")
public void testImaginaryPartOfNumberWithRealAndImaginaryParts() {
double expected = 2.0;
double actual = new ComplexNumber(1.0, 2.0).getImaginary();
Expand All @@ -72,6 +79,7 @@ public void testImaginaryPartOfNumberWithRealAndImaginaryParts() {

@Disabled("Remove to run test")
@Test
@DisplayName("Imaginary unit")
public void testImaginaryUnitExhibitsDefiningProperty() {
ComplexNumber expected = new ComplexNumber(-1.0, 0);
ComplexNumber actual = new ComplexNumber(0, 1.0).multiply(new ComplexNumber(0, 1.0));
Expand All @@ -80,6 +88,7 @@ public void testImaginaryUnitExhibitsDefiningProperty() {

@Disabled("Remove to run test")
@Test
@DisplayName("Add purely real numbers")
public void testAdditionWithPurelyRealNumbers() {
ComplexNumber expected = new ComplexNumber(3.0, 0);
ComplexNumber actual = new ComplexNumber(1.0, 0).add(new ComplexNumber(2.0, 0));
Expand All @@ -88,6 +97,7 @@ public void testAdditionWithPurelyRealNumbers() {

@Disabled("Remove to run test")
@Test
@DisplayName("Add purely imaginary numbers")
public void testAdditionWithPurelyImaginaryNumbers() {
ComplexNumber expected = new ComplexNumber(0, 3.0);
ComplexNumber actual = new ComplexNumber(0, 1.0).add(new ComplexNumber(0, 2.0));
Expand All @@ -96,6 +106,7 @@ public void testAdditionWithPurelyImaginaryNumbers() {

@Disabled("Remove to run test")
@Test
@DisplayName("Add numbers with real and imaginary part")
public void testAdditionWithRealAndImaginaryParts() {
ComplexNumber expected = new ComplexNumber(4.0, 6.0);
ComplexNumber actual = new ComplexNumber(1.0, 2.0).add(new ComplexNumber(3.0, 4.0));
Expand All @@ -104,6 +115,7 @@ public void testAdditionWithRealAndImaginaryParts() {

@Disabled("Remove to run test")
@Test
@DisplayName("Subtract purely real numbers")
public void testSubtractionWithPurelyRealNumbers() {
ComplexNumber expected = new ComplexNumber(-1.0, 0.0);
ComplexNumber actual = new ComplexNumber(1.0, 0.0).subtract(new ComplexNumber(2.0, 0.0));
Expand All @@ -112,6 +124,7 @@ public void testSubtractionWithPurelyRealNumbers() {

@Disabled("Remove to run test")
@Test
@DisplayName("Subtract purely imaginary numbers")
public void testSubtractionWithPurelyImaginaryNumbers() {
ComplexNumber expected = new ComplexNumber(0, -1.0);
ComplexNumber actual = new ComplexNumber(0, 1.0).subtract(new ComplexNumber(0, 2.0));
Expand All @@ -120,6 +133,7 @@ public void testSubtractionWithPurelyImaginaryNumbers() {

@Disabled("Remove to run test")
@Test
@DisplayName("Subtract numbers with real and imaginary part")
public void testSubtractionWithRealAndImaginaryParts() {
ComplexNumber expected = new ComplexNumber(-2.0, -2.0);
ComplexNumber actual = new ComplexNumber(1.0, 2.0).subtract(new ComplexNumber(3.0, 4.0));
Expand All @@ -128,6 +142,7 @@ public void testSubtractionWithRealAndImaginaryParts() {

@Disabled("Remove to run test")
@Test
@DisplayName("Multiply purely real numbers")
public void testMultiplicationWithPurelyRealNumbers() {
ComplexNumber expected = new ComplexNumber(2.0, 0);
ComplexNumber actual = new ComplexNumber(1.0, 0).multiply(new ComplexNumber(2.0, 0));
Expand All @@ -136,6 +151,7 @@ public void testMultiplicationWithPurelyRealNumbers() {

@Disabled("Remove to run test")
@Test
@DisplayName("Multiply purely imaginary numbers")
public void testMultiplicationWithPurelyImaginaryNumbers() {
ComplexNumber expected = new ComplexNumber(-2.0, 0);
ComplexNumber actual = new ComplexNumber(0, 1.0).multiply(new ComplexNumber(0, 2.0));
Expand All @@ -144,6 +160,7 @@ public void testMultiplicationWithPurelyImaginaryNumbers() {

@Disabled("Remove to run test")
@Test
@DisplayName("Multiply numbers with real and imaginary part")
public void testMultiplicationWithRealAndImaginaryParts() {
ComplexNumber expected = new ComplexNumber(-5.0, 10.0);
ComplexNumber actual = new ComplexNumber(1.0, 2.0).multiply(new ComplexNumber(3.0, 4.0));
Expand All @@ -152,6 +169,7 @@ public void testMultiplicationWithRealAndImaginaryParts() {

@Disabled("Remove to run test")
@Test
@DisplayName("Divide purely real numbers")
public void testDivisionWithPurelyRealNumbers() {
ComplexNumber expected = new ComplexNumber(0.5, 0);
ComplexNumber actual = new ComplexNumber(1.0, 0).divide(new ComplexNumber(2.0, 0));
Expand All @@ -160,6 +178,7 @@ public void testDivisionWithPurelyRealNumbers() {

@Disabled("Remove to run test")
@Test
@DisplayName("Divide purely imaginary numbers")
public void testDivisionWithPurelyImaginaryNumbers() {
ComplexNumber expected = new ComplexNumber(0.5, 0);
ComplexNumber actual = new ComplexNumber(0, 1.0).divide(new ComplexNumber(0, 2.0));
Expand All @@ -168,6 +187,7 @@ public void testDivisionWithPurelyImaginaryNumbers() {

@Disabled("Remove to run test")
@Test
@DisplayName("Divide numbers with real and imaginary part")
public void testDivisionWithRealAndImaginaryParts() {
ComplexNumber expected = new ComplexNumber(0.44, 0.08);
ComplexNumber actual = new ComplexNumber(1.0, 2.0).divide(new ComplexNumber(3.0, 4.0));
Expand All @@ -176,6 +196,7 @@ public void testDivisionWithRealAndImaginaryParts() {

@Disabled("Remove to run test")
@Test
@DisplayName("Absolute value of a positive purely real number")
public void testAbsoluteValueOfPositivePurelyRealNumber() {
double expected = 5.0;
double actual = new ComplexNumber(5.0, 0).abs();
Expand All @@ -184,6 +205,7 @@ public void testAbsoluteValueOfPositivePurelyRealNumber() {

@Disabled("Remove to run test")
@Test
@DisplayName("Absolute value of a negative purely real number")
public void testAbsoluteValueOfNegativePurelyRealNumber() {
double expected = 5.0;
double actual = new ComplexNumber(-5.0, 0).abs();
Expand All @@ -192,6 +214,7 @@ public void testAbsoluteValueOfNegativePurelyRealNumber() {

@Disabled("Remove to run test")
@Test
@DisplayName("Absolute value of a purely imaginary number with positive imaginary part")
public void testAbsoluteValueOfPurelyImaginaryNumberWithPositiveImaginaryPart() {
double expected = 5.0;
double actual = new ComplexNumber(0, 5.0).abs();
Expand All @@ -200,6 +223,7 @@ public void testAbsoluteValueOfPurelyImaginaryNumberWithPositiveImaginaryPart()

@Disabled("Remove to run test")
@Test
@DisplayName("Absolute value of a purely imaginary number with negative imaginary part")
public void testAbsoluteValueOfPurelyImaginaryNumberWithNegativeImaginaryPart() {
double expected = 5.0;
double actual = new ComplexNumber(0, -5.0).abs();
Expand All @@ -208,6 +232,7 @@ public void testAbsoluteValueOfPurelyImaginaryNumberWithNegativeImaginaryPart()

@Disabled("Remove to run test")
@Test
@DisplayName("Absolute value of a number with real and imaginary part")
public void testAbsoluteValueOfNumberWithRealAndImaginaryParts() {
double expected = 5.0;
double actual = new ComplexNumber(3.0, 4.0).abs();
Expand All @@ -216,6 +241,7 @@ public void testAbsoluteValueOfNumberWithRealAndImaginaryParts() {

@Disabled("Remove to run test")
@Test
@DisplayName("Conjugate a purely real number")
public void testConjugationOfPurelyRealNumber() {
ComplexNumber expected = new ComplexNumber(5.0, 0);
ComplexNumber actual = new ComplexNumber(5.0, 0).conjugate();
Expand All @@ -224,6 +250,7 @@ public void testConjugationOfPurelyRealNumber() {

@Disabled("Remove to run test")
@Test
@DisplayName("Conjugate a purely imaginary number")
public void testConjugationOfPurelyImaginaryNumber() {
ComplexNumber expected = new ComplexNumber(0, -5.0);
ComplexNumber actual = new ComplexNumber(0, 5.0).conjugate();
Expand All @@ -232,6 +259,7 @@ public void testConjugationOfPurelyImaginaryNumber() {

@Disabled("Remove to run test")
@Test
@DisplayName("Conjugate a number with real and imaginary part")
public void testConjugationOfNumberWithRealAndImaginaryParts() {
ComplexNumber expected = new ComplexNumber(1.0, -1.0);
ComplexNumber actual = new ComplexNumber(1.0, 1.0).conjugate();
Expand All @@ -240,6 +268,7 @@ public void testConjugationOfNumberWithRealAndImaginaryParts() {

@Disabled("Remove to run test")
@Test
@DisplayName("Euler's identity/formula")
public void testExponentialOfPurelyImaginaryNumber() {
ComplexNumber expected = new ComplexNumber(-1.0, 0);
ComplexNumber actual = new ComplexNumber(0, Math.PI).exponentialOf();
Expand All @@ -248,6 +277,7 @@ public void testExponentialOfPurelyImaginaryNumber() {

@Disabled("Remove to run test")
@Test
@DisplayName("Exponential of 0")
public void testExponentialOfZero() {
ComplexNumber expected = new ComplexNumber(1.0, 0);
ComplexNumber actual = new ComplexNumber(0, 0).exponentialOf();
Expand All @@ -256,6 +286,7 @@ public void testExponentialOfZero() {

@Disabled("Remove to run test")
@Test
@DisplayName("Exponential of a purely real number")
public void testExponentialOfPurelyRealNumber() {
ComplexNumber expected = new ComplexNumber(Math.E, 0);
ComplexNumber actual = new ComplexNumber(1.0, 0).exponentialOf();
Expand All @@ -264,6 +295,7 @@ public void testExponentialOfPurelyRealNumber() {

@Disabled("Remove to run test")
@Test
@DisplayName("Exponential resulting in a number with real and imaginary part")
public void testExponentialOfNumberWithRealAndImaginaryParts() {
ComplexNumber expected = new ComplexNumber(1, 1);
ComplexNumber actual = new ComplexNumber(Math.log(2.0) / 2, Math.PI / 4).exponentialOf();
Expand Down
11 changes: 11 additions & 0 deletions exercises/practice/connect/src/test/java/ConnectTest.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
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 ConnectTest {

@Test
@DisplayName("an empty board has no winner")
public void anEmptyBoardHasNoWinner() {

//GIVEN
Expand All @@ -27,6 +29,7 @@ public void anEmptyBoardHasNoWinner() {

@Disabled("Remove to run test")
@Test
@DisplayName("X can win on a 1x1 board")
public void xCanWinOnA1x1Board() {

//GIVEN
Expand All @@ -45,6 +48,7 @@ public void xCanWinOnA1x1Board() {

@Disabled("Remove to run test")
@Test
@DisplayName("O can win on a 1x1 board")
public void oCanWinOnA1x1Board() {

//GIVEN
Expand All @@ -63,6 +67,7 @@ public void oCanWinOnA1x1Board() {

@Disabled("Remove to run test")
@Test
@DisplayName("only edges does not make a winner")
public void onlyEdgesDoesNotMakeAWinner() {

//GIVEN
Expand All @@ -84,6 +89,7 @@ public void onlyEdgesDoesNotMakeAWinner() {

@Disabled("Remove to run test")
@Test
@DisplayName("illegal diagonal does not make a winner")
public void illegalDiagonalDoesNotMakeAWinner() {

//GIVEN
Expand All @@ -106,6 +112,7 @@ public void illegalDiagonalDoesNotMakeAWinner() {

@Disabled("Remove to run test")
@Test
@DisplayName("nobody wins crossing adjacent angles")
public void nobodyWinsCrossingAdjacentAngles() {

//GIVEN
Expand All @@ -128,6 +135,7 @@ public void nobodyWinsCrossingAdjacentAngles() {

@Disabled("Remove to run test")
@Test
@DisplayName("X wins crossing from left to right")
public void xWinsCrossingFromLeftToRight() {

//GIVEN
Expand All @@ -150,6 +158,7 @@ public void xWinsCrossingFromLeftToRight() {

@Disabled("Remove to run test")
@Test
@DisplayName("O wins crossing from top to bottom")
public void oWinsCrossingFromTopToBottom() {

//GIVEN
Expand All @@ -172,6 +181,7 @@ public void oWinsCrossingFromTopToBottom() {

@Disabled("Remove to run test")
@Test
@DisplayName("X wins using a convoluted path")
public void xWinsUsingConvolutedPath() {

//GIVEN
Expand All @@ -194,6 +204,7 @@ public void xWinsUsingConvolutedPath() {

@Disabled("Remove to run test")
@Test
@DisplayName("X wins using a spiral path")
public void xWinsUsingASpiralPath() {

//GIVEN
Expand Down
Loading