1
0
Fork 0
mirror of https://github.com/codedread/bitjs synced 2025-10-06 02:39:55 +02:00

Fix bug with tee() so that endianness is also copied to teed stream.

This commit is contained in:
Jeff Schiller 2024-01-10 21:22:53 +09:00
parent 79c289afa1
commit 053d4bc127
2 changed files with 15 additions and 0 deletions

View file

@ -255,6 +255,8 @@ describe('bitjs.io.ByteStream', () => {
it('Tee', () => {
for (let i = 0; i < 4; ++i) array[i] = 65 + i;
const stream = new ByteStream(array.buffer);
// Set non-default endianness.
stream.setBigEndian(true);
const anotherArray = new Uint8Array(4);
for (let i = 0; i < 4; ++i) anotherArray[i] = 69 + i;
@ -265,5 +267,6 @@ describe('bitjs.io.ByteStream', () => {
teed.readBytes(5);
expect(stream.getNumBytesLeft()).equals(8);
expect(teed.getNumBytesLeft()).equals(3);
expect(teed.isLittleEndian()).equals(stream.isLittleEndian());
});
});