From 363ae1da82cbb83b57b57f78b716125b79e2ac39 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sat, 28 Dec 2013 15:47:35 +0100 Subject: pk-crypto: Add 'canonical-sexp-length' and related procedures. * guix/pk-crypto.scm (canonical-sexp-length, canonical-sexp-null?, canonical-sexp-list?): New procedures. * tests/pk-crypto.scm ("canonical-sexp-length", "canonical-sexp-list?"): New tests. --- tests/pk-crypto.scm | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tests') diff --git a/tests/pk-crypto.scm b/tests/pk-crypto.scm index 8da533f5b2..3135d5a60c 100644 --- a/tests/pk-crypto.scm +++ b/tests/pk-crypto.scm @@ -82,6 +82,18 @@ (define %key-pair (gc) +(test-equal "canonical-sexp-length" + '(0 1 2 4 0 0) + (map (compose canonical-sexp-length string->canonical-sexp) + '("()" "(a)" "(a b)" "(a #616263# b #C001#)" "a" "#123456#"))) + +(test-equal "canonical-sexp-list?" + '(#t #f #t #f) + (map (compose canonical-sexp-list? string->canonical-sexp) + '("()" "\"abc\"" "(a b c)" "#123456#"))) + +(gc) + (test-equal "canonical-sexp-car + cdr" '("(b \n (c xyz)\n )") (let ((lst (string->canonical-sexp "(a (b (c xyz)))"))) -- cgit v1.2.3