assert on the length of the backing buffer of the result

This commit is contained in:
Kevin Gibbons 2024-03-11 22:56:22 -07:00 committed by Jordan Harband
parent 44803f799c
commit 080c5490a2
No known key found for this signature in database
GPG Key ID: 9F6A681E35EF8B56
3 changed files with 6 additions and 0 deletions

View File

@ -21,5 +21,7 @@ var standardBase64Vectors = [
standardBase64Vectors.forEach(function (pair) {
var arr = Uint8Array.fromBase64(pair[0]);
assert.sameValue(Object.getPrototypeOf(arr), Uint8Array.prototype, "decoding " + pair[0]);
assert.sameValue(arr.length, pair[1].length, "decoding " + pair[0]);
assert.sameValue(arr.buffer.byteLength, pair[1].length, "decoding " + pair[0]);
assert.compareArray(arr, pair[1], "decoding " + pair[0]);
});

View File

@ -16,5 +16,7 @@ var whitespaceKinds = [
];
whitespaceKinds.forEach(function(pair) {
var arr = Uint8Array.fromBase64(pair[0]);
assert.sameValue(arr.length, 1);
assert.sameValue(arr.buffer.byteLength, 1);
assert.compareArray(arr, [102], "ascii whitespace: " + pair[1]);
});

View File

@ -22,5 +22,7 @@ var cases = [
cases.forEach(function (pair) {
var arr = Uint8Array.fromHex(pair[0]);
assert.sameValue(Object.getPrototypeOf(arr), Uint8Array.prototype, "decoding " + pair[0]);
assert.sameValue(arr.length, pair[1].length, "decoding " + pair[0]);
assert.sameValue(arr.buffer.byteLength, pair[1].length, "decoding " + pair[0]);
assert.compareArray(arr, pair[1], "decoding " + pair[0]);
});