-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathquran_test.go
56 lines (44 loc) · 1.15 KB
/
quran_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
package quranize
import (
"testing"
"github.com/stretchr/testify/assert"
)
func testNewQuran(t *testing.T, q Quran) {
expected := 114
actual := len(q.Suras)
assert.Equal(t, expected, actual)
}
func TestNewQuranSimpleClean(t *testing.T) {
testNewQuran(t, NewQuranSimpleClean())
}
func TestNewQuranSimpleEnhanced(t *testing.T) {
testNewQuran(t, NewQuranSimpleEnhanced())
}
func TestNewIDIndonesian(t *testing.T) {
testNewQuran(t, NewIDIndonesian())
}
func TestNewIDMuntakhab(t *testing.T) {
testNewQuran(t, NewIDMuntakhab())
}
func TestGetAyaFound(t *testing.T) {
text, err := NewQuranSimpleClean().GetAya(1, 1)
assert.NoError(t, err)
assert.NotEmpty(t, text)
}
func TestGetAyaSuraNotFound(t *testing.T) {
_, err := NewQuranSimpleClean().GetAya(0, 0)
assert.Error(t, err)
}
func TestGetAyaAyaNotFound(t *testing.T) {
_, err := NewQuranSimpleClean().GetAya(1, 0)
assert.Error(t, err)
}
func TestGetSuraNameFound(t *testing.T) {
text, err := NewQuranSimpleClean().GetSuraName(1)
assert.NoError(t, err)
assert.NotEmpty(t, text)
}
func TestGetSuraNameNotFound(t *testing.T) {
_, err := NewQuranSimpleClean().GetSuraName(0)
assert.Error(t, err)
}