| 72 gamestate_init(&gamestate); |
72 gamestate_init(&gamestate); |
| 73 char *chkpgn = NULL; |
73 char *chkpgn = NULL; |
| 74 CX_TEST_DO { |
74 CX_TEST_DO { |
| 75 const enum expected_result rs = pgn_data[index-1][0]; |
75 const enum expected_result rs = pgn_data[index-1][0]; |
| 76 const char *pgn = pgn_data[index-1]+1; |
76 const char *pgn = pgn_data[index-1]+1; |
| 77 int result = parse_pgn(pgn, &gamestate); |
77 pgn_result result = parse_pgn(pgn, &gamestate); |
| 78 char msg[64]; |
78 char msg[64]; |
| 79 sprintf(msg, "failed to parse game%03u.pgn: code %d, pos: %zu", |
79 sprintf(msg, |
| 80 index, result, pgn_error_position()); |
80 "failed to parse game%03u.pgn: code %d, pos: %zu, merr: %d", |
| 81 CX_TEST_ASSERTM(result == pgn_no_error, msg); |
81 index, result.code, result.position, result.move_error); |
| |
82 CX_TEST_ASSERTM(result.code == pgn_no_error, msg); |
| 82 CX_TEST_CALL_SUBROUTINE(verify_expected_result, &gamestate, rs); |
83 CX_TEST_CALL_SUBROUTINE(verify_expected_result, &gamestate, rs); |
| 83 |
84 |
| 84 /* check if we get the PGN text back */ |
85 /* check if we get the PGN text back */ |
| 85 chkpgn = create_pgn(&gamestate, false); |
86 chkpgn = create_pgn(&gamestate, false); |
| 86 /* find move blocks (ignore the STR) */ |
87 /* find move blocks (ignore the STR) */ |