1
0
Fork 0
mirror of https://github.com/codedread/bitjs synced 2025-10-03 17:49:16 +02:00

Add some tests for BitStreams

This commit is contained in:
codedread 2018-01-19 08:35:51 -08:00
parent e7ef46fb78
commit 981ac156ac
2 changed files with 82 additions and 23 deletions

View file

@ -53,7 +53,7 @@ bitjs.io.ByteBuffer = class {
* @param {number} numBytes The number of bytes to write the number into.
*/
writeNumber(num, numBytes) {
if (numBytes < 1) {
if (numBytes < 1 || !numBytes) {
throw 'Trying to write into too few bytes: ' + numBytes;
}
if (num < 0) {