1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
| void test_validate_text_input() {
int count = 1;
std::printf("%02d - validate_text_input - test empty str : %s", count, (( validate_text_input("") )? "success": "fail"));
++count;
// On inverse le retour pour savoir si la fonction a le bon comportement
std::printf("%02d - validate_text_input - length str < min : %s", count, ((!validate_text_input("123"))? "success": "fail"));
++count;
std::printf("%02d - validate_text_input - length str == min : %s", count, (( validate_text_input("12345") )? "success": "fail"));
++count;
// On inverse le retour pour savoir si la fonction a le bon comportement
std::printf("%02d - validate_text_input - length str > max : %s", count, ((!validate_text_input("123456789012345678901234567890123"))? "success": "fail"));
++count;
std::printf("%02d - validate_text_input - length str == max : %s", count, (( validate_text_input("12345678901234567890123456789") )? "success": "fail"));
++count;
std::printf("%02d - validate_text_input - no error, only alpha : %s", count, (( validate_text_input("1234567890") )? "success": "fail"));
++count;
std::printf("%02d - validate_text_input - no error, ascii, lower case : %s", count, (( validate_text_input("abcdefghiklmnopqrstuvxyz") )? "success": "fail"));
++count;
std::printf("%02d - validate_text_input - no error, ascii, upper case : %s", count, (( validate_text_input("ABCDEFGHIKLMNOPQRSTUVXYZ") )? "success": "fail"));
++count;
std::printf("%02d - validate_text_input - no error, special char : %s", count, (( validate_text_input("082avbd/-*?@") )? "success": "fail"));
++count;
// On inverse le retour pour savoir si la fonction a le bon comportement
std::printf("%02d - validate_text_input - error pos 5 : %s", count, ((!validate_text_input("082a²vbd/-*?@"))? "success": "fail"));
++count;
// ...
} |
Partager