1
0
Fork 0
mirror of https://github.com/demostf/demo.js synced 2026-06-03 16:44:12 +02:00

update test data

The decoding should be a bit more reliable now so this snapshot should be "more correct"
This commit is contained in:
Robin Appelman 2017-09-16 18:30:11 +02:00
commit d8f01428c5
4 changed files with 6 additions and 10 deletions

View file

@ -97,6 +97,8 @@ function writeEnterPVS(entity: PacketEntity, stream: BitStream, state: ParserSta
const propsToEncode = instanceBaseLine ? entity.diffFromBaseLine(instanceBaseLine) : entity.props;
// console.log(propsToEncode.map(prop => `${prop.definition.name}: ${prop.value}`));
const allProps = sendTable.flattenedProps;
propsToEncode.sort((a, b) => allProps.findIndex(propDef => propDef.fullName === a.definition.fullName) -
allProps.findIndex(propDef => propDef.fullName === b.definition.fullName));

Binary file not shown.

View file

@ -17,11 +17,6 @@ function writeEntities(name: string) {
const writeStream = createWriteStream(targetFile, 'utf8');
let index = 0;
const raw = new PassThrough();
raw.pipe(createGunzip()).pipe(writeStream);
parser.on('packet', (packet: Packet) => {
if (packet.packetType === 'packetEntities') {
for (const entity of packet.entities) {
@ -29,20 +24,19 @@ function writeEntities(name: string) {
for (const prop of entity.props) {
entityProps[`${prop.definition.name}`] = prop.value;
}
raw.write(JSON.stringify({
writeStream.write(JSON.stringify({
tick: match.tick,
serverClass: entity.serverClass.name,
id: entity.entityIndex,
props: entityProps,
pvs: entity.pvs
}) + '\n');
index++;
}
}
});
parser.parseBody();
raw.end();
writeStream.end();
}
function testEntities(name: string, entityCount: number) {
@ -91,7 +85,7 @@ function testEntities(name: string, entityCount: number) {
parseEntities();
}
const result = resultData.shift();
assert.deepEqual(data, result);
assert.deepEqual(data, result, `Failed asserting that packet ${parsed} is the same`);
parsed++;
}).on('end', () => {
assert.equal(resultData.length, 0, 'Entities left to be checked');

View file

@ -54,6 +54,6 @@ suite('PacketEntity', () => {
const baseLine = hydrateEntity(playerBaseLineData);
const entity = hydrateEntity(playerEntityData);
assert.deepEqual(entity.diffFromBaseLine(baseLine.props).length, 75);
assert.deepEqual(entity.diffFromBaseLine(baseLine.props).length, 96);
});
});