package functions import "testing" func TestOnlyWhitespace(t *testing.T) { type args struct { word string } tests := []struct { name string args args want bool }{ {"empty string", args{""}, true}, {"whitespace", args{" "}, true}, {"whitespaces", args{" "}, true}, {"whitespaces and tabs", args{" \t"}, true}, {"whitespaces and tabs and newlines", args{" \t\n"}, true}, {"whitespaces and tabs and newlines and non-breaking spaces", args{" \t\n\u00A0"}, true}, {"non-whitespace", args{"a"}, false}, {"non-whitespaces", args{"abc"}, false}, {"non-whitespaces and tabs", args{"abc\t"}, false}, {"non-whitespaces and tabs and newlines", args{"abc\t\n"}, false}, {"non-whitespaces and tabs and newlines and non-breaking spaces", args{"abc\t\n\u00A0"}, false}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := OnlyWhitespace(tt.args.word); got != tt.want { t.Errorf("OnlyWhitespace() = %v, want %v", got, tt.want) } }) } } func TestHashString(t *testing.T) { type args struct { s string } tests := []struct { name string args args want string }{ {"empty string", args{""}, "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"}, {"non-empty string", args{"abc"}, "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad"}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := HashString(tt.args.s); got != tt.want { t.Errorf("HashString() = %v, want %v", got, tt.want) } }) } }