apg-go/grouping_test.go
Winni Neessen 0bb1b6c09b
Add grouping functionality and corresponding tests
Implemented a new function 'GroupCharsForMobile' in the 'apg' package, which groups characters in a mobile-friendly manner based on their Unicode category. Accompanying tests for this function have also been created in 'grouping_test.go'. This update enhances password readability on mobile devices.
2024-03-25 11:06:54 +01:00

24 lines
676 B
Go

package apg
import "testing"
func TestGroupCharacters(t *testing.T) {
tests := []struct {
name string
password string
want string
}{
{`PW: A1c9.Ba`, `A1c9.Ba`, `ABca19.`},
{`PW: PX4xDoiKrs,[egEAief{`, `PX4xDoiKrs,[egEAief{`, `PXDKEAxoirsegief4,[{`},
{`PW: *Z%C9d+PZYkD7D+{~r'w`, `*Z%C9d+PZYkD7D+{~r'w`, `ZCPZYDDdkrw97*%++{~'`},
{`PW: 4?r2YV:Abo&/z<3tJ*Z{`, `4?r2YV:Abo&/z<3tJ*Z{`, `YVAJZrbozt423?:&/<*{`},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
grouped := GroupCharsForMobile(tt.password)
if grouped != tt.want {
t.Errorf("GroupCharsForMobile() failed, expected: %s, got: %s", tt.want, grouped)
}
})
}
}