Changes History.traverse() to only set previous and next pointers if move doesn't already have pointers set.
Adds two unit tests that recursively checks ALL variation lines in a PGN and ensures self-consistency
This fixes (what I believe to be) a bug in traverse where a move in the main line will get its next property set to the first move of an alternate line rather than the next move in its own line.
In general, it seems the correct behavior ought to be that every move in move.variation should satisfy
See https://github.com/shaack/cm-pgn/issues/20.
Overview
History.traverse()
to only setprevious
andnext
pointers if move doesn't already have pointers set.This fixes (what I believe to be) a bug in traverse where a move in the main line will get its
next
property set to the first move of an alternate line rather than the next move in its own line.In general, it seems the correct behavior ought to be that every move in
move.variation
should satisfyIf one of those moves has variations branching off it, that shouldn't matter to that move's
previous
andnext
pointers.