Created
January 17, 2021 09:16
-
-
Save Pongch/dade3ab3fa126683681fd825347d3150 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
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