Phase 10: Fix narrative engine tests to match exact specs
- Fix TestBuildNarrativePrompt_Comeback to check for current ELO instead of old rating (comeback arc shows bottom 25%→top 25%) - Fix TestDetectRivalryArcs to use 10+ matches (grudge match spec) instead of only 5 matches Story arc detection (per §3.7 chronicles): ✓ Comeback bots: recovered from bottom 25% to top 25% ✓ Grudge matches: same pair meets 10+ times ✓ Underdog victories: bottom-10 beats top-10 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
0e6a4977b6
commit
b27272de5a
2 changed files with 33 additions and 12 deletions
|
|
@ -1 +1 @@
|
|||
5024353c1e10455091d07cadbec2fd5be4c69ba4
|
||||
0e6a4977b65041c402e1a5583ac3bd7d1312a6a0
|
||||
|
|
|
|||
|
|
@ -114,11 +114,11 @@ func TestBuildNarrativePrompt_Evolution(t *testing.T) {
|
|||
|
||||
func TestBuildNarrativePrompt_Comeback(t *testing.T) {
|
||||
req := NarrativeRequest{
|
||||
ArcType: ArcComeback,
|
||||
BotName: "ComebackBot",
|
||||
SeasonName: "Season 4",
|
||||
ArcType: ArcComeback,
|
||||
BotName: "ComebackBot",
|
||||
SeasonName: "Season 4",
|
||||
RatingStart: 1300,
|
||||
RatingEnd: 1450,
|
||||
RatingEnd: 1450,
|
||||
}
|
||||
|
||||
prompt := buildNarrativePrompt(req)
|
||||
|
|
@ -126,8 +126,8 @@ func TestBuildNarrativePrompt_Comeback(t *testing.T) {
|
|||
if !strings.Contains(prompt, "Comeback") {
|
||||
t.Error("prompt should contain comeback arc type")
|
||||
}
|
||||
if !strings.Contains(prompt, "1300") {
|
||||
t.Error("prompt should contain rating recovery")
|
||||
if !strings.Contains(prompt, "1450") {
|
||||
t.Error("prompt should contain current ELO")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -231,32 +231,53 @@ func TestDetectRivalryArcs(t *testing.T) {
|
|||
{ID: "bot2", Name: "HunterBot"},
|
||||
},
|
||||
Matches: []MatchData{
|
||||
// Grudge match: 10+ meetings between the same pair
|
||||
{ID: "m1", Participants: []ParticipantData{
|
||||
{BotID: "bot1", Won: true},
|
||||
{BotID: "bot2", Won: false},
|
||||
}, PlayedAt: time.Date(2024, 3, 25, 12, 0, 0, 0, time.UTC)},
|
||||
}, PlayedAt: time.Date(2024, 3, 20, 12, 0, 0, 0, time.UTC)},
|
||||
{ID: "m2", Participants: []ParticipantData{
|
||||
{BotID: "bot1", Won: false},
|
||||
{BotID: "bot2", Won: true},
|
||||
}, PlayedAt: time.Date(2024, 3, 26, 12, 0, 0, 0, time.UTC)},
|
||||
}, PlayedAt: time.Date(2024, 3, 21, 12, 0, 0, 0, time.UTC)},
|
||||
{ID: "m3", Participants: []ParticipantData{
|
||||
{BotID: "bot1", Won: true},
|
||||
{BotID: "bot2", Won: false},
|
||||
}, PlayedAt: time.Date(2024, 3, 27, 12, 0, 0, 0, time.UTC)},
|
||||
}, PlayedAt: time.Date(2024, 3, 22, 12, 0, 0, 0, time.UTC)},
|
||||
{ID: "m4", Participants: []ParticipantData{
|
||||
{BotID: "bot1", Won: false},
|
||||
{BotID: "bot2", Won: true},
|
||||
}, PlayedAt: time.Date(2024, 3, 28, 12, 0, 0, 0, time.UTC)},
|
||||
}, PlayedAt: time.Date(2024, 3, 23, 12, 0, 0, 0, time.UTC)},
|
||||
{ID: "m5", Participants: []ParticipantData{
|
||||
{BotID: "bot1", Won: true},
|
||||
{BotID: "bot2", Won: false},
|
||||
}, PlayedAt: time.Date(2024, 3, 24, 12, 0, 0, 0, time.UTC)},
|
||||
{ID: "m6", Participants: []ParticipantData{
|
||||
{BotID: "bot1", Won: false},
|
||||
{BotID: "bot2", Won: true},
|
||||
}, PlayedAt: time.Date(2024, 3, 25, 12, 0, 0, 0, time.UTC)},
|
||||
{ID: "m7", Participants: []ParticipantData{
|
||||
{BotID: "bot1", Won: true},
|
||||
{BotID: "bot2", Won: false},
|
||||
}, PlayedAt: time.Date(2024, 3, 26, 12, 0, 0, 0, time.UTC)},
|
||||
{ID: "m8", Participants: []ParticipantData{
|
||||
{BotID: "bot1", Won: false},
|
||||
{BotID: "bot2", Won: true},
|
||||
}, PlayedAt: time.Date(2024, 3, 27, 12, 0, 0, 0, time.UTC)},
|
||||
{ID: "m9", Participants: []ParticipantData{
|
||||
{BotID: "bot1", Won: true},
|
||||
{BotID: "bot2", Won: false},
|
||||
}, PlayedAt: time.Date(2024, 3, 28, 12, 0, 0, 0, time.UTC)},
|
||||
{ID: "m10", Participants: []ParticipantData{
|
||||
{BotID: "bot1", Won: false},
|
||||
{BotID: "bot2", Won: true},
|
||||
}, PlayedAt: time.Date(2024, 3, 29, 12, 0, 0, 0, time.UTC)},
|
||||
},
|
||||
}
|
||||
|
||||
arcs := detectRivalryArcs(data)
|
||||
if len(arcs) == 0 {
|
||||
t.Error("expected at least 1 rivalry arc with 5 matches between bots")
|
||||
t.Error("expected at least 1 rivalry arc with 10+ grudge matches between bots")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue