38 lines
1.3 KiB
Go
38 lines
1.3 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) {
|
|
t.Fatal("stable conversational reply must not wait for response review")
|
|
}
|
|
if shouldReviewResponse("Запомнил.", false, false) != true {
|
|
t.Fatal("non-conversational deterministic reply remains reviewable")
|
|
}
|
|
if shouldReviewResponse("Ответ", true, false) {
|
|
t.Fatal("stable knowledge answer must not be reviewed twice")
|
|
}
|
|
}
|