emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] 08/255: parsing simple trees


From: Eric Schulte
Subject: [elpa] 08/255: parsing simple trees
Date: Sun, 16 Mar 2014 01:02:09 +0000

eschulte pushed a commit to branch go
in repository elpa.

commit aa6169a6b0e3c37470130f10503f5a6c6d8a3344
Author: Eric Schulte <address@hidden>
Date:   Tue May 15 07:51:36 2012 -0400

    parsing simple trees
---
 sgf.el |   28 ++++++++++++++++++++--------
 1 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/sgf.el b/sgf.el
index 2d72eb3..1e0f1f0 100644
--- a/sgf.el
+++ b/sgf.el
@@ -102,9 +102,9 @@
     (setq start (match-beginning 2))
     (let ((cont-p (string= (match-string 2 str) "("))
           (tree-part (parse-nodes (match-string 1 str))))
-      (if cont-p
-          (list tree-part res)
-        (cons tree-part res)))))
+      (setq res (if cont-p
+                    (list tree-part res)
+                  (cons tree-part res))))))
 
 
 ;;; Tests
@@ -127,11 +127,23 @@
 
 (ert-deftest sgf-parse-one-large-node-test ()
   (let* ((str ";GM[1]FF[4]
-    SZ[19]
-    GN[GNU Go 3.7.11 load and print]
-    DT[2008-12-14]
-    KM[0.0]HA[0]RU[Japanese]AP[GNU Go:3.7.11]AW[ja][oa]
-    [pa][db][eb]")
+               SZ[19]
+               GN[GNU Go 3.7.11 load and print]
+               DT[2008-12-14]
+               KM[0.0]HA[0]RU[Japanese]AP[GNU Go:3.7.11]AW[ja][oa]
+               [pa][db][eb]")
          (node (car (parse-nodes str))))
     (should (= (length node) 10))
     (should (= (length (cdar (last node))) 5))))
+
+(ert-deftest sgf-parse-simple-tree ()
+  (let* ((str "(;GM[1]FF[4]
+               SZ[19]
+               GN[GNU Go 3.7.11 load and print]
+               DT[2008-12-14]
+               KM[0.0]HA[0]RU[Japanese]AP[GNU Go:3.7.11]AW[ja][oa]
+               [pa][db][eb])")
+         (tree (parse-trees str)))
+    (should (= 1  (length tree)))
+    (should (= 1  (length (car tree))))
+    (should (= 10 (length (caar tree))))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]