fix #9132

Replace MinLength and MaxLength by Length.
Add some unit tests for guessMaxLengthForConstraint method.