8000 Add custom scalatest naming with year in suite name · sim642/adventofcode@6f4b2c7 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6f4b2c7

Browse files
committed
Add custom scalatest naming with year in suite name
1 parent dc2f3f6 commit 6f4b2c7

35 files changed

+79
-34
lines changed
Lines changed: 11 additions & 0 deletions
9E19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package eu.sim642
2+
3+
import org.scalatest.Suite
4+
5+
trait AdventOfCodeSuite { thisSuite: Suite =>
6+
private val classNameRegex = """eu\.sim642\.adventofcode(\d+)\.Day(\d+)Test""".r
7+
8+
override def suiteName: String = thisSuite.getClass.getName match {
9+
case classNameRegex(year, day) => s"$year day $day"
10+
}
11+
}

src/test/scala/eu/sim642/adventofcode2017/Day10Test.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
package eu.sim642.adventofcode2017
22

33
import Day10._
4+
import eu.sim642.AdventOfCodeSuite
45
import org.scalatest.FunSuite
56
import org.scalatest.prop.PropertyChecks
67

7-
class Day10Test extends FunSuite with PropertyChecks {
8+
class Day10Test extends FunSuite with PropertyChecks with AdventOfCodeSuite {
89

910
val exampleInitialState = KnotState(Vector(0, 1, 2, 3, 4))
1011

src/test/scala/eu/sim642/adventofcode2017/Day11Test.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
package eu.sim642.adventofcode2017
22

33
import Day11._
4+
import eu.sim642.AdventOfCodeSuite
45
import org.scalatest.FunSuite
56
import org.scalatest.prop.PropertyChecks
67

7-
class Day11Test extends FunSuite with PropertyChecks {
8+
class Day11Test extends FunSuite with PropertyChecks with AdventOfCodeSuite {
89

910
test("Part 1 examples") {
1011
val inputSteps = Table(

src/test/scala/eu/sim642/adventofcode2017/Day12Test.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
package eu.sim642.adventofcode2017
22

33
import Day12._
4+
import eu.sim642.AdventOfCodeSuite
45
import org.scalatest.FunSuite
56

6-
class Day12Test extends FunSuite {
7+
class Day12Test extends FunSuite with AdventOfCodeSuite {
78

89
val exampleInput = """0 <-> 2
910
|1 <-> 1

src/test/scala/eu/sim642/adventofcode2017/Day13Test.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
package eu.sim642.adventofcode2017
22

33
import Day13._
4+
import eu.sim642.AdventOfCodeSuite
45
import org.scalatest.FunSuite
56
import org.scalatest.prop.PropertyChecks
67

7-
class Day13Test extends FunSuite with PropertyChecks {
8+
class Day13Test extends FunSuite with PropertyChecks with AdventOfCodeSuite {
89

910
val exampleRanges = Map(0 -> 3, 1 -> 2, 4 -> 4, 6 -> 4)
1011

src/test/scala/eu/sim642/adventofcode2017/Day14Test.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
package eu.sim642.adventofcode2017
22

33
import Day14._
4+
import eu.sim642.AdventOfCodeSuite
45
import org.scalatest.FunSuite
56

6-
class Day14Test extends FunSuite {
7+
class Day14Test extends FunSuite with AdventOfCodeSuite {
78

89
test("Part 1 example") {
910
assert(squaresUsed("flqrgnkx") == 8108)

src/test/scala/eu/sim642/adventofcode2017/Day15Test.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
package eu.sim642.adventofcode2017
22

33
import Day15._
4+
import eu.sim642.AdventOfCodeSuite
45
import org.scalatest.FunSuite
56
import org.scalatest.prop.PropertyChecks
67

7-
class Day15Test extends FunSuite with PropertyChecks {
8+
class Day15Test extends FunSuite with PropertyChecks with AdventOfCodeSuite {
89

910
test("Part 1 example generators") {
1011
val genA = Part1.generatorA(65)

src/test/scala/eu/sim642/adventofcode2017/Day16Test.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
package eu.sim642.adventofcode2017
22

33
import Day16._
4+
import eu.sim642.AdventOfCodeSuite
45
import org.scalatest.FunSuite
56
import org.scalatest.prop.PropertyChecks
67

7-
class Day16Test extends FunSuite with PropertyChecks {
8+
class Day16Test extends FunSuite with PropertyChecks with AdventOfCodeSuite {
89

910
test("parseMove") {
1011
assert(parseMove("s3") == Spin(3))

src/test/scala/eu/sim642/adventofcode2017/Day17Test.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
package eu.sim642.adventofcode2017
22

33
import Day17._
4+
import eu.sim642.AdventOfCodeSuite
45
import org.scalatest.FunSuite
56
import org.scalatest.prop.PropertyChecks
67

7-
class Day17Test extends FunSuite with PropertyChecks {
8+
class Day17Test extends FunSuite with PropertyChecks with AdventOfCodeSuite {
89

910
test("Part 1 example states") {
1011
import Part1._

src/test/scala/eu/sim642/adventofcode2017/Day18Test.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
package eu.sim642.adventofcode2017
22

33
import Day18._
4+
import eu.sim642.AdventOfCodeSuite
45
import org.scalatest.FunSuite
56
import org.scalatest.prop.PropertyChecks
67

78
import scala.collection.immutable.Queue
89

9-
class Day18Test extends FunSuite with PropertyChecks {
10+
class Day18Test extends FunSuite with PropertyChecks with AdventOfCodeSuite {
1011

1112
val exampleInput1 = """set a 1
1213
|add a 2

0 commit comments

Comments
 (0)
0