Skip to content

Commit

Permalink
test: clean tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Flashky committed Dec 7, 2024
1 parent 7909e77 commit d6b903e
Show file tree
Hide file tree
Showing 28 changed files with 104 additions and 534 deletions.
Original file line number Diff line number Diff line change
@@ -1,23 +1,7 @@
package com.adventofcode.flashk.common.test.utils;

import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;

public abstract class PuzzleTest {

private Timer timer = new Timer();

@BeforeEach
public void before() {
timer.start();
}

@AfterEach
public void after() {
timer.stop();
}


public abstract void testSolvePart1Sample();
public abstract void testSolvePart1Input();
public abstract void testSolvePart2Sample();
Expand Down

This file was deleted.

38 changes: 0 additions & 38 deletions src/test/java/com/adventofcode/flashk/common/test/utils/Timer.java

This file was deleted.

21 changes: 2 additions & 19 deletions src/test/java/com/adventofcode/flashk/day01/Day01Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

import java.util.List;

import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.MethodOrderer.OrderAnnotation;
import org.junit.jupiter.api.Order;
Expand All @@ -16,7 +14,6 @@
import com.adventofcode.flashk.common.test.constants.TestFolder;
import com.adventofcode.flashk.common.test.constants.TestTag;
import com.adventofcode.flashk.common.test.utils.PuzzleTest;
import com.adventofcode.flashk.common.test.utils.Timer;
import com.adventofcode.flashk.common.test.utils.Input;

import static org.junit.jupiter.api.Assertions.assertEquals;
Expand All @@ -25,23 +22,15 @@
@TestMethodOrder(OrderAnnotation.class)
public class Day01Test extends PuzzleTest {

private final static String INPUT_FOLDER = TestFolder.DAY_01;

@BeforeAll
public static void beforeAll() {
Timer.printHeader(TestDisplayName.DAY_01);
}

private static final String INPUT_FOLDER = TestFolder.DAY_01;

@Test
@Order(1)
@Tag(TestTag.PART_ONE)
@Tag(TestTag.SAMPLE)
@DisplayName(TestDisplayName.PART_ONE_SAMPLE)
public void testSolvePart1Sample() {

System.out.print("1 | sample | ");


// Read input file
List<String> inputs = Input.readStringLines(INPUT_FOLDER, TestFilename.INPUT_FILE_SAMPLE);

Expand All @@ -57,8 +46,6 @@ public void testSolvePart1Sample() {
@DisplayName(TestDisplayName.PART_ONE_INPUT)
public void testSolvePart1Input() {

System.out.print("1 | input | ");

// Read input file
List<String> inputs = Input.readStringLines(INPUT_FOLDER, TestFilename.INPUT_FILE);
HistorianHysteria historianHysteria = new HistorianHysteria(inputs);
Expand All @@ -74,8 +61,6 @@ public void testSolvePart1Input() {
@DisplayName(TestDisplayName.PART_TWO_SAMPLE)
public void testSolvePart2Sample() {

System.out.print("2 | sample | ");

// Read input file
List<String> inputs = Input.readStringLines(INPUT_FOLDER, TestFilename.INPUT_FILE_SAMPLE);

Expand All @@ -91,8 +76,6 @@ public void testSolvePart2Sample() {
@DisplayName(TestDisplayName.PART_TWO_INPUT)
public void testSolvePart2Input() {

System.out.print("2 | input | ");

// Read input file
List<String> inputs = Input.readStringLines(INPUT_FOLDER, TestFilename.INPUT_FILE);

Expand Down
27 changes: 6 additions & 21 deletions src/test/java/com/adventofcode/flashk/day02/Day02Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

import java.util.List;

import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.MethodOrderer.OrderAnnotation;
import org.junit.jupiter.api.Order;
Expand All @@ -16,7 +14,7 @@
import com.adventofcode.flashk.common.test.constants.TestFolder;
import com.adventofcode.flashk.common.test.constants.TestTag;
import com.adventofcode.flashk.common.test.utils.PuzzleTest;
import com.adventofcode.flashk.common.test.utils.Timer;

import com.adventofcode.flashk.common.test.utils.Input;

import static org.junit.jupiter.api.Assertions.assertEquals;
Expand All @@ -25,12 +23,7 @@
@TestMethodOrder(OrderAnnotation.class)
public class Day02Test extends PuzzleTest {

private final static String INPUT_FOLDER = TestFolder.DAY_02;

@BeforeAll
public static void beforeAll() {
Timer.printHeader(TestDisplayName.DAY_02);
}
private static final String INPUT_FOLDER = TestFolder.DAY_02;


@Test
Expand All @@ -39,9 +32,7 @@ public static void beforeAll() {
@Tag(TestTag.SAMPLE)
@DisplayName(TestDisplayName.PART_ONE_SAMPLE)
public void testSolvePart1Sample() {

System.out.print("1 | sample | ");


// Read input file
List<String> inputs = Input.readStringLines(INPUT_FOLDER, TestFilename.INPUT_FILE_SAMPLE);

Expand All @@ -55,9 +46,7 @@ public void testSolvePart1Sample() {
@Tag(TestTag.INPUT)
@DisplayName(TestDisplayName.PART_ONE_INPUT)
public void testSolvePart1Input() {

System.out.print("1 | input | ");


// Read input file
List<String> inputs = Input.readStringLines(INPUT_FOLDER, TestFilename.INPUT_FILE);
RedNosedReports reports = new RedNosedReports(inputs);
Expand All @@ -72,9 +61,7 @@ public void testSolvePart1Input() {
@Tag(TestTag.SAMPLE)
@DisplayName(TestDisplayName.PART_TWO_SAMPLE)
public void testSolvePart2Sample() {

System.out.print("2 | sample | ");


// Read input file
List<String> inputs = Input.readStringLines(INPUT_FOLDER, TestFilename.INPUT_FILE_SAMPLE);
RedNosedReports reports = new RedNosedReports(inputs);
Expand All @@ -88,9 +75,7 @@ public void testSolvePart2Sample() {
@Tag(TestTag.INPUT)
@DisplayName(TestDisplayName.PART_TWO_INPUT)
public void testSolvePart2Input() {

System.out.print("2 | input | ");


// Read input file
List<String> inputs = Input.readStringLines(INPUT_FOLDER, TestFilename.INPUT_FILE);
RedNosedReports reports = new RedNosedReports(inputs);
Expand Down
18 changes: 4 additions & 14 deletions src/test/java/com/adventofcode/flashk/day03/Day03Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ class Day03Test extends PuzzleTest {
@Tag(TestTag.SAMPLE)
@DisplayName(TestDisplayName.PART_ONE_SAMPLE)
public void testSolvePart1Sample() {

System.out.print("1 | sample | ");


// Read input file
List<String> inputs = Input.readStringLines(INPUT_FOLDER, TestFilename.INPUT_FILE_SAMPLE);

Expand All @@ -48,9 +46,7 @@ public void testSolvePart1Sample() {
@Tag(TestTag.INPUT)
@DisplayName(TestDisplayName.PART_ONE_INPUT)
public void testSolvePart1Input() {

System.out.print("1 | input | ");


// Read input file
List<String> inputs = Input.readStringLines(INPUT_FOLDER, TestFilename.INPUT_FILE);
MullItOver mullItOver = new MullItOver(inputs);
Expand All @@ -67,8 +63,6 @@ public void testSolvePart1Input() {
@DisplayName(TestDisplayName.PART_TWO_DEBUG)
void testSolvePart2InputByLines() {

System.out.print("1 | input | ");

// Read input file
List<String> inputs = Input.readStringLines(INPUT_FOLDER, TestFilename.INPUT_FILE);

Expand All @@ -85,9 +79,7 @@ void testSolvePart2InputByLines() {
@Tag(TestTag.SAMPLE)
@DisplayName(TestDisplayName.PART_TWO_SAMPLE)
public void testSolvePart2Sample() {

System.out.print("2 | sample | ");


// Read input file
List<String> inputs = Input.readStringLines(INPUT_FOLDER, INPUT_FILE_SAMPLE_PART_2);
MullItOver mullItOver = new MullItOver(inputs);
Expand All @@ -101,9 +93,7 @@ public void testSolvePart2Sample() {
@Tag(TestTag.INPUT)
@DisplayName(TestDisplayName.PART_TWO_INPUT)
public void testSolvePart2Input() {

System.out.print("2 | input | ");


// Read input file
List<String> inputs = Input.readStringLines(INPUT_FOLDER, TestFilename.INPUT_FILE);
MullItOver mullItOver = new MullItOver(inputs);
Expand Down
29 changes: 5 additions & 24 deletions src/test/java/com/adventofcode/flashk/day04/Day04Test.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package com.adventofcode.flashk.day04;

import java.util.List;

import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.MethodOrderer.OrderAnnotation;
import org.junit.jupiter.api.Order;
Expand All @@ -16,7 +12,6 @@
import com.adventofcode.flashk.common.test.constants.TestFolder;
import com.adventofcode.flashk.common.test.constants.TestTag;
import com.adventofcode.flashk.common.test.utils.PuzzleTest;
import com.adventofcode.flashk.common.test.utils.Timer;
import com.adventofcode.flashk.common.test.utils.Input;

import static org.junit.jupiter.api.Assertions.assertEquals;
Expand All @@ -25,23 +20,15 @@
@TestMethodOrder(OrderAnnotation.class)
public class Day04Test extends PuzzleTest {

private final static String INPUT_FOLDER = TestFolder.DAY_04;

@BeforeAll
public static void beforeAll() {
Timer.printHeader(TestDisplayName.DAY_04);
}
private static final String INPUT_FOLDER = TestFolder.DAY_04;


@Test
@Order(1)
@Tag(TestTag.PART_ONE)
@Tag(TestTag.SAMPLE)
@DisplayName(TestDisplayName.PART_ONE_SAMPLE)
public void testSolvePart1Sample() {

System.out.print("1 | sample | ");


// Read input file
char[][] inputs = Input.read2DCharArray(INPUT_FOLDER, TestFilename.INPUT_FILE_SAMPLE);
CeresSearch ceresSearch = new CeresSearch(inputs);
Expand All @@ -55,9 +42,7 @@ public void testSolvePart1Sample() {
@Tag(TestTag.INPUT)
@DisplayName(TestDisplayName.PART_ONE_INPUT)
public void testSolvePart1Input() {

System.out.print("1 | input | ");


// Read input file
char[][] inputs = Input.read2DCharArray(INPUT_FOLDER, TestFilename.INPUT_FILE);
CeresSearch ceresSearch = new CeresSearch(inputs);
Expand All @@ -72,9 +57,7 @@ public void testSolvePart1Input() {
@Tag(TestTag.SAMPLE)
@DisplayName(TestDisplayName.PART_TWO_SAMPLE)
public void testSolvePart2Sample() {

System.out.print("2 | sample | ");


// Read input file
char[][] inputs = Input.read2DCharArray(INPUT_FOLDER, TestFilename.INPUT_FILE_SAMPLE);
CeresSearch ceresSearch = new CeresSearch(inputs);
Expand All @@ -88,9 +71,7 @@ public void testSolvePart2Sample() {
@Tag(TestTag.INPUT)
@DisplayName(TestDisplayName.PART_TWO_INPUT)
public void testSolvePart2Input() {

System.out.print("2 | input | ");


// Read input file
char[][] inputs = Input.read2DCharArray(INPUT_FOLDER, TestFilename.INPUT_FILE);
CeresSearch ceresSearch = new CeresSearch(inputs);
Expand Down
Loading

0 comments on commit d6b903e

Please sign in to comment.