2024-10-03 13:52:06 +00:00
|
|
|
package chatbot
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestNekoUKrovuBot_checkForJelNekoUKrovu(t *testing.T) {
|
|
|
|
type args struct {
|
|
|
|
txt string
|
|
|
|
}
|
|
|
|
tests := []struct {
|
2024-10-03 14:19:54 +00:00
|
|
|
name string
|
|
|
|
args args
|
|
|
|
want bool
|
2024-10-03 13:52:06 +00:00
|
|
|
}{
|
2024-10-03 14:19:54 +00:00
|
|
|
{
|
|
|
|
name: "matches 'jel neko u krovu'",
|
|
|
|
args: args{
|
|
|
|
txt: "jel neko u krovu",
|
|
|
|
},
|
|
|
|
want: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "matches 'ima li koga na krovu'",
|
|
|
|
args: args{
|
|
|
|
txt: "ima li koga na krovu",
|
|
|
|
},
|
|
|
|
want: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "does not match 'nema nikoga'",
|
|
|
|
args: args{
|
|
|
|
txt: "nema nikoga",
|
|
|
|
},
|
|
|
|
want: false,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "matches 'koga ima na krovu'",
|
|
|
|
args: args{
|
|
|
|
txt: "koga ima na krovu",
|
|
|
|
},
|
|
|
|
want: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "matches 'neko u krov'",
|
|
|
|
args: args{
|
|
|
|
txt: "neko u krov",
|
|
|
|
},
|
|
|
|
want: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "case insensitive match 'EL NEKO krov'",
|
|
|
|
args: args{
|
|
|
|
txt: "EL NEKO krov",
|
|
|
|
},
|
|
|
|
want: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "case insensitive match 'jel neko jebeno u krovu'",
|
|
|
|
args: args{
|
|
|
|
txt: "jel neko jebeno u krovu",
|
|
|
|
},
|
|
|
|
want: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "case insensitive match 'buraz jel neko jebeno u krovu'",
|
|
|
|
args: args{
|
|
|
|
txt: "buraz jel neko jebeno u krovu",
|
|
|
|
},
|
|
|
|
want: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "case insensitive match 'neko u krovu?'",
|
|
|
|
args: args{
|
|
|
|
txt: "neko u krovu?",
|
|
|
|
},
|
|
|
|
want: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "case insensitive match 'u krovu?'",
|
|
|
|
args: args{
|
|
|
|
txt: "u krovu?",
|
|
|
|
},
|
|
|
|
want: false,
|
|
|
|
},
|
2024-10-03 13:52:06 +00:00
|
|
|
}
|
|
|
|
for _, tt := range tests {
|
|
|
|
t.Run(tt.name, func(t *testing.T) {
|
2024-10-03 14:19:54 +00:00
|
|
|
nkbot := &NekoUKrovuBot{}
|
2024-10-03 13:52:06 +00:00
|
|
|
if got := nkbot.checkForJelNekoUKrovu(tt.args.txt); got != tt.want {
|
|
|
|
t.Errorf("NekoUKrovuBot.checkForJelNekoUKrovu() = %v, want %v", got, tt.want)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|