Skip to content

Instantly share code, notes, and snippets.

@bervukas
Last active May 27, 2019 23:57
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Tutorial: Excel Unit Testing with VBA
Option Explicit
''
' Validate the password length so that it's between 8-16 characters long
'
' Returns:
'
' TRUE - Password matches the lenght requirement
' FALSE - Password doesn't match the length requirement
Function ValidatePasswordLength(password As String) As Boolean
Dim success As Boolean: success = False
' Validate the password is of correct length (between 8-16 characters)
Dim length As Long: length = Len(password)
If (length >= 8 And length <= 16) Then
success = True
End If
ValidatePasswordLength = success
End Function
@IvenBach
Copy link

Thanks for writing about Rubberduck's unit test feature. You have a typo on line 8 the h and t in length are transposed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment