The test simply takes a FEN string that represents an active, in-play position (i.e. not the starting position) and attempts to de-serialize the FEN into a Position struct and then re-serialize that struct back into a FEN string.
What's happening, instead, is that we get this error:
thread 'position::tests::test_build_position_from_random_fen' has overflowed its stack
fatal runtime error: stack overflow
error: test failed, to rerun pass `--lib`
This is odd behavior, and it likely has to do with something RE: how we're allocating stack frames in the impl Display for Square, since that's where the initial debugger crashed. But it needs more investigation.
To note, the test with the FEN string representing the starting position passes.
Issue resolved: The root cause was a circular call in impl Display for Square - the implementation called to_string(), which became self-referential until the call frames crashed the stack.
The test simply takes a FEN string that represents an active, in-play position (i.e. not the starting position) and attempts to de-serialize the FEN into a
Position
struct and then re-serialize that struct back into a FEN string.What's happening, instead, is that we get this error:
This is odd behavior, and it likely has to do with something RE: how we're allocating stack frames in the
impl Display for Square
, since that's where the initial debugger crashed. But it needs more investigation.To note, the test with the FEN string representing the starting position passes.