Skip to content

Commit

Permalink
Add banks data tests
Browse files Browse the repository at this point in the history
  • Loading branch information
khasanovbi committed Aug 15, 2019
1 parent f721a7e commit 500af99
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions banks_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package banksdb

import (
"testing"

"github.com/stretchr/testify/require"
)

func TestNotEmptyDB(t *testing.T) {
require.NotEmpty(t, banksByCountry)
}

func TestNotEmptyBanksInCountry(t *testing.T) {
for country, banks := range banksByCountry {
require.NotEmpty(t, banks, "Country '%s' is empty", country)
}
}

func TestUniquePrefixesInBanks(t *testing.T) {
t.Skip() // Now this test failed because there is some nonunique prefixes in db.
seen := make(map[int]struct{})
for _, banks := range banksByCountry {
for _, bank := range banks {
for _, prefix := range bank.Prefixes {
_, isSeenBefore := seen[prefix]
require.False(t, isSeenBefore, "prefix %d seen before", prefix)
seen[prefix] = struct{}{}
}
}
}
}

0 comments on commit 500af99

Please sign in to comment.