返回 DeepSeek-Reasonix
image_enabled_test.go
根目录 / internal / boot / image_enabled_test.go
1 package boot
2
3 import (
4 "testing"
5
6 "reasonix/internal/provider"
7 )
8
9 type modalityProvider struct {
10 provider.Provider
11 modalities []provider.ModelModality
12 }
13
14 func (p modalityProvider) ModelInfo() provider.ModelInfo {
15 return provider.ModelInfo{InputModalities: p.modalities}
16 }
17
18 func TestRuntimeImageEnabledOnlyTrustsADeclaredModalityList(t *testing.T) {
19 text := []provider.ModelModality{provider.ModalityText}
20 both := []provider.ModelModality{provider.ModalityText, provider.ModalityImage}
21 cases := []struct {
22 name string
23 modalities []provider.ModelModality
24 fallback bool
25 want bool
26 }{
27 {"declared text-only stays blocked", text, true, false},
28 {"declared image model reads images", both, false, true},
29 {"undeclared model follows the resolved capability", nil, true, true},
30 {"undeclared model with a fallback model stays routed", nil, false, false},
31 }
32 for _, tc := range cases {
33 t.Run(tc.name, func(t *testing.T) {
34 if got := runtimeImageEnabled(modalityProvider{modalities: tc.modalities}, tc.fallback); got != tc.want {
35 t.Fatalf("runtimeImageEnabled = %v, want %v", got, tc.want)
36 }
37 })
38 }
39 }
40
40 lines GO