diff options
author | Ludovic Courtès <ludo@gnu.org> | 2009-06-19 00:10:21 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2009-06-19 00:10:21 +0200 |
commit | 55bf8cb7af47cde26e6a70dae056752c8265508d (patch) | |
tree | ab1ae884b5535611850e1f420ac4c6799a611029 | |
parent | b242715b288b8f076d1617668e77f1ef44dfeeb3 (diff) | |
download | guile-55bf8cb7af47cde26e6a70dae056752c8265508d.tar.gz |
Fix `equal?' on bytevectors.
* libguile/bytevectors.c (bytevector_equal_p): New function.
* test-suite/tests/bytevectors.test ("2.3 Operations on Bytes and
Octets")["equal?"]: New test.
-rw-r--r-- | libguile/bytevectors.c | 5 | ||||
-rw-r--r-- | test-suite/tests/bytevectors.test | 7 |
2 files changed, 11 insertions, 1 deletions
diff --git a/libguile/bytevectors.c b/libguile/bytevectors.c index 0846d9120..2484a64a4 100644 --- a/libguile/bytevectors.c +++ b/libguile/bytevectors.c @@ -300,6 +300,11 @@ SCM_SMOB_PRINT (scm_tc16_bytevector, print_bytevector, return 1; } +SCM_SMOB_EQUALP (scm_tc16_bytevector, bytevector_equal_p, bv1, bv2) +{ + return scm_bytevector_eq_p (bv1, bv2); +} + SCM_SMOB_FREE (scm_tc16_bytevector, free_bytevector, bv) { diff --git a/test-suite/tests/bytevectors.test b/test-suite/tests/bytevectors.test index c7697b13c..95d6c403a 100644 --- a/test-suite/tests/bytevectors.test +++ b/test-suite/tests/bytevectors.test @@ -123,7 +123,12 @@ (bytevector-sint-set! b 0 -16 (endianness big) 2) (bytevector-sint-set! b 1 -16 (endianness little) 2) (equal? (bytevector->u8-list b) - '(#xff #xf0 #xff))))) + '(#xff #xf0 #xff)))) + + (pass-if "equal?" + (let ((bv1 (u8-list->bytevector (iota 123))) + (bv2 (u8-list->bytevector (iota 123)))) + (equal? bv1 bv2)))) (with-test-prefix "2.4 Operations on Integers of Arbitrary Size" |