100 lines
3.5 KiB
Go
100 lines
3.5 KiB
Go
//go:build llm_script
|
|
|
|
package main
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"testing"
|
|
)
|
|
|
|
func TestVerifyCandidateDocumentOfficialRelease(t *testing.T) {
|
|
body, err := os.ReadFile(filepath.Join("testdata", "intraday_verification_official_release.html"))
|
|
if err != nil {
|
|
t.Fatalf("读取 official release fixture 失败: %v", err)
|
|
}
|
|
candidate := verificationCandidateRow{
|
|
ID: 1,
|
|
EventType: "official_release",
|
|
ProviderName: "OpenAI",
|
|
ModelName: "GPT-5.6",
|
|
Title: "GPT-5.6 preview pricing update",
|
|
}
|
|
result := verifyCandidateDocument(candidate, "https://openai.com/news/gpt-5-6-preview", string(body))
|
|
if result.CandidateStatus != "verified" || result.VerificationConfidence != "official_confirmed" {
|
|
t.Fatalf("官方发布应被确认: %+v", result)
|
|
}
|
|
}
|
|
|
|
func TestVerifyCandidateDocumentPriceCutNeedsRealPriceFacts(t *testing.T) {
|
|
body, err := os.ReadFile(filepath.Join("testdata", "intraday_verification_pricing_page.html"))
|
|
if err != nil {
|
|
t.Fatalf("读取 pricing fixture 失败: %v", err)
|
|
}
|
|
candidate := verificationCandidateRow{
|
|
ID: 2,
|
|
EventType: "price_cut",
|
|
ProviderName: "DeepSeek",
|
|
ModelName: "DeepSeek-V4-Flash",
|
|
Title: "DeepSeek-V4-Flash price cut",
|
|
}
|
|
result := verifyCandidateDocument(candidate, "https://deepseek.com/pricing/v4-flash", string(body))
|
|
if result.CandidateStatus != "verified" || result.VerificationConfidence != "official_confirmed" {
|
|
t.Fatalf("价格页命中真实价格变化后应确认: %+v", result)
|
|
}
|
|
}
|
|
|
|
func TestVerifyCandidateDocumentPromoCampaignOfficial(t *testing.T) {
|
|
body, err := os.ReadFile(filepath.Join("testdata", "intraday_verification_pricing_page.html"))
|
|
if err != nil {
|
|
t.Fatalf("读取 promo fixture 失败: %v", err)
|
|
}
|
|
candidate := verificationCandidateRow{
|
|
ID: 3,
|
|
EventType: "promo_campaign",
|
|
ProviderName: "DeepSeek",
|
|
ModelName: "DeepSeek-V4-Flash",
|
|
Title: "DeepSeek V4 Flash campaign",
|
|
}
|
|
result := verifyCandidateDocument(candidate, "https://deepseek.com/campaign/v4-flash", string(body))
|
|
if result.CandidateStatus != "verified" || result.VerificationConfidence != "official_confirmed" {
|
|
t.Fatalf("官方活动页应被确认: %+v", result)
|
|
}
|
|
}
|
|
|
|
func TestVerifyCandidateDocumentSecondaryMediaDowngrades(t *testing.T) {
|
|
body, err := os.ReadFile(filepath.Join("testdata", "intraday_verification_secondary_media.html"))
|
|
if err != nil {
|
|
t.Fatalf("读取 secondary fixture 失败: %v", err)
|
|
}
|
|
candidate := verificationCandidateRow{
|
|
ID: 4,
|
|
EventType: "official_release",
|
|
ProviderName: "OpenAI",
|
|
ModelName: "GPT-5.6",
|
|
Title: "GPT-5.6 leak discussion",
|
|
}
|
|
result := verifyCandidateDocument(candidate, "https://someblog.example.com/gpt-5-6-leak", string(body))
|
|
if result.VerificationConfidence != "secondary_confirmed" {
|
|
t.Fatalf("二手媒体应降级为 secondary_confirmed: %+v", result)
|
|
}
|
|
}
|
|
|
|
func TestVerifyCandidateDocumentLeakStaysOutOfOfficialFacts(t *testing.T) {
|
|
body, err := os.ReadFile(filepath.Join("testdata", "intraday_verification_secondary_media.html"))
|
|
if err != nil {
|
|
t.Fatalf("读取 leak fixture 失败: %v", err)
|
|
}
|
|
candidate := verificationCandidateRow{
|
|
ID: 5,
|
|
EventType: "leak_or_rumor",
|
|
ProviderName: "OpenAI",
|
|
ModelName: "GPT-5.6",
|
|
Title: "GPT-5.6 leak discussion",
|
|
}
|
|
result := verifyCandidateDocument(candidate, "https://someblog.example.com/gpt-5-6-leak", string(body))
|
|
if result.VerificationConfidence == "official_confirmed" {
|
|
t.Fatalf("泄露类不应升级为正式事实: %+v", result)
|
|
}
|
|
}
|