mirror of
https://github.com/demostf/demo.js
synced 2026-06-04 09:04:13 +02:00
handle string table compression
This commit is contained in:
parent
a771702307
commit
31440704d6
5 changed files with 31 additions and 7 deletions
BIN
src/tests/data/packetMessageFirst.bin
Normal file
BIN
src/tests/data/packetMessageFirst.bin
Normal file
Binary file not shown.
|
|
@ -3,9 +3,10 @@ import {readFileSync} from 'fs';
|
|||
import {PacketTypeId} from '../../../../Data/Packet';
|
||||
import {ParserState} from '../../../../Data/ParserState';
|
||||
import {PacketMessageHandler} from '../../../../Parser/Message/Packet';
|
||||
import {assertEncoder, assertParser, getStream} from '../Packet/PacketTest';
|
||||
import {assertEncoder, assertParser, assertReEncode, getStream} from '../Packet/PacketTest';
|
||||
|
||||
const data = Object.values(JSON.parse(readFileSync(__dirname + '/../../../data/packetMessageData.json', 'utf8')));
|
||||
const firstPacketData = readFileSync(__dirname + '/../../../data/packetMessageFirst.bin');
|
||||
const expected = JSON.parse(readFileSync(__dirname + '/../../../data/packetMessageResult.json', 'utf8'));
|
||||
|
||||
const getParserState = (fastMode) => {
|
||||
|
|
@ -40,4 +41,14 @@ suite('Packet', () => {
|
|||
// shorted since empty entity list encoded, instead of skipping over entities
|
||||
assertEncoder(parser, encoder, expected, 920, '');
|
||||
});
|
||||
|
||||
test('Encode first packet message', () => {
|
||||
const expected = parser(new BitStream(firstPacketData));
|
||||
assertEncoder(parser, encoder, expected, 1512600, '');
|
||||
});
|
||||
|
||||
test('Re-encode packet message', () => {
|
||||
// shorted since empty entity list encoded, instead of skipping over entities
|
||||
assertReEncode(parser, encoder, new BitStream(firstPacketData));
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue