TASK 2 A WHITE BOX TEST TASK NO
TASK 2 A WHITE BOX TEST TASK NO IMPLEMENTATION IS REQUIRED. Prepared by: T. Fina
To declare the length of the a. String If the length is ZERO or EMPTY then the output says “Empthy string is not allowed” ELSE the a. String is NOT EMPTY OK=TRUE a. String is NOT EMPTY DP = FALSE – a constant DP is declared when a. String is EMPTY, it is NOT TRUE It counts from 1 for the length of a. String IF-THEN-ELSE-ENDIF statement Ch is a variable declared to check for the first character in the a. String IF-THEN-ELSE-ENDIF statement Validate(a. String) 1 Length = Len(a. String) 2 IF Length = 0 THEN 3 Output “Empty string is not allowed” 4 ELSE 5 OK = TRUE 6 DP = FALSE 7 Count = 1 8 Ch = 1 st character of a. String 9 IF Ch < “i” OR Ch > “n” THEN 10 OK = FALSE 11 ELSE 12 WHILE Count < Length AND OK DO 13 Count = Count + 1 14 Ch = next character in a. String 15 IF Ch = “. ” THEN 16 IF DP THEN 17 OK = FALSE 18 ELSE 19 DP = TRUE 20 ENDIF 21 ELSE 22 IF Ch <“a” OR Ch > “z” THEN 23 OK = FALSE 24 ENDIF 25 ENDIF 26 ENDWHILE 27 ENDIF 28 IF OK THEN 29 Output “Valid string” 30 ELSE 31 Output “Invalid string” 32 ENDIF 33 ENDIF 34 END PROCEDURE Validate is a Procedure a. String is a Variable assigned for a string If Ch is less then letter “i” – [a to h] OR if Ch is more than letter “n” – [o to z] So, if this is the case so a. String is FALSE OR NOT TRUE for this condition ELSE if a. String is TRUE for that Condition, it counts the length again using the WHILE statement While it counts a. String, it increments the counting by 1 It checks if the next character of Ch is a dot (“. ”) So then if TRUE then if DP means if the next character in a. String is EMPTY, it is not true; OK = FALSE ELSE DP is TRUE the next character in a. String is NOT EMPTY is TRUE YOU HAVE TO CHECK EVERYLINE
- Slides: 2