-
Notifications
You must be signed in to change notification settings - Fork 0
/
sengkala_test.go
108 lines (97 loc) · 3.23 KB
/
sengkala_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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
package sengkala
import (
"fmt"
"sengkala/data"
"testing"
"github.com/stretchr/testify/assert"
)
var testSengkalaData = map[string]struct {
changedYear string
old struct {
expectedSurya expected
expectedCandra expected
}
new struct {
expectedSurya expected
expectedCandra expected
}
}{
"1983": {
changedYear: "1984",
old: struct {
expectedSurya expected
expectedCandra expected
}{
expectedSurya: expected{
expectedYear: 1983,
expectedSengkala: "Bentèr Tekèk Wilasita Pamasé",
expectedMeaning: map[string]string{
"Bentèr": "panas",
"Pamasé": "raja",
"Tekèk": "tokek",
"Wilasita": "liang, liang kumbang",
},
},
expectedCandra: expected{
expectedYear: 1915,
expectedSengkala: "Sara Pamasé Wilasita Pamasé",
expectedMeaning: map[string]string{
"Pamasé": "raja",
"Sara": "senjata, panah",
"Wilasita": "liang, liang kumbang",
},
},
},
new: struct {
expectedSurya expected
expectedCandra expected
}{
expectedSurya: expected{
expectedYear: 1984,
expectedSengkala: "Udaka Tekèk Wilasita Pamasé",
expectedMeaning: map[string]string{
"Udaka": "air",
"Tekèk": "tokek",
"Wilasita": "liang, liang kumbang",
"Pamasé": "raja",
},
},
expectedCandra: expected{
expectedYear: 1916,
expectedSengkala: "Karaséng Pamasé Wilasita Pamasé",
expectedMeaning: map[string]string{
"Karaséng": "terasa oleh ( terasa pada )",
"Pamasé": "raja",
"Wilasita": "liang, liang kumbang",
},
},
},
},
}
func TestSengkala(t *testing.T) {
d := dictionary{
watak: data.Watak,
meaning: data.Meaning,
Randomizer: new(RandomizerMock),
}
for year, expected := range testSengkalaData {
t.Run(fmt.Sprintf("sengkala_%s", year), func(t *testing.T) {
sengkala := FromYear(year)
sengkala.SetDictionary(d)
assert.NoError(t, sengkala.GetError())
assert.Equal(t, expected.old.expectedSurya.expectedYear, sengkala.GetSuryaSengkala().GetYear())
assert.Equal(t, expected.old.expectedSurya.expectedSengkala, sengkala.GetSuryaSengkala().GetSengkala())
assert.Equal(t, expected.old.expectedSurya.expectedMeaning, sengkala.GetSuryaSengkala().GetMeaning())
assert.Equal(t, expected.old.expectedCandra.expectedYear, sengkala.GetCandraSengkala().GetYear())
assert.Equal(t, expected.old.expectedCandra.expectedSengkala, sengkala.GetCandraSengkala().GetSengkala())
assert.Equal(t, expected.old.expectedCandra.expectedMeaning, sengkala.GetCandraSengkala().GetMeaning())
sengkala.SetYear(expected.changedYear)
assert.Equal(t, expected.new.expectedSurya.expectedYear, sengkala.GetSuryaSengkala().GetYear())
assert.Equal(t, expected.new.expectedSurya.expectedSengkala, sengkala.GetSuryaSengkala().GetSengkala())
assert.Equal(t, expected.new.expectedSurya.expectedMeaning, sengkala.GetSuryaSengkala().GetMeaning())
assert.Equal(t, expected.new.expectedCandra.expectedYear, sengkala.GetCandraSengkala().GetYear())
assert.Equal(t, expected.new.expectedCandra.expectedSengkala, sengkala.GetCandraSengkala().GetSengkala())
assert.Equal(t, expected.new.expectedCandra.expectedMeaning, sengkala.GetCandraSengkala().GetMeaning())
})
}
}