zxcvbn-go/matching/matching_test.go

33 lines
840 B
Go
Raw Normal View History

package matching
2016-01-13 22:02:53 +00:00
import (
2016-01-13 22:02:53 +00:00
"github.com/nbutton23/zxcvbn-go/Godeps/_workspace/src/github.com/stretchr/testify/assert"
"testing"
)
2016-01-13 22:02:53 +00:00
//DateSepMatch("1991-09-11jibjab11.9.1991")
2016-01-13 22:02:53 +00:00
//[{date 16 25 . 9 11 1991} {date 0 10 - 9 11 1991}]
2016-01-13 22:02:53 +00:00
func TestDateSepMatch(t *testing.T) {
matches := DateSepMatch("1991-09-11jibjab11.9.1991")
assert.Len(t, matches, 2, "Length should be 2")
for _, match := range matches {
2016-01-13 22:02:53 +00:00
if match.Separator == "." {
assert.Equal(t, 16, match.I)
assert.Equal(t, 25, match.J)
assert.Equal(t, int64(9), match.Day)
assert.Equal(t, int64(11), match.Month)
assert.Equal(t, int64(1991), match.Year)
} else {
assert.Equal(t, 0, match.I)
assert.Equal(t, 10, match.J)
assert.Equal(t, int64(9), match.Day)
assert.Equal(t, int64(11), match.Month)
assert.Equal(t, int64(1991), match.Year)
}
}
2016-01-13 22:02:53 +00:00
}