guix-commits
[Top][All Lists]
Advanced

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

01/02: openpgp: Fix argument order of 'fxbit-set?'.


From: guix-commits
Subject: 01/02: openpgp: Fix argument order of 'fxbit-set?'.
Date: Tue, 29 Sep 2020 16:53:54 -0400 (EDT)

civodul pushed a commit to branch master
in repository guix.

commit 680b80e37453d4e23ad8188d60894916e1c07162
Author: Lars-Dominik Braun <ldb@leibniz-psychology.org>
AuthorDate: Tue Sep 29 10:29:23 2020 +0200

    openpgp: Fix argument order of 'fxbit-set?'.
    
    * guix/openpgp.scm (fxbit-set?): Change to swap arguments compared to
    'bit-set?'.
    * tests/openpgp.scm (%binary-sample): New test vector.
    ("port-ascii-armored?, #t"): Add test.
    ("port-ascii-armored?, #f"): Add another test.
    
    Co-authored-by: Ludovic Courtès <ludo@gnu.org>
---
 guix/openpgp.scm  |  2 +-
 tests/openpgp.scm | 12 ++++++++++++
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/guix/openpgp.scm b/guix/openpgp.scm
index 33c8512..153752e 100644
--- a/guix/openpgp.scm
+++ b/guix/openpgp.scm
@@ -110,7 +110,7 @@
 (define-alias fx/ /)
 (define-alias fxdiv quotient)
 (define-alias fxand logand)
-(define-alias fxbit-set? bit-set?)
+(define-inlinable (fxbit-set? n index) (bit-set? index n))
 (define-alias fxbit-field bit-field)
 (define-alias bitwise-bit-field bit-field)
 (define-alias fxarithmetic-shift-left ash)
diff --git a/tests/openpgp.scm b/tests/openpgp.scm
index 0beab6f..c2be26f 100644
--- a/tests/openpgp.scm
+++ b/tests/openpgp.scm
@@ -50,6 +50,12 @@ vBSFjNSiVHsuAA==
 =AAAA
 -----END PGP MESSAGE-----\n")
 
+(define %binary-sample
+  ;; Same message as %radix-64-sample, decoded into bytevector.
+  (base16-string->bytevector
+  "c838013b6d96c411efecef17ecefe3ca0004ce8979ea250a897995f979a9\
+0ad9a9a9050a890ac5a9c945a940c1a2fcd2bc14858cd4a2547b2e00"))
+
 (define %civodul-fingerprint
   "3CE4 6455 8A84 FDC6 9DB4  0CFB 090B 1199 3D9A EBB5")
 
@@ -155,6 +161,12 @@ Pz7oopeN72xgggYUNT37ezqN3MeCqw0=
           read-radix-64))
     list))
 
+(test-assert "port-ascii-armored?, #t"
+  (call-with-input-string %radix-64-sample port-ascii-armored?))
+
+(test-assert "port-ascii-armored?, #f"
+  (not (port-ascii-armored? (open-bytevector-input-port %binary-sample))))
+
 (test-assert "get-openpgp-keyring"
   (let* ((key (search-path %load-path "tests/civodul.key"))
          (keyring (get-openpgp-keyring



reply via email to

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