mirror of
https://github.com/logos-messaging/negentropy.git
synced 2026-01-08 17:03:10 +00:00
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 mode = parseInt(items[0]);
|
||||||
let created = parseInt(items[1]);
|
let created = parseInt(items[1]);
|
||||||
let id = Buffer.from(items[2].trim(), 'hex');
|
let id = items[2].trim();
|
||||||
if (id.byteLength !== idSize) throw Error(`id should be ${idSize} bytes`);
|
if (id.length !== idSize*2) throw Error(`id should be ${idSize} bytes`);
|
||||||
|
|
||||||
if (mode === 1) {
|
if (mode === 1) {
|
||||||
x1.addItem(created, id);
|
x1.addItem(created, id);
|
||||||
@ -50,18 +50,18 @@ rl.once('close', () => {
|
|||||||
let [newQ, haveIds, needIds] = x1.reconcile(q);
|
let [newQ, haveIds, needIds] = x1.reconcile(q);
|
||||||
q = newQ;
|
q = newQ;
|
||||||
|
|
||||||
for (let id of haveIds) console.log(`xor,HAVE,${Buffer.from(id).toString('hex')}`);
|
for (let id of haveIds) console.log(`xor,HAVE,${id}`);
|
||||||
for (let id of needIds) console.log(`xor,NEED,${Buffer.from(id).toString('hex')}`);
|
for (let id of needIds) console.log(`xor,NEED,${id}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (q.length === 0) break;
|
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);
|
let [newQ, haveIds, needIds] = x2.reconcile(q);
|
||||||
q = newQ;
|
q = newQ;
|
||||||
|
|
||||||
console.error(`[${round}] SERVER -> CLIENT: ${q.byteLength} bytes`);
|
console.error(`[${round}] SERVER -> CLIENT: ${q.length / 2} bytes`);
|
||||||
|
|
||||||
round++;
|
round++;
|
||||||
}
|
}
|
||||||
|
|||||||
23
test/test.pl
23
test/test.pl
@ -5,17 +5,24 @@ use strict;
|
|||||||
unlink("negent-test.log");
|
unlink("negent-test.log");
|
||||||
|
|
||||||
|
|
||||||
note("Full upload");
|
my $langs = shift // 'cpp,js';
|
||||||
run("RECS=100000 FRAMESIZELIMIT1=60000 FRAMESIZELIMIT2=500000 P1=1 P2=0 P3=0 perl fuzz.pl cpp");
|
|
||||||
|
|
||||||
note("Full download");
|
|
||||||
run("RECS=100000 FRAMESIZELIMIT1=60000 FRAMESIZELIMIT2=500000 P1=0 P2=1 P3=0 perl fuzz.pl cpp");
|
|
||||||
|
|
||||||
note("Identical DBs");
|
foreach my $lang (split /,/, $langs) {
|
||||||
run("RECS=100000 FRAMESIZELIMIT1=60000 FRAMESIZELIMIT2=500000 P1=0 P2=0 P3=1 perl fuzz.pl cpp");
|
note("------LANG $lang ------");
|
||||||
|
|
||||||
note("Mixed");
|
note("Full upload");
|
||||||
run("RECS=100000 FRAMESIZELIMIT1=60000 FRAMESIZELIMIT2=500000 P1=1 P2=1 P3=5 perl fuzz.pl cpp");
|
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…
x
Reference in New Issue
Block a user