[s-xml-rpc-cvs] CVS s-xml-rpc/test

scaekenberghe scaekenberghe at common-lisp.net
Fri Feb 15 15:42:41 UTC 2008


Update of /project/s-xml-rpc/cvsroot/s-xml-rpc/test
In directory clnet:/tmp/cvs-serv13386/test

Modified Files:
	test-xml-rpc.lisp 
Log Message:
fixed a bug reported by Evgeniy Zamriy:
<boolean>0</boolean> was decoded incorrectly as an empty string instead of as nil
fixed second clause in :|value| handling testing (null seed) instead of (null (car seed))
added more decoding tests to cope with regression, seems ok


--- /project/s-xml-rpc/cvsroot/s-xml-rpc/test/test-xml-rpc.lisp	2006/04/19 10:22:31	1.3
+++ /project/s-xml-rpc/cvsroot/s-xml-rpc/test/test-xml-rpc.lisp	2008/02/15 15:42:40	1.4
@@ -1,6 +1,6 @@
 ;;;; -*- mode: lisp -*-
 ;;;;
-;;;; $Id: test-xml-rpc.lisp,v 1.3 2006/04/19 10:22:31 scaekenberghe Exp $
+;;;; $Id: test-xml-rpc.lisp,v 1.4 2008/02/15 15:42:40 scaekenberghe Exp $
 ;;;;
 ;;;; Unit and functional tests for xml-rpc.lisp
 ;;;;
@@ -112,7 +112,7 @@
    " fgo " 
    -31 
    "" 
-   -12.214 
+   -12.214D0 
    ,(xml-rpc-time (iso8601->universal-time  "19980717T14:08:55")) 
    #(121 111 117 32 99 97 110 39 116 32 114 101 97 100 32 116 104 105 115 33)))))
 
@@ -134,6 +134,26 @@
 </array>"))
 '("XYZ")))
 
+;; double decoding
+
+(assert (< (abs (- (decode-xml-rpc (make-string-input-stream "<value><double>3.141592653589793</double></value>"))
+                   pi))
+           0.000000000001D0))
+
+;; string decoding
+
+(assert (equal (decode-xml-rpc (make-string-input-stream "<value><string>foo</string></value>"))
+               "foo"))
+
+(assert (equal (decode-xml-rpc (make-string-input-stream "<value>foo</value>"))
+               "foo"))
+
+(assert (equal (decode-xml-rpc (make-string-input-stream "<value><string></string></value>"))
+               ""))
+
+(assert (equal (decode-xml-rpc (make-string-input-stream "<value></value>"))
+               ""))
+
 ;; boolean encoding
 
 (assert (equal (with-output-to-string (out)
@@ -144,4 +164,13 @@
                  (encode-xml-rpc-value nil out))
                "<value><boolean>0</boolean></value>"))
 
+
+;; boolean decoding
+
+(assert (equal (decode-xml-rpc (make-string-input-stream "<value><boolean>1</boolean></value>"))
+               t))
+
+(assert (equal (decode-xml-rpc (make-string-input-stream "<value><boolean>0</boolean></value>"))
+               nil))
+
 ;;;; eof




More information about the S-xml-rpc-cvs mailing list