mirror of
https://github.com/TheRealOwenRees/pgn_to_tex.git
synced 2026-11-18 04:42:07 +00:00
ci: add CI and GitHub Pages documentation workflows
This commit is contained in:
@@ -38,9 +38,8 @@ let test_path_takes_precedence_over_ply _ctxt =
|
||||
let path_fen = "8/8/8/8/8/8/4K3/7k w - - 0 1" in
|
||||
let ply_fen = "7k/8/8/8/8/8/8/4K3 b - - 0 1" in
|
||||
let json =
|
||||
Printf.sprintf
|
||||
{| [{"fen":"%s","path":["e4","e5"]},{"ply":2,"fen":"%s"}] |} path_fen
|
||||
ply_fen
|
||||
Printf.sprintf {| [{"fen":"%s","path":["e4","e5"]},{"ply":2,"fen":"%s"}] |}
|
||||
path_fen ply_fen
|
||||
in
|
||||
let diagrams = Pgn_to_tex.parse_diagrams_json json in
|
||||
let rendered = Pgn_to_tex.to_tex ~diagram_data:diagrams pgn in
|
||||
@@ -92,7 +91,8 @@ let test_malformed_json_yields_empty_diagrams _ctxt =
|
||||
~diagram_data:(Pgn_to_tex.parse_diagrams_json json)
|
||||
pgn
|
||||
in
|
||||
assert_equal ~printer:(fun x -> x)
|
||||
assert_equal
|
||||
~printer:(fun x -> x)
|
||||
~msg:("malformed JSON: " ^ json)
|
||||
expected actual)
|
||||
malformed
|
||||
|
||||
@@ -180,4 +180,3 @@ let suite =
|
||||
"diagram_clock" >:: test_diagram_clock;
|
||||
"no_diagram" >:: test_no_diagram;
|
||||
]
|
||||
|
||||
|
||||
@@ -187,4 +187,3 @@ let suite =
|
||||
"clock_inline" >:: test_clock_inline;
|
||||
"clock_in_comment" >:: test_clock_in_comment;
|
||||
]
|
||||
|
||||
|
||||
@@ -138,7 +138,10 @@ let test_pgn_with_clock_to_tex _ctxt =
|
||||
let test_default_arguments _ctxt =
|
||||
let actual = Pgn_to_tex.to_tex "1. e4 e5" in
|
||||
let expected =
|
||||
"\\title{}\n\\author{}\n\\date{}\\maketitle\n\\newchessgame\n\
|
||||
"\\title{}\n\
|
||||
\\author{}\n\
|
||||
\\date{}\\maketitle\n\
|
||||
\\newchessgame\n\
|
||||
\\textbf{1.} \\textbf{e4} \\textbf{e5}"
|
||||
in
|
||||
ae expected actual
|
||||
@@ -158,4 +161,3 @@ let suite =
|
||||
"default_arguments" >:: test_default_arguments;
|
||||
"invalid_pgn_raises" >:: test_invalid_pgn_raises;
|
||||
]
|
||||
|
||||
|
||||
@@ -70,8 +70,7 @@ let test_title_subtitle_author_fixture _ctxt =
|
||||
\newchessgame
|
||||
\textbf{1.} \textbf{d4} \textbf{d5} \textbf{2.} \textbf{c4} \textbf{dxc4} \textbf{3.} \textbf{e4} \textbf{Nf6} \textbf{4.} \textbf{e5} \textbf{Nd5} \textbf{5.} \textbf{Bxc4} \textbf{Nb6} \textbf{6.} \textbf{Bb3} \textbf{e6} ( 6... Nc6 ) \textbf{7.} \textbf{Nf3} \textbf{c5} \textbf{8.} \textbf{Be3} \textbf{N8d7} \textbf{9.} \textbf{O-O} \textbf{c4} \textbf{10.} \textbf{Bc2} \textbf{Nd5} \textbf{11.} \textbf{Nc3} \textbf{N7b6} \textbf{12.} \textbf{Be4} \textbf{Bb4} \textbf{13.} \textbf{Bxd5} \textbf{Nxd5} ( 13... Bxc3 ) \textbf{14.} \textbf{Nxd5} \textbf{exd5} \textbf{15.} \textbf{Qa4+} \textbf{Bd7} \textbf{16.} \textbf{Qxb4} \textbf{Qb6} \textbf{17.} \textbf{Qxb6} \textbf{axb6} \textbf{18.} \textbf{Rfc1} \textbf{O-O} \textbf{19.} \textbf{Nd2} \textbf{Bf5} \textbf{20.} \textbf{b3} \textbf{b5} \textbf{21.} \textbf{a4} \textbf{cxb3} \textbf{22.} \textbf{Nxb3} \textbf{bxa4} \textbf{23.} \textbf{Nc5} \textbf{b5} \textbf{24.} \textbf{Bd2} \textbf{Rfe8} \textbf{25.} \textbf{Bb4} \textbf{Rac8} \textbf{26.} \textbf{Nb7} \textbf{Rxc1+} \textbf{27.} \textbf{Rxc1} \textbf{Rc8} \textbf{28.} \textbf{Rxc8+} \textbf{Bxc8} \textbf{29.} \textbf{Nd6} \textbf{Bd7} \textbf{30.} \textbf{f4} \textbf{g6} \textbf{31.} \textbf{Kf2} \textbf{Kg7} \textbf{32.} \textbf{h3} \textbf{*}|}
|
||||
in
|
||||
assert_equal ~printer:(fun x -> x) expected
|
||||
(render_fixture "12.pgn")
|
||||
assert_equal ~printer:(fun x -> x) expected (render_fixture "12.pgn")
|
||||
|
||||
let test_empty_date_and_site_fixture_5 _ctxt =
|
||||
let tex = render_fixture "5.pgn" in
|
||||
@@ -104,13 +103,14 @@ let fixture_names () =
|
||||
let test_fixture_smoke =
|
||||
List.map
|
||||
(fun filename ->
|
||||
filename
|
||||
>:: fun _ctxt ->
|
||||
let tex = render_fixture filename in
|
||||
assert_bool (filename ^ " should render non-empty LaTeX")
|
||||
(String.length tex > 0);
|
||||
assert_bool (filename ^ " should contain document setup")
|
||||
(contains ~needle:"\\newchessgame" tex))
|
||||
filename >:: fun _ctxt ->
|
||||
let tex = render_fixture filename in
|
||||
assert_bool
|
||||
(filename ^ " should render non-empty LaTeX")
|
||||
(String.length tex > 0);
|
||||
assert_bool
|
||||
(filename ^ " should contain document setup")
|
||||
(contains ~needle:"\\newchessgame" tex))
|
||||
(fixture_names ())
|
||||
|
||||
let suite =
|
||||
|
||||
Reference in New Issue
Block a user