31 lines
773 B
Go
31 lines
773 B
Go
package main
|
|
|
|
import "testing"
|
|
|
|
func TestExactScoringIsStrict(t *testing.T) {
|
|
if !exact("ДОМОВОЙ_OK")(" ДОМОВОЙ_OK\n") {
|
|
t.Fatal("trimmed exact response rejected")
|
|
}
|
|
if exact("ДОМОВОЙ_OK")("ДОМОВОЙ_OK.") {
|
|
t.Fatal("non-exact response accepted")
|
|
}
|
|
}
|
|
|
|
func TestStructuredArithmeticScoring(t *testing.T) {
|
|
if !answer42(`{"answer":42}`) {
|
|
t.Fatal("valid result rejected")
|
|
}
|
|
if answer42("```json\n{\"answer\":42}\n```") || answer42(`{"answer":41}`) {
|
|
t.Fatal("invalid structured result accepted")
|
|
}
|
|
}
|
|
|
|
func TestBoundedResponse(t *testing.T) {
|
|
if got := bounded(" abc ", 10); got != "abc" {
|
|
t.Fatalf("bounded response = %q", got)
|
|
}
|
|
if got := bounded("abcdef", 3); got != "abc" {
|
|
t.Fatalf("truncated response = %q", got)
|
|
}
|
|
}
|