I've found two bugs in the (scheme bytevector) library.
How the bug was found -- test/error was wrong!
I have noticed that the test/error macro in tests/test.stk doesn't actually do anything: it ignores errors, but doesn't complain when no error is produced! So I fixed it (will include in a later PR), and... Found several problems.
This is one of them -- now the test suite complains that we didn't error when the wrong index (non-aligned) was used.
Later I'll send a PR with a new test macro, and several fixes in SRFIs, in the core, and in tests.
1. Check arguments in bytevector-ieee-*-set!
Otherwise STklos crashes!
Also, convert all numbers to imprecise (except complexes) before storing them in the bytevector (only complexes can't be turned into reals -- for bignums, if they don't fit a double, we store an infinity; for rationals, if they're too small, they become zero.)
2. Check indices in some of the IEEE bytevector procedures
The spec (the only part of $R^7RS$ Large that was taken from $R^6RS$) says we need to access with proper alignment (multiples of 4 for single precision, and multiples of 8 for double precision). Fixed.
I've found two bugs in the
(scheme bytevector)
library.How the bug was found --
test/error
was wrong!I have noticed that the
test/error
macro intests/test.stk
doesn't actually do anything: it ignores errors, but doesn't complain when no error is produced! So I fixed it (will include in a later PR), and... Found several problems.This is one of them -- now the test suite complains that we didn't error when the wrong index (non-aligned) was used.
Later I'll send a PR with a new test macro, and several fixes in SRFIs, in the core, and in tests.
1. Check arguments in
bytevector-ieee-*-set!
Otherwise STklos crashes!
Also, convert all numbers to imprecise (except complexes) before storing them in the bytevector (only complexes can't be turned into reals -- for bignums, if they don't fit a double, we store an infinity; for rationals, if they're too small, they become zero.)
2. Check indices in some of the IEEE bytevector procedures
The spec (the only part of $R^7RS$ Large that was taken from $R^6RS$) says we need to access with proper alignment (multiples of 4 for single precision, and multiples of 8 for double precision). Fixed.