Skip to content

Instantly share code, notes, and snippets.

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

This comment has been minimized.

Copy link

@IvenBach IvenBach commented May 27, 2019

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