Only Spätzle-IX asks for 50% reach, now that Tier 1 cones count

This commit is contained in:
Frederic Jung 2026-10-28 19:37:40 +01:00
parent 9279908f7d
commit e0a02276a2
No known key found for this signature in database
11 changed files with 24 additions and 10 deletions

View file

@ -409,8 +409,8 @@ test('#114 Only Spätzle-IX can be won by peering alone', () => {
const { ev, errors } = load();
ev("ACT.startScn({id:'stg',sure:1})");
assert.equal(ev("scnRule('local')&&scnRule('noTransit')"), true);
assert.match(ev("SCN.find(x=>x.id==='stg').goal"), /45%.*300 Gbps/);
assert.deepEqual(JSON.parse(ev("JSON.stringify(scnProg().items.map(x=>x.max))")), [0.45, 300]);
assert.match(ev("SCN.find(x=>x.id==='stg').goal"), /50%.*300 Gbps/);
assert.deepEqual(JSON.parse(ev("JSON.stringify(scnProg().items.map(x=>x.max))")), [0.5, 300]);
// a game saved before the fix picks the rule up on load
ev("const o=JSON.parse(JSON.stringify(S));delete o.scn.rules.local;migrate(o);window.__mig=o.scn.rules.local");
assert.equal(ev('window.__mig'), true);

View file

@ -182,3 +182,16 @@ test('a traceroute down a two-level cone shows every network on the way', () =>
assert.equal(ev("R.cone.ddo"), 'ntt');
assert.deepEqual(errors, []);
});
test('#114 Only Spätzle-IX still takes more than the exchange and two Tier 1 PNIs, now that cones count', () => {
const { ev, errors } = load();
ev("UI.pitched=true;beginGame('T','stg',{scn:SCN.find(x=>x.id==='stg')});S.cash=1e9;S.lvl=10;S.pops.stg.bb={d:400};S.ixp.stg=0;for(const id of ixMembers('stg'))S.peers[id+'@stg']=1;compute()");
const reach = (ts) => ev(`S.pni=[];for(const t of ${JSON.stringify(ts)})S.pni.push({id:'p'+t,net:t,city:'stg',tier:2});compute();R.reach`);
const T = ['lvl', 'ntt', 'tly', 'cog', 'tat'];
const goal = ev("SCN.find(x=>x.id==='stg').ok.toString()");
assert.match(goal, /R\.reach>=0\.5/);
for (let i = 0; i < T.length; i++) for (let j = i + 1; j < T.length; j++)
assert.ok(reach([T[i], T[j]]) < 0.5, `${T[i]}+${T[j]} is not enough`);
assert.ok(reach(['lvl', 'ntt', 'tly']) >= 0.5, 'three Tier 1 PNIs and the exchange can be');
assert.deepEqual(errors, []);
});