File: t6197.scala

package info (click to toggle)
scala 2.11.12-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 62,924 kB
  • sloc: javascript: 28,808; java: 13,415; xml: 3,135; sh: 1,620; python: 756; makefile: 38; awk: 36; ansic: 6
file content (21 lines) | stat: -rw-r--r-- 884 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import scala.collection.immutable._

object Test extends App {

  // test that a HashTrieSet with one leaf element is not created!
  val x = HashSet.empty + 1 + 2
  if(x.getClass.getSimpleName != "HashTrieSet")
    println("A hash set containing two non-colliding values should be a HashTrieSet")

  val y = x - 1
  if(y.getClass.getSimpleName != "HashSet1")
    println("A hash set containing one element should always use HashSet1")

  // it is pretty hard to test that the case where a HashTrieSet has one element which
  // is itself of type HashTrieS t. That is because the improve hash function makes it very difficult
  // to find keys that will have hashes that are close together.
  //
  // However, it is also not necessary. Removing the ability of a HashTrieSet to have
  // one child of type HashTrieSet completely breaks the HashSet, so that many other
  // tests fail
}