Skip to content

Add bench tests as pos tests #9136

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 11, 2020
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
Expand Up @@ -33,6 +33,7 @@ class BootstrappedOnlyCompilationTests extends ParallelTesting {
@Test def posMacros: Unit = {
implicit val testGroup: TestGroup = TestGroup("compilePosMacros")
aggregateTests(
compileFilesInDir("tests/bench", defaultOptions),
compileFilesInDir("tests/pos-macros", defaultOptions),
compileFilesInDir("tests/pos-custom-args/semanticdb", defaultOptions.and("-Ysemanticdb")),
).checkCompile()
Expand Down
1 change: 1 addition & 0 deletions tests/bench/empty-class.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
class Foo
Empty file added tests/bench/empty-file.scala
Empty file.
1 change: 1 addition & 0 deletions tests/bench/empty-object.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
object Foo
68 changes: 68 additions & 0 deletions tests/bench/exhaustivity-I.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
abstract sealed trait C
case object C1 extends C
case object C2 extends C
case object C3 extends C
case object C4 extends C
case object C5 extends C
case object C6 extends C
case object C7 extends C
case object C8 extends C
case object C9 extends C
case object C10 extends C
case object C11 extends C
case object C12 extends C
case object C13 extends C
case object C14 extends C
case object C15 extends C
case object C16 extends C
case object C17 extends C
case object C18 extends C
case object C19 extends C
case object C20 extends C
case object C21 extends C
case object C22 extends C
case object C23 extends C
case object C24 extends C
case object C25 extends C
case object C26 extends C
case object C27 extends C
case object C28 extends C
case object C29 extends C
case object C30 extends C

object Test {

def test(c: C): Int = c match {
case C1 => 1
case C2 => 2
case C3 => 3
case C4 => 4
case C5 => 5
case C6 => 6
case C7 => 7
case C8 => 8
case C9 => 9
case C10 => 10
case C11 => 11
case C12 => 12
case C13 => 13
case C14 => 14
case C15 => 15
case C16 => 16
case C17 => 17
case C18 => 18
case C19 => 19
case C20 => 20
case C21 => 21
case C22 => 22
case C23 => 23
case C24 => 24
case C25 => 25
case C26 => 26
case C27 => 27
case C28 => 28
case C29 => 29
case C30 => 30

}
}
20 changes: 20 additions & 0 deletions tests/bench/exhaustivity-S.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

sealed trait O
object A extends O
object B extends O

object Test {

def test(x: O) =
(x, x, x, x, x, x, x, x, x, x, x, x, x, x) match {
case (A, A, _, _, _, _, _, _, _, _, _, _, _, _) => 1
case (_, _, A, A, _, _, _, _, _, _, _, _, _, _) => 2
case (_, _, _, _, A, A, _, _, _, _, _, _, _, _) => 3
case (_, _, _, _, _, _, A, A, _, _, _, _, _, _) => 4
case (_, _, _, _, _, _, _, _, A, A, _, _, _, _) => 5
case (_, _, _, _, _, _, _, _, _, _, A, A, _, _) => 6
case (_, _, _, _, _, _, _, _, _, _, _, _, A, A) => 7
case (B, A, B, A, B, A, B, A, B, A, B, A, B, A) => 8

}
}
28 changes: 28 additions & 0 deletions tests/bench/exhaustivity-T.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

sealed trait O
object A extends O
object B extends O

object Test {

def test(x: O) =
(x, x, x, x, x, x, x, x) match {
case (A, A, A, A, A, A, A, A) => 1
case (B, B, B, B, B, B, B, B) => 2
case (_, A, A, A, A, A, A, A) => 3
case (_, B, B, B, B, B, B, B) => 4
case (_, _, A, A, A, A, A, A) => 5
case (_, _, B, B, B, B, B, B) => 6
case (_, _, _, A, A, A, A, A) => 7
case (_, _, _, B, B, B, B, B) => 8
case (_, _, _, _, A, A, A, A) => 9
case (_, _, _, _, B, B, B, B) => 10
case (_, _, _, _, _, A, A, A) => 11
case (_, _, _, _, _, B, B, B) => 12
case (_, _, _, _, _, _, A, A) => 13
case (_, _, _, _, _, _, B, B) => 14
case (_, _, _, _, _, _, _, A) => 15
case (_, _, _, _, _, _, _, B) => 16

}
}
18 changes: 18 additions & 0 deletions tests/bench/exhaustivity-V.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

sealed trait O
object A extends O
object B extends O

object Test {

def test(x: O) =
(x, x, x, x, x, x, x, x, x, x, x, x, x, x, x) match {
case (A, A, A, A, A, _, _, _, _, _, _, _, _, _, _) => 1
case (B, _, _, _, _, A, A, A, A, _, _, _, _, _, _) => 2
case (_, B, _, _, _, B, _, _, _, A, A, A, _, _, _) => 3
case (_, _, B, _, _, _, B, _, _, B, _, _, A, A, _) => 4
case (_, _, _, B, _, _, _, B, _, _, B, _, B, _, A) => 5
case (_, _, _, _, B, _, _, _, B, _, _, B, _, B, B) => 6

}
}
9 changes: 9 additions & 0 deletions tests/bench/i1535.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
object Example {
case class C[H, T](h: H, t: T)

type I = Int

val p
: C[I,C[I,C[I,C[I,C[I,C[I,C[I,C[I,C[I,C[I,C[I,C[I,C[I,C[I,C[I,C[I,C[I,C[I,C[I,C[I,C[I,C[I,C[I,I]]]]]]]]]]]]]]]]]]]]]]]
= C(1,C(1,C(1,C(1,C(1,C(1,C(1,C(1,C(1,C(1,C(1,C(1,C(1,C(1,C(1,C(1,C(1,C(1,C(1,C(1,C(1,C(1,C(1,1)))))))))))))))))))))))
}
10 changes: 10 additions & 0 deletions tests/bench/i1687.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
object O {
def f: String = {
"1" + 1 + "1" + 1 +
"1" + 1 + "1" + 1 +
"1" + 1 + "1" + 1 +
"1" + 1 + "1" + 1 +
"1" + 1 + "1" + 1 +
"1" + 1 + "1" + 1
}
}
17 changes: 17 additions & 0 deletions tests/bench/implicit-scope-loop.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
trait Dummy[T]


trait A[T] extends B
trait B extends Dummy[A[Int]]
object B {
implicit def theB: B = new B {}
implicit def theA: A[Int] = new A[Int] {}
}

object Test {
def getB(implicit b: B) = b
def getA[T](implicit a: A[T]) = a

getB
getA
}
Loading