lab 3 done

This commit is contained in:
Khakimov Dmitrij
2026-10-20 20:46:51 +03:00
parent 0ab3a341aa
commit f9015df5d1
113 changed files with 6763 additions and 49 deletions
+19
View File
@@ -0,0 +1,19 @@
package chat
import (
"strings"
"testing"
)
func TestPasswordContract(t *testing.T) {
for _, value := range []string{"", "too-short", strings.Repeat(" ", 12), strings.Repeat("x", 129), strings.Repeat("x", 12) + string([]byte{0xff})} {
if validPassword(value) {
t.Fatal("invalid password accepted")
}
}
for _, value := range []string{strings.Repeat("🔑", 128), "valid:password", " password with spaces "} {
if !validPassword(value) {
t.Fatal("valid Unicode password rejected")
}
}
}