-
-
Notifications
You must be signed in to change notification settings - Fork 59
/
lorem_test.go
66 lines (55 loc) · 1.15 KB
/
lorem_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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package faker
import (
"fmt"
"strings"
"testing"
)
func TestLorem(t *testing.T) {
l := New().Lorem()
Expect(t, "faker.Lorem", fmt.Sprintf("%T", l))
}
func TestWord(t *testing.T) {
l := New().Lorem()
Expect(t, true, len(l.Word()) > 0)
}
func TestWords(t *testing.T) {
l := New().Lorem()
Expect(t, 2, len(l.Words(2)))
}
func TestSentence(t *testing.T) {
l := New().Lorem()
split := strings.Split(l.Sentence(2), " ")
Expect(t, 2, len(split))
}
func TestSentences(t *testing.T) {
l := New().Lorem()
sentences := l.Sentences(2)
Expect(t, 2, len(sentences))
}
func TestParagraph(t *testing.T) {
l := New().Lorem()
split := strings.Split(l.Paragraph(2), ".")
Expect(t, 3, len(split))
}
func TestParagraphs(t *testing.T) {
l := New().Lorem()
split := l.Paragraphs(2)
Expect(t, 2, len(split))
}
func TestText(t *testing.T) {
l := New().Lorem()
text := l.Text(255)
Expect(t, true, len(text) <= 255)
}
func TestTextNotEmpty(t *testing.T) {
l := New().Lorem()
for i := 1; i < 255; i++ {
text := l.Text(i)
Expect(t, true, text != "")
}
}
func TestBytes(t *testing.T) {
l := New().Lorem()
text := l.Bytes(255)
Expect(t, true, len(text) <= 255)
}