feat(server-go): LAMP 检测管理(任务单/步骤/结果录入/结果图片,#14)

This commit is contained in:
weijuesen
2026-08-12 17:48:46 +08:00
parent 713d34a3b5
commit c6e5a76e71
6 changed files with 331 additions and 0 deletions
@@ -0,0 +1,30 @@
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("空结果不应为合法结果")
}
}