Skip to content

Instantly share code, notes, and snippets.

@Pongch
Created January 17, 2021 09:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Pongch/dade3ab3fa126683681fd825347d3150 to your computer and use it in GitHub Desktop.
Save Pongch/dade3ab3fa126683681fd825347d3150 to your computer and use it in GitHub Desktop.
func TestIsChecksum(t *testing.T) {
t.Run("should return false if checksum is wrong", func(t *testing.T) {
wrongcheck := "0xc1912fEE45d61C87Cc5EA59DaE31190FFFFf232D"
if isChecksum(wrongcheck) {
t.Errorf("expected \n %v, got \n %v \n", true, isChecksum(wrongcheck))
}
})
t.Run("should return true if checksum is correct", func(t *testing.T) {
rightcheck := "0xc1912fEE45d61C87Cc5EA59DaE31190FFFFf232d" //last char is uppercase
if !isChecksum(rightcheck) {
t.Errorf("expected \n %v, got \n %v \n", true, isChecksum(rightcheck))
}
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment