27 lines
955 B
Go
27 lines
955 B
Go
package dobotaiops
|
|
|
|
import "testing"
|
|
|
|
func TestCoverageRuleUsesExactSubstringWithoutInventingPositiveCoverage(t *testing.T) {
|
|
for _, tc := range []struct {
|
|
answer string
|
|
uncovered bool
|
|
}{
|
|
{"当前暂无已发布的权威知识,暂不建议操作。", true},
|
|
{"根据引用资料:当前暂无已发布。请联系技术支持。", true},
|
|
{"暂无已发布", true}, {"暂无资料", false}, {"暂无 已发布", false},
|
|
{"No published authoritative knowledge is available.", false}, {"已有知识可以参考。", false}, {"", false},
|
|
} {
|
|
result := CheckAnswerCoverage(tc.answer)
|
|
if (result.Verdict == "uncovered") != tc.uncovered {
|
|
t.Fatalf("exact substring rule mismatch: %+v", result)
|
|
}
|
|
if !tc.uncovered && (result.Verdict != "" || result.State != "pending") {
|
|
t.Fatal("absence of marker must not imply covered or evaluated")
|
|
}
|
|
if result.RuleVersion == "" {
|
|
t.Fatal("rule result must retain version")
|
|
}
|
|
}
|
|
}
|