Reuse duplicate grouping for combat turns and spells
This commit is contained in:
@@ -357,6 +357,20 @@ func TestNormalizeKeepsDistinctAndIneligibleCastsSeparate(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestDuplicateGroupingPreservesUnchangedSpellListStorage(t *testing.T) {
|
||||
normalizer := newNormalizer(t)
|
||||
index := source.NewDocumentIndex(sourceDocument(3))
|
||||
for _, input := range []dnd.SpellList{{}, {SpellCasts: []dnd.SpellCast{}}, {SpellCasts: []dnd.SpellCast{{Spell: "Cure Wounds", Caster: "Aria", SourceRefs: []source.SourceRef{{SourceID: "source", StartUnitID: 1, EndUnitID: 1}}}}}} {
|
||||
output, findings := collapseDuplicateSpellCasts(input, index, normalizer.effectiveCatalog)
|
||||
if !reflect.DeepEqual(output, input) || findings != nil {
|
||||
t.Fatalf("unchanged = %#v, %#v, want %#v", output, findings, input)
|
||||
}
|
||||
if len(input.SpellCasts) > 0 && &output.SpellCasts[0] != &input.SpellCasts[0] {
|
||||
t.Fatal("unchanged list replaced its storage")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestNormalizeDoesNotCollapseAdjacentOrOverlappingEvidence(t *testing.T) {
|
||||
doc := sourceDocument(8)
|
||||
input := dnd.SpellList{SpellCasts: []dnd.SpellCast{
|
||||
|
||||
Reference in New Issue
Block a user