fix JS test harness, make default test script test both langs
This commit is contained in:
parent
b93ab38e66
commit
4ef8d9ab5a
|
@ -19,8 +19,8 @@ rl.on('line', (line) => {
|
|||
|
||||
let mode = parseInt(items[0]);
|
||||
let created = parseInt(items[1]);
|
||||
let id = Buffer.from(items[2].trim(), 'hex');
|
||||
if (id.byteLength !== idSize) throw Error(`id should be ${idSize} bytes`);
|
||||
let id = items[2].trim();
|
||||
if (id.length !== idSize*2) throw Error(`id should be ${idSize} bytes`);
|
||||
|
||||
if (mode === 1) {
|
||||
x1.addItem(created, id);
|
||||
|
@ -50,18 +50,18 @@ rl.once('close', () => {
|
|||
let [newQ, haveIds, needIds] = x1.reconcile(q);
|
||||
q = newQ;
|
||||
|
||||
for (let id of haveIds) console.log(`xor,HAVE,${Buffer.from(id).toString('hex')}`);
|
||||
for (let id of needIds) console.log(`xor,NEED,${Buffer.from(id).toString('hex')}`);
|
||||
for (let id of haveIds) console.log(`xor,HAVE,${id}`);
|
||||
for (let id of needIds) console.log(`xor,NEED,${id}`);
|
||||
}
|
||||
|
||||
if (q.length === 0) break;
|
||||
|
||||
console.error(`[${round}] CLIENT -> SERVER: ${q.byteLength} bytes`);
|
||||
console.error(`[${round}] CLIENT -> SERVER: ${q.length / 2} bytes`);
|
||||
|
||||
let [newQ, haveIds, needIds] = x2.reconcile(q);
|
||||
q = newQ;
|
||||
|
||||
console.error(`[${round}] SERVER -> CLIENT: ${q.byteLength} bytes`);
|
||||
console.error(`[${round}] SERVER -> CLIENT: ${q.length / 2} bytes`);
|
||||
|
||||
round++;
|
||||
}
|
||||
|
|
23
test/test.pl
23
test/test.pl
|
@ -5,17 +5,24 @@ use strict;
|
|||
unlink("negent-test.log");
|
||||
|
||||
|
||||
note("Full upload");
|
||||
run("RECS=100000 FRAMESIZELIMIT1=60000 FRAMESIZELIMIT2=500000 P1=1 P2=0 P3=0 perl fuzz.pl cpp");
|
||||
my $langs = shift // 'cpp,js';
|
||||
|
||||
note("Full download");
|
||||
run("RECS=100000 FRAMESIZELIMIT1=60000 FRAMESIZELIMIT2=500000 P1=0 P2=1 P3=0 perl fuzz.pl cpp");
|
||||
|
||||
note("Identical DBs");
|
||||
run("RECS=100000 FRAMESIZELIMIT1=60000 FRAMESIZELIMIT2=500000 P1=0 P2=0 P3=1 perl fuzz.pl cpp");
|
||||
foreach my $lang (split /,/, $langs) {
|
||||
note("------LANG $lang ------");
|
||||
|
||||
note("Mixed");
|
||||
run("RECS=100000 FRAMESIZELIMIT1=60000 FRAMESIZELIMIT2=500000 P1=1 P2=1 P3=5 perl fuzz.pl cpp");
|
||||
note("Full upload");
|
||||
run("RECS=100000 FRAMESIZELIMIT1=60000 FRAMESIZELIMIT2=500000 P1=1 P2=0 P3=0 perl fuzz.pl $lang");
|
||||
|
||||
note("Full download");
|
||||
run("RECS=100000 FRAMESIZELIMIT1=60000 FRAMESIZELIMIT2=500000 P1=0 P2=1 P3=0 perl fuzz.pl $lang");
|
||||
|
||||
note("Identical DBs");
|
||||
run("RECS=100000 FRAMESIZELIMIT1=60000 FRAMESIZELIMIT2=500000 P1=0 P2=0 P3=1 perl fuzz.pl $lang");
|
||||
|
||||
note("Mixed");
|
||||
run("RECS=100000 FRAMESIZELIMIT1=60000 FRAMESIZELIMIT2=500000 P1=1 P2=1 P3=5 perl fuzz.pl $lang");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue