Sweden beyond Stockholm: Gothenburg, Malmö and Haparanda (closes #206)

Gothenburg between Oslo and Copenhagen on Netnod's exchange, Malmö across the Øresund on SONIX, and Haparanda where GlobalConnect's fibre crosses the land border to Finland. A Nordic fibre carrier sells transit along that route; Tele2, Telenor and Arelion reach the new cities.
This commit is contained in:
Frederic Jung 2026-11-05 07:31:17 +01:00
parent 28e732448e
commit 45ffdba8ae
No known key found for this signature in database
16 changed files with 76 additions and 5 deletions

34
tests/sweden.test.js Normal file
View file

@ -0,0 +1,34 @@
// #206: Sweden beyond Stockholm. Gothenburg sits between Oslo and Copenhagen, Malmö across the Øresund from
// Copenhagen, and Haparanda on the land border with Finland, where the fibre crosses to Tornio.
const test = require('node:test');
const assert = require('node:assert/strict');
const { load } = require('./harness');
test('#206 Gothenburg, Malmö and Haparanda are Swedish cities with transit, and Gothenburg and Malmö have exchanges', () => {
const { ev, errors } = load();
for (const c of ['got', 'mmx', 'hpa']) {
assert.equal(ev(`CITY.${c}.cc`), 'SE', `${c} is in Sweden`);
assert.ok(ev(`NETS.some(n=>n.price&&n.pops.includes('${c}'))`), `${c} sells transit`);
}
assert.ok(ev("!!CITY.got.ix&&!!CITY.mmx.ix"), 'Netnod Gothenburg and SONIX Malmö');
assert.equal(ev('CITY.hpa.ix'), '', 'Haparanda waits for a player-founded exchange');
assert.ok(ev("CITY.got.P>CITY.mmx.P&&CITY.mmx.P>CITY.hpa.P&&CITY.sto.P>CITY.got.P"), 'sized like the real cities');
// Swedish homes get their own networks in the new cities, not only in Stockholm.
for (const n of ['tlt', 'tnr']) for (const c of ['got', 'mmx']) assert.ok(ev(`NET.${n}.pops.includes('${c}')`), `${n} in ${c}`);
assert.deepEqual(errors, []);
});
test('#206 Gothenburg sits between Oslo and Copenhagen, Malmö next to Copenhagen, and Haparanda reaches Finland over land', () => {
const { ev, errors } = load();
ev('ACT.start({})');
const km = (a, b) => ev(`kmBetween('${a}','${b}')`);
assert.ok(km('got', 'osl') < km('cph', 'osl') && km('got', 'cph') < km('cph', 'osl'), 'Oslo to Copenhagen can stop in Gothenburg');
assert.ok(km('mmx', 'cph') < 40, 'the Øresund is short');
for (const [a, b] of [['mmx', 'cph'], ['got', 'osl'], ['hpa', 'hel']]) assert.equal(ev(`isSub('${a}','${b}')`), false, `${a}–${b} over land`);
// The carrier whose fibre crosses the border there sells transit on both sides.
assert.ok(ev("NET.gdc.price>0&&NET.gdc.pops.includes('hpa')&&NET.gdc.pops.includes('hel')"));
ev("S.cash=1e9;S.lvl=4;for(const g of GOALS)S.done[g.id]=0;ACT.launchBB({city:'fra'});ACT.buildPop({city:'got'});ACT.buyTransit({city:'got',net:'gdc',tier:1});compute()");
assert.ok(ev("S.transit.some(t=>t.city==='got'&&t.net==='gdc')"), 'a POP in Gothenburg can buy transit there');
ev('cam.x=CITY.mmx.x;cam.y=CITY.mmx.y;cam.z=5;draw(0)');
assert.deepEqual(errors, []);
});