looking for a complex PGN file for testing PGN parser

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

casaschi
Posts: 164
Joined: Wed Dec 23, 2009 1:57 pm

looking for a complex PGN file for testing PGN parser

Post by casaschi »

Hello.

I'm looking for a complex PGN file for testing a PGN parser. Something with complex variations and a variety of test cases.

I thought something like that should be already available, but I could not find anything from google.

Anyone with a link to such a test PGN file?

Thanks in advance.
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: looking for a complex PGN file for testing PGN parser

Post by bob »

casaschi wrote:Hello.

I'm looking for a complex PGN file for testing a PGN parser. Something with complex variations and a variety of test cases.

I thought something like that should be already available, but I could not find anything from google.

Anyone with a link to such a test PGN file?

Thanks in advance.
The "enormous.pgn" file on my ftp box is daunting. In one game, there are comments nested 17 levels deep. If that doesn't break your parsing, it will probable work for most everything. You will also find all the usual nonsense, wrong o-o characters (should be alpha-o, not zero), and moves like 1.e4 with no space, etc...
User avatar
trojanfoe
Posts: 65
Joined: Sun Jul 31, 2011 11:57 am
Location: Waterlooville, Hampshire, UK

Re: looking for a complex PGN file for testing PGN parser

Post by trojanfoe »

bob wrote:
casaschi wrote:Hello.

I'm looking for a complex PGN file for testing a PGN parser. Something with complex variations and a variety of test cases.

I thought something like that should be already available, but I could not find anything from google.

Anyone with a link to such a test PGN file?

Thanks in advance.
The "enormous.pgn" file on my ftp box is daunting. In one game, there are comments nested 17 levels deep. If that doesn't break your parsing, it will probable work for most everything. You will also find all the usual nonsense, wrong o-o characters (should be alpha-o, not zero), and moves like 1.e4 with no space, etc...
What do you mean by 'comment nesting'?
User avatar
hgm
Posts: 27794
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: looking for a complex PGN file for testing PGN parser

Post by hgm »

trojanfoe wrote:What do you mean by 'comment nesting'?
Probably recursive variations.
Edmund
Posts: 670
Joined: Mon Dec 03, 2007 3:01 pm
Location: Barcelona, Spain

Re: looking for a complex PGN file for testing PGN parser

Post by Edmund »

just to be more precise.

Comments may not be nested according to the pgn specification. Only Variations can. Its the difference between {} and ().
5: Commentary


Comment text may appear in PGN data. There are two kinds of comments. The
first kind is the "rest of line" comment; this comment type starts with a
semicolon character and continues to the end of the line. The second kind
starts with a left brace character and continues to the next right brace
character. Comments cannot appear inside any token.


Brace comments do not nest; a left brace character appearing in a brace comment
loses its special meaning and is ignored. A semicolon appearing inside of a
brace comment loses its special meaning and is ignored. Braces appearing
inside of a semicolon comments lose their special meaning and are ignored.
8.2.5: Movetext RAV (Recursive Annotation Variation)


An RAV (Recursive Annotation Variation) is a sequence of movetext containing
one or more moves enclosed in parentheses. An RAV is used to represent an
alternative variation. The alternate move sequence given by an RAV is one that
may be legally played by first unplaying the move that appears immediately
prior to the RAV. Because the RAV is a recursive construct, it may be nested.
User avatar
trojanfoe
Posts: 65
Joined: Sun Jul 31, 2011 11:57 am
Location: Waterlooville, Hampshire, UK

Re: looking for a complex PGN file for testing PGN parser

Post by trojanfoe »

bob wrote:
casaschi wrote:Hello.

I'm looking for a complex PGN file for testing a PGN parser. Something with complex variations and a variety of test cases.

I thought something like that should be already available, but I could not find anything from google.

Anyone with a link to such a test PGN file?

Thanks in advance.
The "enormous.pgn" file on my ftp box is daunting. In one game, there are comments nested 17 levels deep. If that doesn't break your parsing, it will probable work for most everything. You will also find all the usual nonsense, wrong o-o characters (should be alpha-o, not zero), and moves like 1.e4 with no space, etc...
That is actually a very useful file Bob - I found several bugs in my PGN scanner/parser by testing against it. Many thanks!

-A
Rémi Coulom
Posts: 438
Joined: Mon Apr 24, 2006 8:06 pm

Re: looking for a complex PGN file for testing PGN parser

Post by Rémi Coulom »

Try this:

Code: Select all

[Event "This is an event with a \""]
[Site "This site has \\\\ xxx"]
[Date "1996.08.15"][Round "-"][White "White"][Black "Black"]
[Result "1/2-1/2"][SetUp "1"];I love comments
[FEN "1nbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/1NBQKBNR w KQkq - "]e4(d4;comment
d5!!2.c4$50(Nf3?))e5 Nf3{Comment !}Nc6 Nc3 Nf6 Bc4 Bc5 O-O O-O
% This is a line with an escape character !
@@@æææ {unexpected characters are skipped}
<> &#123;These symbols are reserved&#125;
1/2-1/2
User avatar
trojanfoe
Posts: 65
Joined: Sun Jul 31, 2011 11:57 am
Location: Waterlooville, Hampshire, UK

Re: looking for a complex PGN file for testing PGN parser

Post by trojanfoe »

Rémi Coulom wrote:Try this:

Code: Select all

&#91;Event "This is an event with a ""&#93;
&#91;Site "This site has \\\\ xxx"&#93;
&#91;Date "1996.08.15"&#93;&#91;Round "-"&#93;&#91;White "White"&#93;&#91;Black "Black"&#93;
&#91;Result "1/2-1/2"&#93;&#91;SetUp "1"&#93;;I love comments
&#91;FEN "1nbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/1NBQKBNR w KQkq - "&#93;e4&#40;d4;comment
d5!!2.c4$50&#40;Nf3?)&#41;e5 Nf3&#123;Comment !&#125;Nc6 Nc3 Nf6 Bc4 Bc5 O-O O-O
% This is a line with an escape character !
@@@æææ &#123;unexpected characters are skipped&#125;
<> &#123;These symbols are reserved&#125;
1/2-1/2
Yeah that causes my parser problems, however where does the PGN spec state that 'unexpected characters are skipped'?

-A
casaschi
Posts: 164
Joined: Wed Dec 23, 2009 1:57 pm

Re: looking for a complex PGN file for testing PGN parser

Post by casaschi »

Rémi Coulom wrote:Try this:

Code: Select all

&#91;Event "This is an event with a ""&#93;
&#91;Site "This site has \\\\ xxx"&#93;
&#91;Date "1996.08.15"&#93;&#91;Round "-"&#93;&#91;White "White"&#93;&#91;Black "Black"&#93;
&#91;Result "1/2-1/2"&#93;&#91;SetUp "1"&#93;;I love comments
&#91;FEN "1nbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/1NBQKBNR w KQkq - "&#93;e4&#40;d4;comment
d5!!2.c4$50&#40;Nf3?)&#41;e5 Nf3&#123;Comment !&#125;Nc6 Nc3 Nf6 Bc4 Bc5 O-O O-O
% This is a line with an escape character !
@@@æææ &#123;unexpected characters are skipped&#125;
<> &#123;These symbols are reserved&#125;
1/2-1/2
Thanks.
More of those would actually help (note my PGN parser complains about the FEN string since a couple of digits at the end are missing)
casaschi
Posts: 164
Joined: Wed Dec 23, 2009 1:57 pm

Re: looking for a complex PGN file for testing PGN parser

Post by casaschi »

trojanfoe wrote:
Rémi Coulom wrote:Try this:

Code: Select all

&#91;Event "This is an event with a ""&#93;
&#91;Site "This site has \\\\ xxx"&#93;
&#91;Date "1996.08.15"&#93;&#91;Round "-"&#93;&#91;White "White"&#93;&#91;Black "Black"&#93;
&#91;Result "1/2-1/2"&#93;&#91;SetUp "1"&#93;;I love comments
&#91;FEN "1nbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/1NBQKBNR w KQkq - "&#93;e4&#40;d4;comment
d5!!2.c4$50&#40;Nf3?)&#41;e5 Nf3&#123;Comment !&#125;Nc6 Nc3 Nf6 Bc4 Bc5 O-O O-O
% This is a line with an escape character !
@@@æææ &#123;unexpected characters are skipped&#125;
<> &#123;These symbols are reserved&#125;
1/2-1/2
Yeah that causes my parser problems, however where does the PGN spec state that 'unexpected characters are skipped'?

-A
I also believe that the standard does not allow comments in the "tag pair section", defined in section 8.1 as: "The tag pair section is composed of a series of zero or more tag pairs. A tag pair is composed of four consecutive tokens: ..."