Validation & Verification
Please note that none of these pseudocode examples are 100% correct (referring to syntax - as in the technical way to write it) but the idea is to show you how the methods work.
Validation
This an automated process where a computer checks if input value by the user meets the program's requirements to run (e.g. if a str variable is used, it makes sure that the user enters a string not an integer, Boolean or a float/real value so that the program can run without errors).
There are 6 main ones you need to know (range, length, type, present, format checks, and check digits)
Range Check
This will ensure a particular number falls within a required range.
OUTPUT 'Input any number between 0 and 100 inclusive'
REPEAT
INPUT Number
IF Number < 0 OR Number > 100
THEN
OUTPUT 'Your number is not between 0 and 100 inclusive. Try again.'
ENDIF
UNTIL Number >= 0 AND Number <=100
Length Check
This will check the length of a string (e.g. a password to ensure that its at least 8 characters long)
OUPUT 'Please enter your password'
REPEAT
INPUT Password
IF LENGTH(Password) < 8
THEN
OUTPUT 'Your password is too short. Try again.'
ENDIF
UNTIL LENGTH(Password) <- 8
Type Check
This will check what type of data you've entered whether it's a Boolean, string, or integer.
OUTPUT 'Enter an integer'
REPEAT
INPUT Number
IF Number <> DIV(Number, 1)
THEN
OUTPUT 'You have not entered an integer. Try again.'
ENDIF
UNTIL Number <- DIV(Number, 1)
Presence Check
Checks to see if you've entered data into a field or not (e.g. required * fields on an online form)
OUTPUT 'Enter your age'
REPEAT
INPUT Age
IF Age = ''
THEN
OUTPUT 'You need to enter your age'
ENDIF
UNTIL Age <> ''
Format Check
This will ensure that data has been inputted in the correct format (e.g. say you want their date of birth, but you want the day first, then the month, then the year). It's done using pattern matching and string handling.
OUPTUT 'Enter your gmail email address'
Run <- True
WHILE Run = True DO
INPUT Email
IF '@gmail.com' NOT IN Email
THEN
OUTPUT 'You have not entered a gmail email address. Try again.'
ELIF '@gmail.com' IN Email
THEN
Run <- False
ENDIF
ENDWHILE
Check Digits
If you're unsure about what these are, look here as I've explained them already.
Verification
This is to check whether data is accurate or not when entered into a system. There are two main methods which you need to be aware of (double entry checking and visual checks).
Double Entry Checking
This involves entering the data twice (e.g. when resetting a password or entering your email). You have to input data into two seperate variables and then check both to see if they match. If they do not match, then both inputs are not the same, so the user has incorrectly entered data.
REPEAT
OUTPUT 'Enter your password'
INPUT Password1
OUTPUT 'To confirm your password, please enter it again'
INPUT Password2
IF Password1 <> Password2
THEN
OUTPUT 'Your passwords do not match. Try again.'
ENDIF
UNTIL Password1 = Password2
Visual Checks
This is where you trust the human to check the data they're inputting without any actual data checking via an algorithm or check.
A pop-up should appear before they are allowed to enter the data. If they select that the data is correct, then the data is appended to the variable. If not, then the data is re-inputted before being appended to the variable.
REPEAT
Answer <- False
OUTPUT 'Enter your name'
INPUT Name
OUTPUT 'Is this correct (Y/N)?'
INPUT Verify
IF Verify = 'N'
THEN
OUTPUT 'Please re-enter the data'
INPUT Name
ELIF Verify = 'Y'
THEN
Answer <- True
ENDIF
UNTIL Answer <- True
Test Data
There are 4 types of test data:
Normal Data (should be accepted in the program, well within the boundary)
Abnormal Data (should not be accepted in the program, outside the boundary)
Extreme Data (a form of boundary data, tests the max. and min. value of a program)
Boundary Data (where you test the max. and min. values but withing the acceptable and not acceptable range - e.g. if my range is between 0 and 100, I'll have 4 numbers as boundary data which are -1, 0, 100, and 101 - generally boundary and extreme data are the same)
Last updated
Was this helpful?