Skip to content

Commit ef43b4c

Browse files
committed
Add tests on non empty tuples of unknown size
1 parent ea30001 commit ef43b4c

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed

tests/run-deep-subtype/Tuple-head.scala

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@ import scala.reflect.ClassTag
33
object Test {
44
def main(args: Array[String]): Unit = {
55

6+
def testArray[T: ClassTag](n: Int, elem: Int => T): Unit = {
7+
val t: Int *: Tuple = 0 *: Tuple.fromArray(Array.tabulate(n)(elem))
8+
assert(0 == t.head)
9+
}
10+
11+
for (i <- 0 to 25)
12+
testArray(i, j => j)
13+
614
assert(1 == Tuple1(1).head)
715
assert(1 == (1, 2).head)
816
assert(1 == (1, 2, 3).head)

tests/run-deep-subtype/Tuple-tail.check

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,30 @@
11
()
2+
(0)
3+
(0,1)
4+
(0,1,2)
5+
(0,1,2,3)
6+
(0,1,2,3,4)
7+
(0,1,2,3,4,5)
8+
(0,1,2,3,4,5,6)
9+
(0,1,2,3,4,5,6,7)
10+
(0,1,2,3,4,5,6,7,8)
11+
(0,1,2,3,4,5,6,7,8,9)
12+
(0,1,2,3,4,5,6,7,8,9,10)
13+
(0,1,2,3,4,5,6,7,8,9,10,11)
14+
(0,1,2,3,4,5,6,7,8,9,10,11,12)
15+
(0,1,2,3,4,5,6,7,8,9,10,11,12,13)
16+
(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14)
17+
(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15)
18+
(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16)
19+
(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17)
20+
(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18)
21+
(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19)
22+
(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20)
23+
(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21)
24+
(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22)
25+
(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23)
26+
(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24)
27+
()
228
(2)
329
(2,3)
430
(2,3,4)

tests/run-deep-subtype/Tuple-tail.scala

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@ import scala.reflect.ClassTag
33
object Test {
44
def main(args: Array[String]): Unit = {
55

6+
def testArray[T: ClassTag](n: Int, elem: Int => T): Unit = {
7+
val t: Int *: Tuple = 0 *: Tuple.fromArray(Array.tabulate(n)(elem))
8+
println(t.tail)
9+
}
10+
11+
for (i <- 0 to 25)
12+
testArray(i, j => j)
13+
614
println(Tuple1(1).tail)
715
println((1, 2).tail)
816
println((1, 2, 3).tail)

0 commit comments

Comments
 (0)