summaryrefslogblamecommitdiff
path: root/test/files/run/t6292.scala
blob: 51e31f95fc2f19628ab113b2c9c44e80fcd14785 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

















                                                                                
 import scala.collection.mutable.DoubleLinkedList

object Test {
  def main(args: Array[String]): Unit = {
    cloneAndtest(DoubleLinkedList[Int]())
    cloneAndtest(DoubleLinkedList[Int](1))
    cloneAndtest(DoubleLinkedList[Int](1,2,3,4))
  }

  def cloneAndtest(l: DoubleLinkedList[Int]): Unit =
    testSame(l, l.clone.asInstanceOf[DoubleLinkedList[Int]])

  def testSame(one: DoubleLinkedList[Int], two: DoubleLinkedList[Int]): Unit = {
    def msg = s" for ${one} and ${two} !"
    assert(one.size == two.size, s"Cloned sizes are not the same $msg!")
    assert(one == two, s"Cloned lists are not equal $msg")
  }
}