Commit7a9ba339Recorded4 May 2026Repositorysigil-crypto

test: fix let* bindings (Group A) and import (sigil math) for bitwise-xor (Group B)

Message

Group A — mpi-add/mpi-sub/mpi-mul tests used parallel 'let' to bind a, b, and (result (mpi- a b 4)) in the same form. Sigil's let is R7RS parallel-binding, so a and b were unbound when result's RHS was evaluated. Switched the three test bodies to let.

Group B — ecdsa-p256 and aes-128-gcm tampering tests reach for bitwise-xor to flip a bit, but the test file did not import the module that exports it. bitwise-xor is in (sigil math); added the import.

Changed
 test/test-crypto.sgl | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)
Diff
test/test-crypto.sglmodified
@@ -1,5 +1,6 @@
1
(import (sigil test)
2
(sigil crypto))
+2
(sigil crypto)
+3
(sigil math))
4
5
6
;; ============================================================
@@ -988,16 +989,16 @@
989
990
(test-group "mpi-add"
991
(test "1 + 2 = 3 (big-endian, 4 bytes)"
991
(let ((a #u8(0 0 0 1))
992
(b #u8(0 0 0 2))
993
(result (mpi-add a b 4)))
+992
(let* ((a #u8(0 0 0 1))
+993
(b #u8(0 0 0 2))
+994
(result (mpi-add a b 4)))
995
(assert-equal 3 (bytevector-u8-ref result 3)))))
996
997
(test-group "mpi-sub"
998
(test "5 - 3 = 2 (big-endian, 4 bytes)"
998
(let ((a #u8(0 0 0 5))
999
(b #u8(0 0 0 3))
1000
(result (mpi-sub a b 4)))
+999
(let* ((a #u8(0 0 0 5))
+1000
(b #u8(0 0 0 3))
+1001
(result (mpi-sub a b 4)))
1002
(assert-equal 2 (bytevector-u8-ref result 3))))
1003
1004
(test "3 - 5 yields |3 - 5| = 2 (absolute value, NOT modular wraparound)"
@@ -1009,9 +1010,9 @@
1010
1011
(test-group "mpi-mul"
1012
(test "3 * 4 = 12 (big-endian, 4 bytes)"
1012
(let ((a #u8(0 0 0 3))
1013
(b #u8(0 0 0 4))
1014
(result (mpi-mul a b 4)))
+1013
(let* ((a #u8(0 0 0 3))
+1014
(b #u8(0 0 0 4))
+1015
(result (mpi-mul a b 4)))
1016
(assert-equal 12 (bytevector-u8-ref result 3)))))
1017
1018