Use Scalacheck for testing pgn parser
lenguyenthanh opened this issue · 4 comments
@johnynek recommendation
I recommend using scalacheck to generate your AST, convert that to string, and then make sure parsing it back to the AST gives you exactly the right thing.
Can someone please assign me to this!
Do you mind explaining this a little more? Why do we an AST to test PGN parser?
The idea is we want to generate valid PGN string and parse it using scalacheck. And the way to do it is generate it's AST a.k. San.
We are already using this technique in some places: BitboardTest, ByColorTest.
But I'm not sure what is the best way to generate those PGN, like if we use legalMoves
to generate those, it can be slow, if not the generated PGN can be illegal (but still valid). And do we really care if generated PGNs are legal or not.
close because We have this: https://github.com/lichess-org/scalachess/blob/master/test-kit/src/test/scala/format/pgn/ParserCheck.scala