Created
October 30, 2016 18:44
-
-
Save danmux/e7fe6c833a784a94200f463ac197ca29 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package iban | |
import "testing" | |
func ibanParseEqual(t *testing.T, iban, cc, cd, bb string, willErr bool) { | |
got, err := Parse(iban) | |
if willErr && err == nil { | |
t.Error("expected error") | |
} | |
if !willErr && err != nil { | |
t.Error("got error", err) | |
} | |
if got.CountryCode != cc { | |
t.Error("got wrong CountryCode", got.CountryCode) | |
} | |
if got.CheckDigits != cd { | |
t.Error("got wrong CheckDigits", got.CheckDigits) | |
} | |
if got.Bban != bb { | |
t.Error("got wrong Bban", got.Bban) | |
} | |
} | |
func TestParseIbanEq(t *testing.T) { | |
// Valid IBAN | |
ibanParseEqual(t, "DE10123", "DE", "10", "123", false) | |
ibanParseEqual(t, "DE10", "", "", "", true) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment