mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-03 22:56:33 +02:00
gpgscm,tests: Add new functions to the test environment.
* tests/gpgscm/lib.scm (first, last, powerset): New functions. * tests/gpgscm/tests.scm (interactive-shell): New function. * tests/openpgp/Makefile.am (EXTRA_DIST): Add new file. * tests/openpgp/README: Document 'interactive-shell'. * tests/openpgp/shell.scm: New file. Signed-off-by: Justus Winter <justus@g10code.com>
This commit is contained in:
parent
d10b67b9bc
commit
1ec07cbc20
5 changed files with 63 additions and 2 deletions
|
@ -42,6 +42,24 @@
|
|||
((not (p (car l))) #f)
|
||||
(else (all p (cdr l)))))
|
||||
|
||||
;; Return the first element of a list.
|
||||
(define first car)
|
||||
|
||||
;; Return the last element of a list.
|
||||
(define (last lst)
|
||||
(if (null? (cdr lst))
|
||||
(car lst)
|
||||
(last (cdr lst))))
|
||||
|
||||
;; Compute the powerset of a list.
|
||||
(define (powerset set)
|
||||
(if (null? set)
|
||||
'(())
|
||||
(let ((rst (powerset (cdr set))))
|
||||
(append (map (lambda (x) (cons (car set) x))
|
||||
rst)
|
||||
rst))))
|
||||
|
||||
;; Is PREFIX a prefix of S?
|
||||
(define (string-prefix? s prefix)
|
||||
(and (>= (string-length s) (string-length prefix))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue