eschulte pushed a commit to branch go in repository elpa. commit 6bcc04a8149db051aac270ad16572e965dc347e2 Author: Eric Schulte <eric.schu...@gmx.com> Date: Thu May 17 16:43:32 2012 -0400
more capture tests, failing multistone captures --- sgf-files/1-capture.sgf | 6 ++++++ sgf-files/2-capture.sgf | 11 +++++++++++ sgf.el | 14 +++++++++++--- 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/sgf-files/1-capture.sgf b/sgf-files/1-capture.sgf new file mode 100644 index 0000000..6eb6f19 --- /dev/null +++ b/sgf-files/1-capture.sgf @@ -0,0 +1,6 @@ +(;EV[simple 1-stone capture] + S[4] + C[Here is a simple 1-stone capture used mainly as an example in tests.] + ;B[ba] + ;W[aa] + ;B[ab]) diff --git a/sgf-files/2-capture.sgf b/sgf-files/2-capture.sgf new file mode 100644 index 0000000..3379e3e --- /dev/null +++ b/sgf-files/2-capture.sgf @@ -0,0 +1,11 @@ +(;EV[simple 2-stone capture] + S[4] + C[Here is a simple 2-stone capture used mainly as an example in tests.] + ;B[ac] + ;B[ab] + ;B[ba] + ;B[cb] + ;B[cc] + ;W[bb] + ;W[bc] + ;B[bd]) diff --git a/sgf.el b/sgf.el index 0c1af36..64bbb12 100644 --- a/sgf.el +++ b/sgf.el @@ -603,6 +603,12 @@ (should (= 4 (length (neighbors board (/ (length board) 2))))) (should (= 3 (length (neighbors board 1)))))) +(ert-deftest sgf-singl-stone-capture () + (flet ((counts () (cons (stones-for local-board :b) + (stones-for local-board :w)))) + (with-sgf-file "sgf-files/1-capture.sgf" + (right 3) (should (tree-equal (counts) '(2 . 0)))))) + (ert-deftest sgf-remove-dead-stone-ko () (flet ((counts () (cons (stones-for local-board :b) (stones-for local-board :w)))) @@ -617,6 +623,8 @@ (should (tree-equal (counts) '(3 . 2))) (right 1) (should (tree-equal (counts) '(2 . 3)))))) -;; (ert-deftest sgf-remove-dead-stone () ) - -;; (ert-deftest sgf-remove-dead-stone-dragon () ) +(ert-deftest sgf-two-stone-capture () + (flet ((counts () (cons (stones-for local-board :b) + (stones-for local-board :w)))) + (with-sgf-file "sgf-files/2-capture.sgf" + (right 8) (should (tree-equal (counts) '(6 . 0))))))