package model import "testing" func TestDefaultLampSteps(t *testing.T) { steps := DefaultLampSteps() want := []string{"采样", "DNA提取", "反应体系配制", "恒温反应", "结果判读"} if len(steps) != len(want) { t.Fatalf("步骤数 = %d, want %d", len(steps), len(want)) } for i, name := range want { if steps[i] != name { t.Errorf("步骤 %d = %s, want %s", i+1, steps[i], name) } } } func TestValidLampResult(t *testing.T) { for _, r := range []string{"positive", "negative", "invalid"} { if !ValidLampResult(r) { t.Errorf("%s 应为合法结果", r) } } if ValidLampResult("unknown") { t.Error("unknown 不应为合法结果") } if ValidLampResult("") { t.Error("空结果不应为合法结果") } }