1
0
Fork 0
mirror of https://github.com/demostf/demo.js synced 2026-06-04 00:54:14 +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; const propsToEncode = instanceBaseLine ? entity.diffFromBaseLine(instanceBaseLine) : entity.props;
// console.log(propsToEncode.map(prop => `${prop.definition.name}: ${prop.value}`));
const allProps = sendTable.flattenedProps; const allProps = sendTable.flattenedProps;
propsToEncode.sort((a, b) => allProps.findIndex(propDef => propDef.fullName === a.definition.fullName) - propsToEncode.sort((a, b) => allProps.findIndex(propDef => propDef.fullName === a.definition.fullName) -
allProps.findIndex(propDef => propDef.fullName === b.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'); const writeStream = createWriteStream(targetFile, 'utf8');
let index = 0;
const raw = new PassThrough();
raw.pipe(createGunzip()).pipe(writeStream);
parser.on('packet', (packet: Packet) => { parser.on('packet', (packet: Packet) => {
if (packet.packetType === 'packetEntities') { if (packet.packetType === 'packetEntities') {
for (const entity of packet.entities) { for (const entity of packet.entities) {
@ -29,20 +24,19 @@ function writeEntities(name: string) {
for (const prop of entity.props) { for (const prop of entity.props) {
entityProps[`${prop.definition.name}`] = prop.value; entityProps[`${prop.definition.name}`] = prop.value;
} }
raw.write(JSON.stringify({ writeStream.write(JSON.stringify({
tick: match.tick, tick: match.tick,
serverClass: entity.serverClass.name, serverClass: entity.serverClass.name,
id: entity.entityIndex, id: entity.entityIndex,
props: entityProps, props: entityProps,
pvs: entity.pvs pvs: entity.pvs
}) + '\n'); }) + '\n');
index++;
} }
} }
}); });
parser.parseBody(); parser.parseBody();
raw.end(); writeStream.end();
} }
function testEntities(name: string, entityCount: number) { function testEntities(name: string, entityCount: number) {
@ -91,7 +85,7 @@ function testEntities(name: string, entityCount: number) {
parseEntities(); parseEntities();
} }
const result = resultData.shift(); const result = resultData.shift();
assert.deepEqual(data, result); assert.deepEqual(data, result, `Failed asserting that packet ${parsed} is the same`);
parsed++; parsed++;
}).on('end', () => { }).on('end', () => {
assert.equal(resultData.length, 0, 'Entities left to be checked'); assert.equal(resultData.length, 0, 'Entities left to be checked');

View file

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