Files
llm-testbench/internal/tests/web_test.go
T
lukaszraczylo 1d51d4cbbd feat: LLM accuracy testing framework with 17-test catalog
Framework runs a category/subcategory test catalog against multiple
LLMs through an OpenAI-compatible endpoint. Deterministic evaluators
score each response. Reports render as table, markdown, or JSON.
2026-08-17 01:29:45 +01:00

32 lines
823 B
Go

package tests
import (
"context"
"testing"
)
func TestWebRobotsAICrawlersTest_Eval(t *testing.T) {
tc := webRobotsAICrawlersTest()
tests := []struct {
name string
response string
want float64
}{
{"correct: only ClaudeBot", `["ClaudeBot"]`, 1},
{"correct fenced", "```json\n[\"ClaudeBot\"]\n```", 1},
{"includes decoy Googlebot", `["ClaudeBot","Googlebot"]`, 0.5},
{"includes disallowed GPTBot", `["ClaudeBot","GPTBot"]`, 0.5},
{"empty answer", `[]`, 0},
{"only wrong bots", `["GPTBot","PerplexityBot"]`, 0},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got := tc.Eval.Evaluate(context.Background(), tt.response)
if got.Value != tt.want {
t.Errorf("Eval.Evaluate(%q) = %v, want %v (detail: %s)", tt.response, got.Value, tt.want, got.Detail)
}
})
}
}