Control Flow Graph
Branch Coverage
Path Condition
Analysis
PSEUDOCODE / THE CODE BEING TESTED::
// count++ is a shorthand notation for count=count+1;
//prompt user for password1. PRINT("Please enter a password: "); String password=UserInput(); //userenters password boolean isSixCharacters=false; //true ifhas 6 characters, false if doesn't boolean hasOneUppercase=false; //true ifhas 1 uppercase character, false if doesn't boolean hasOneLowercase=false; //true ifhas 1 lowercase character, false if doesn't boolean hasOneDigit=false; //true if has 1 digit, false if doesn't boolean hasSpecial=false; //true ifspecial character, false if doesn't int count=0;2. while(count<3){3. if(password.length()>8) {4. isSixCharacters=true; } else{5. isSixCharacters=false; }
6. char charValue; int i=0;7. while(i<password.length()) { 8. charValue=password.charAt(i); 9. if(Character.isUpperCase(charValue)) { 10. hasOneUppercase=true; }11. if(Character.isUpperCase(charValue)) {12. hasOneLowercase=true; }13. else if(Character.isDigit(charValue)) {14. hasOneDigit=true; } 15. else if(charValue=='!'||charValue=='#' || charValue=='@' || charValue=='%' ||charValue=='(' ||charValue==')' || charValue=='!' ||charValue=='$') {16. hasSpecial=true; }
17. i++; }
//Process complexityrequirements18. if(hasOneUppercase)19. count++;20. if(hasOneLowercase)21. count++;22. if(hasOneDigit)23. count++;24. else if(hasSpecial)25. count++; else26. System.out.println("Error");27. if(count<3){28. count=0; PRINT("Password does notmeet requirements."); PRINT("Please reenter apassword: "); password=UserInput(); //user enters password } }
Control Flow Graph Branch Coverage Path Condition Analysis PSEUDOCODE / THE CODE BEING TESTED:: // count++ is a shorthan
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am