47 lines
1.9 KiB
Go
47 lines
1.9 KiB
Go
package main
|
|
|
|
import "testing"
|
|
|
|
func TestShouldInvokeHumanResponseSkipsDeterministicFastPaths(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
stableConversational bool
|
|
identityReply string
|
|
memoryInstructionReply string
|
|
want bool
|
|
}{
|
|
{name: "stable conversational", stableConversational: true},
|
|
{name: "identity", identityReply: "Меня зовут Домовой."},
|
|
{name: "memory instruction", memoryInstructionReply: "Запомнил."},
|
|
{name: "ordinary continuity", want: true},
|
|
}
|
|
for _, test := range tests {
|
|
t.Run(test.name, func(t *testing.T) {
|
|
if got := shouldInvokeHumanResponse(test.stableConversational, test.identityReply, test.memoryInstructionReply); got != test.want {
|
|
t.Fatalf("shouldInvokeHumanResponse() = %t, want %t", got, test.want)
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|
|
func TestShouldReviewResponseSkipsStableAnswers(t *testing.T) {
|
|
if shouldReviewResponse("Здравствуйте.", false, true, "", "", false) {
|
|
t.Fatal("stable conversational reply must not wait for response review")
|
|
}
|
|
if shouldReviewResponse("Меня зовут Домовой.", false, false, "Меня зовут Домовой.", "", false) {
|
|
t.Fatal("identity reply must not wait for response review")
|
|
}
|
|
if shouldReviewResponse("Запомнил.", false, false, "", "Запомнил.", false) {
|
|
t.Fatal("memory instruction reply must not wait for response review")
|
|
}
|
|
if shouldReviewResponse("Вы называли тестовый цвет: синий.", false, false, "", "", true) {
|
|
t.Fatal("deterministic memory reply must not wait for response review")
|
|
}
|
|
if !shouldReviewResponse("Ответ", false, false, "", "", false) {
|
|
t.Fatal("non-conversational answer remains reviewable")
|
|
}
|
|
if shouldReviewResponse("Ответ", true, false, "", "", false) {
|
|
t.Fatal("stable knowledge answer must not be reviewed twice")
|
|
}
|
|
}
|