lab4 done

This commit is contained in:
Khakimov Dmitrij
2026-11-10 20:42:03 +03:00
parent 276dbdad8a
commit b2bd7501d3
129 changed files with 9319 additions and 109 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")
}
}
}