Skip to content

Instantly share code, notes, and snippets.

@bwangelme
Last active June 20, 2019 00:46
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 bwangelme/8fc8dc5309c502a6c23b46c1ef24d39f to your computer and use it in GitHub Desktop.
Save bwangelme/8fc8dc5309c502a6c23b46c1ef24d39f to your computer and use it in GitHub Desktop.
extend assert
func Int32LessEqual(t *testing.T, x, y int32, msgAndArgs ...interface{}) bool {
if x > y {
return assert.Fail(t, fmt.Sprintf("%d not less than %d", x, y), msgAndArgs)
}
return true
}
func TestMaxRune(t *testing.T) {
var maxRune int32 = 122
for i := 'a'; i <= 'z'; i++ {
Int32LessEqual(t, i, maxRune)
}
for i := 'A'; i <= 'Z'; i++ {
Int32LessEqual(t, i, maxRune)
}
for i := '0'; i <= '9'; i++ {
Int32LessEqual(t, i, maxRune)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment