-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcountrymap_test.go
51 lines (42 loc) · 1.45 KB
/
countrymap_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 mimir
import "testing"
func TestCountryMapConfiguration(t *testing.T) {
for _, configuration := range countriesConfiguration {
if configuration.IBANDefinition.Length != len(configuration.IBANDefinition.Example) {
t.Errorf("[%s] IBAN Incorrect length, got: %v, want: %v.",
configuration.CountryCode.String(),
len(configuration.IBANDefinition.Example),
configuration.IBANDefinition.Length,
)
}
if configuration.BBANDefinition.Length != len(configuration.BBANDefinition.Example) {
t.Errorf("[%s] BBAN Incorrect length, got: %v, want: %v.",
configuration.CountryCode.String(),
len(configuration.BBANDefinition.Example),
configuration.BBANDefinition.Length,
)
}
}
}
func TestCountryPrefixInIBAN(t *testing.T) {
for _, configuration := range countriesConfiguration {
if configuration.CountryCode.String() != configuration.IBANDefinition.Example[:2] {
t.Errorf("Prefix Incorrect the configuration may not be accurate, got: %v, want: %v.",
configuration.IBANDefinition.Example[:2],
configuration.CountryCode.String(),
)
}
}
}
func TestSEPACountry(t *testing.T) {
const expectedSEPACountry = 42
ctrSEPACountry := 0
for _, configuration := range countriesConfiguration {
if configuration.IsSEPAAvailable {
ctrSEPACountry++
}
}
if ctrSEPACountry != expectedSEPACountry {
t.Errorf("The number of Country with SEPA available is incorrect, got: %v, want: %v.", ctrSEPACountry, expectedSEPACountry)
}
}