Luhn docs

This commit is contained in:
Jakob Borg
2014-07-04 15:56:33 +02:00
parent 193cea95ce
commit cfb33321b0
2 changed files with 16 additions and 2 deletions
+8
View File
@@ -7,11 +7,19 @@ import (
)
func TestGenerate(t *testing.T) {
// Base 6 Luhn
a := luhn.Alphabet("abcdef")
c := a.Generate("abcdef")
if c != 'e' {
t.Errorf("Incorrect check digit %c != e", c)
}
// Base 10 Luhn
a = luhn.Alphabet("0123456789")
c = a.Generate("7992739871")
if c != '3' {
t.Errorf("Incorrect check digit %c != 3", c)
}
}
func TestValidate(t *testing.T) {