feat(world): seven French cities, four French networks, and the Atlantic cables on the Atlantic coast
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
5b24282224
commit
6906a333b3
19 changed files with 129 additions and 21 deletions
50
tests/france.test.js
Normal file
50
tests/france.test.js
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
const test = require('node:test');
|
||||
const assert = require('node:assert/strict');
|
||||
const { load } = require('./harness');
|
||||
|
||||
const start = "ACT.start({});S.cash=1e9;S.nextFail=1e9;S.nextEvent=1e9;for(const g of GOALS)S.done[g.id]=0";
|
||||
const NEW = { lys: ['Lyon', 'Quenelle-IX'], tls: ['Toulouse', 'Cassoulet-IX'], lil: ['Lille', 'Maroilles-IX'], bod: ['Bordeaux', 'Claret-IX'],
|
||||
sxb: ['Strasbourg', 'Choucroute-IX'], rns: ['Rennes', 'Galette-IX'], nte: ['Nantes', ''] };
|
||||
|
||||
test('Lyon, Toulouse, Lille, Bordeaux, Strasbourg, Rennes and Nantes are French cities on land, with a seller of transit each', () => {
|
||||
const { ev, errors } = load();
|
||||
ev(start);
|
||||
for (const [id, [name, ix]] of Object.entries(NEW)) {
|
||||
assert.equal(ev(`CITY.${id}.name`), name);
|
||||
assert.equal(ev(`CITY.${id}.cc`), 'FR');
|
||||
assert.equal(ev(`CITY.${id}.ix`), ix);
|
||||
assert.equal(ev(`onLand(CITY.${id}.x,CITY.${id}.y)`), true, `${id} is on drawn land`);
|
||||
assert.equal(ev(`NETS.some(n=>sellsAt(n,'${id}'))`), true, `${id} has a transit seller`);
|
||||
assert.equal(ev(`CITY_PDB.${id}.length`), 3, `${id} has calibration`);
|
||||
}
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
test('SF-Error Telecom, Boy-Egg Telecom, Ov-Hatch Cloud and Scale-Away carry the real ASNs, and Orange and Free reach the new cities', () => {
|
||||
const { ev, errors } = load();
|
||||
ev(start);
|
||||
assert.deepEqual(['sfe', 'byg', 'ovh', 'sca'].map((n) => ev(`NET.${n}.asn`)), [15557, 5410, 16276, 12876]);
|
||||
assert.deepEqual(['sfe', 'byg', 'ovh', 'sca'].map((n) => ev(`NET.${n}.name`)), ['SF-Error Telecom', 'Boy-Egg Telecom', 'Ov-Hatch Cloud', 'Scale-Away']);
|
||||
for (const c of Object.keys(NEW)) for (const n of ['tng', 'fre', 'sfe', 'byg']) assert.equal(ev(`NET.${n}.pops.includes('${c}')`), true, `${n} is in ${c}`);
|
||||
assert.equal(ev("NET.ovh.pops.includes('sxb')&&NET.ovh.ix.includes('sxb')"), true, 'Ov-Hatch is on EuroRhine-IX in Strasbourg');
|
||||
for (const c of ['lys', 'tls', 'lil', 'bod', 'sxb']) assert.equal(ev(`NET.cog.pops.includes('${c}')`), true, `Cogentle is in ${c}, where PeeringDB lists Cogent`);
|
||||
assert.equal(ev("NET.adt.pops.includes('tls')"), true, 'Andorra’s telco comes up to Toulouse');
|
||||
assert.equal(ev("NETS.filter(n=>n.type!=='cdn'&&[].concat(n.cc||[]).includes('FR')&&n.pops.includes('lys')).length>=4"), true, 'four consumer networks in Lyon');
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
test('Ami-Tea comes ashore at Bordeaux and Dunno-ant at Nantes, and Dunno-ant starts at Virginia Beach, not New Jersey', () => {
|
||||
const { ev, errors } = load();
|
||||
ev(start);
|
||||
const pairs = (id) => JSON.parse(ev(`JSON.stringify(CABLES.find(c=>c.id==='${id}').pairs.map(p=>p.slice(0,2)))`));
|
||||
assert.deepEqual(pairs('amitie'), [['nyc', 'lon'], ['nyc', 'bod']]);
|
||||
assert.deepEqual(pairs('dunant'), [['ash', 'nte']]);
|
||||
assert.deepEqual(JSON.parse(ev("JSON.stringify(CABLES.find(c=>c.id==='dunant').pairs[0][2][0])")), [-75.7, 36.85]);
|
||||
for (const id of ['amitie', 'dunant']) {
|
||||
const wp = JSON.parse(ev(`JSON.stringify(CABLES.find(c=>c.id==='${id}').pairs.flatMap(p=>p[2].map(w=>{const q=proj(w[0],w[1]);return onLand(q[0],q[1])})))`));
|
||||
assert.ok(wp.every((x) => !x), `${id}: every waypoint is at sea`);
|
||||
}
|
||||
assert.equal(ev("CABLE_PAIRS.some(p=>p.cid==='dunant'&&(p.a==='par'||p.b==='par'))"), false, 'nothing lands in inland Paris any more');
|
||||
for (const z of [0.35, 1.4, 6]) ev(`cam.z=${z};draw(performance.now())`);
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
|
@ -599,17 +599,18 @@ test('#66 #68 subsea optics: engineered glass reaches further, and the same limi
|
|||
// counted as land glass it would be 400G, which is what #66 saw
|
||||
ev("S.links.find(l=>l.id==='oc').sub=false;compute()");
|
||||
assert.equal(ev("dfCap(S.links.find(l=>l.id==='oc'))"), 400);
|
||||
// leased waves: transatlantic London–New York still takes 6.4T (4×1.6T); Paris–Ashburn tops out at 800G
|
||||
// leased waves: transatlantic London–New York still takes 6.4T (4×1.6T); Nantes–Ashburn tops out at 800G
|
||||
assert.equal(ev("subWaveWhy(5,cablesFor('lon','nyc')[0].km,true)"), '');
|
||||
assert.match(ev("subWaveWhy(4,cablesFor('par','ash')[0].km,true)"), /at most 1.2T per carrier/);
|
||||
assert.equal(ev("LT[subMaxTier(cablesFor('par','ash')[0].km)].n"), '800G');
|
||||
assert.match(ev("subWaveWhy(4,cablesFor('nte','ash')[0].km,true)"), /at most 1.2T per carrier/);
|
||||
assert.equal(ev("LT[subMaxTier(cablesFor('nte','ash')[0].km)].n"), '800G');
|
||||
assert.equal(ev("LT[subMaxTier(14000)].n"), '400G', 'the longest cables carry 400G waves');
|
||||
assert.equal(ev("subWaveWhy(5,4000,false)"), '', 'land waves are not capped this way');
|
||||
// buying a too-big wave is refused; an old one keeps running
|
||||
ev("UI.pending={a:'par',b:'ash'};UI.via=cablesFor('par','ash')[0].cid;const n=S.links.length;ACT.buildLink({tier:4});window.__d=S.links.length-n");
|
||||
assert.equal(ev('__d'), 0, 'no 1.6T wave across 6,670 km');
|
||||
ev("ACT.buildPop({city:'nte'});S.pops.nte.rgen=3;compute()");
|
||||
ev("UI.pending={a:'nte',b:'ash'};UI.via=cablesFor('nte','ash')[0].cid;const n=S.links.length;ACT.buildLink({tier:4});window.__d=S.links.length-n");
|
||||
assert.equal(ev('__d'), 0, 'no 1.6T wave across 6,473 km');
|
||||
ev("ACT.buildLink({tier:3})");
|
||||
const w = "S.links.find(l=>l.kind==='wave'&&l.a==='par')";
|
||||
const w = "S.links.find(l=>l.kind==='wave'&&(l.a==='nte'||l.b==='nte'))";
|
||||
assert.equal(ev(`${w}.tier`), 3, '800G is fine');
|
||||
ev(`ACT.upLink({id:${w}.id,tier:4})`);
|
||||
assert.equal(ev(`${w}.tier`), 3, 'and it cannot be upgraded past the cable');
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ const PLAY = {
|
|||
stg: { ref: [['bb', 'stg'], ['ix', 'stg'], ['link', 'stg', 'fra', 1], ['ix', 'fra'], ['bb', 'fra'], ['link', 'fra', 'ams', 1], ['ix', 'ams'], ['bb', 'ams'], ['link', 'ams', 'lon', 1], ['ix', 'lon'], ['bb', 'lon'], ['link', 'fra', 'par', 1], ['ix', 'par'], ['bb', 'par'], ['hire', ['routers', 'repair', 'caches', 'pni', 'ix', 'sales'], { pni: { paid: true } }], ['link', 'stg', 'muc', 1], ['ix', 'muc'], ['bb', 'muc'], ['wait', 120], ['pnis'], ['link', 'lon', 'nyc', 2], ['ix', 'nyc'], ['bb', 'nyc'], ['wait', 200], ['pnis']],
|
||||
win: [120, 240], cheese: [['bb', 'stg'], ['ix', 'stg'], ['link', 'stg', 'fra', 1], ['ix', 'fra'], ['bb', 'fra'], ['loans'], ['hire', ['routers', 'repair']]], by: null },
|
||||
// The other way round the planet: Paris, New York, Los Angeles, Tokyo, Hong Kong, Singapore.
|
||||
redsea: { ref: [...home('mrs'), ['link', 'mrs', 'par', 1], ['bb', 'par'], ['ix', 'par'], ['link', 'par', 'nyc', 1, 'amitie'], ['tr', 'nyc', 1], ['ix', 'nyc'], ['link', 'nyc', 'lax', 1], ['ix', 'lax'], ['tr', 'lax', 1], ['link', 'lax', 'tok', 1, 'jup'], ['bb', 'tok'], ['tr', 'tok', 1], ['ix', 'tok'], ['link', 'tok', 'hkg', 1, 'apg'], ['bb', 'hkg'], ['tr', 'hkg', 1], ['ix', 'hkg'], ['link', 'hkg', 'sin', 1], ['bb', 'sin'], ['tr', 'sin', 1], ['ix', 'sin'], HIRE],
|
||||
redsea: { ref: [...home('mrs'), ['link', 'mrs', 'par', 1], ['bb', 'par'], ['ix', 'par'], ['link', 'par', 'bod', 1], ['link', 'bod', 'nyc', 1, 'amitie'], ['tr', 'nyc', 1], ['ix', 'nyc'], ['link', 'nyc', 'lax', 1], ['ix', 'lax'], ['tr', 'lax', 1], ['link', 'lax', 'tok', 1, 'jup'], ['bb', 'tok'], ['tr', 'tok', 1], ['ix', 'tok'], ['link', 'tok', 'hkg', 1, 'apg'], ['bb', 'hkg'], ['tr', 'hkg', 1], ['ix', 'hkg'], ['link', 'hkg', 'sin', 1], ['bb', 'sin'], ['tr', 'sin', 1], ['ix', 'sin'], HIRE],
|
||||
// 2.0.0: no more max-prefix outages to break the 30-day streak, so the reference can finish in under 100 days.
|
||||
win: [80, 250], cheese: [...home('mrs'), ['loans'], ['link', 'mrs', 'sin', 1], ['bb', 'sin']], by: null },
|
||||
spat: { ref: [...home('nyc'), HIRE], avoid: ['cog'], win: [50, 140], cheese: [...home('nyc'), ['hire', ['routers', 'repair']]], by: 160 },
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ test('the long tail no longer stands between you and Tier 1', () => {
|
|||
assert.equal(ev("isTier1()"), true);
|
||||
// the peers you need directly are all real networks of some size, and fewer than before
|
||||
const islands = ev("S.pni.filter(p=>p.id[0]==='i').length");
|
||||
assert.ok(islands < 70, `${islands} networks to peer with directly`);
|
||||
assert.ok(islands < 80, `${islands} networks to peer with directly`);
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue