1
exercism fetch scala say

src/test/scala/SayTest.scala

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import org.scalatest.{Matchers, FunSuite}

/** @version 1.0.0 */
class SayTest extends FunSuite with Matchers {
  
  test("zero") {
    Say.inEnglish(0) should be (Some("zero"))
  }

  test("one") {
    pending
    Say.inEnglish(1) should be (Some("one"))
  }

  test("fourteen") {
    pending
    Say.inEnglish(14) should be (Some("fourteen"))
  }

  test("twenty") {
    pending
    Say.inEnglish(20) should be (Some("twenty"))
  }

  test("twenty-two") {
    pending
    Say.inEnglish(22) should be (Some("twenty-two"))
  }

  test("one hundred") {
    pending
    Say.inEnglish(100) should be (Some("one hundred"))
  }

  test("one hundred twenty-three") {
    pending
    Say.inEnglish(123) should be (Some("one hundred twenty-three"))
  }

  test("one thousand") {
    pending
    Say.inEnglish(1000) should be (Some("one thousand"))
  }

  test("one thousand two hundred thirty-four") {
    pending
    Say.inEnglish(1234) should be (Some("one thousand two hundred thirty-four"))
  }

  test("one million") {
    pending
    Say.inEnglish(1000000) should be (Some("one million"))
  }

  test("one million two thousand three hundred forty-five") {
    pending
    Say.inEnglish(1002345) should be (Some("one million two thousand three hundred forty-five"))
  }

  test("one billion") {
    pending
    Say.inEnglish(1000000000) should be (Some("one billion"))
  }

  test("a big number") {
    pending
    Say.inEnglish(987654321123l) should
      be (Some("nine hundred eighty-seven billion six hundred fifty-four million three hundred twenty-one thousand one hundred twenty-three"))
  }

  test("numbers below zero are out of range") {
    pending
    Say.inEnglish(-1) should be (None)
  }

  test("numbers above 999,999,999,999 are out of range") {
    pending
    Say.inEnglish(1000000000000l) should be (None)
  }
}