hare

The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit b082d6ffd94bb0baac4c48be20075e53b8ef6dcd
parent 8756875faf241bb52dd9614e4e685d0d6659c7d5
Author: Ajay Raghavan <w8x0@protonmail.com>
Date:   Thu, 13 Jan 2022 16:08:13 +0000

encoding/base64: Corrected encode() test function; Removed unused variable

Since we're using '..i', 'i < len(in)' will not cover all the test
cases. We need to use '<=' instead.

I also removed the 'badindex' array constant in the decode() test
function as we are not using it anywhere.

Diffstat:
Mencoding/base64/base64.ha | 3+--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/encoding/base64/base64.ha b/encoding/base64/base64.ha @@ -88,7 +88,7 @@ export fn encodestr(alphabet: []u8, b: []u8) str = { "Zm9vYmE=", "Zm9vYmFy" ]; - for (let i = 0z; i < len(in); i += 1) { + for (let i = 0z; i <= len(in); i += 1) { let s = encodestr(standard, in[..i]); defer free(s); assert(s == expect[i]); @@ -216,7 +216,6 @@ export fn decodeslice_static( "AA=A", "Zg==Zg==", ]; - const badindex: [_]size = [1, 2, 3, 0, 0, 1, 3, 4]; for (let i = 0z; i < len(bad); i += 1) { let result = decodestr(standard, bad[i]); assert(result is errors::invalid);