-
Notifications
You must be signed in to change notification settings - Fork 0
/
builder_test.go
51 lines (46 loc) · 1.25 KB
/
builder_test.go
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
package textlength
import "testing"
func TestBuild1000(t *testing.T) {
expected := "one thousand"
items, err := BuildItems(1000)
if err != nil {
t.Error(err)
}
if items[len(items)-1].Text != expected {
t.Errorf("Value: %v Expected: %v", items[len(items)-1].Text, expected)
}
}
func TestBuild10000(t *testing.T) {
expected := "ten thousand"
items, err := BuildItems(10000)
if err != nil {
t.Error(err)
}
if items[len(items)-1].Text != expected {
t.Errorf("Value: %v Expected: %v", items[len(items)-1].Text, expected)
}
}
func TestHello(t *testing.T) {
expected := "Hello. This text is fifty-two characters in length."
text := "Hello."
items, err := BuildItems(10000)
if err != nil {
t.Error(err)
}
text_with_length := ProcessText(text, items)
if expected != text_with_length {
t.Errorf("Value: %v Expected: %v", text_with_length, expected)
}
}
func TestHelloIsItMe(t *testing.T) {
expected := "Hello. Is it me you're looking for? This text is eighty-four characters in length."
text := "Hello. Is it me you're looking for?"
items, err := BuildItems(10000)
if err != nil {
t.Error(err)
}
text_with_length := ProcessText(text, items)
if expected != text_with_length {
t.Errorf("Value: %v Expected: %v", text_with_length, expected)
}
}