Merge #94: Calibrate city prices with PeeringDB and Hurricane Electric data (clayberF)
This commit is contained in:
commit
1b12a2c014
14 changed files with 241 additions and 6 deletions
|
|
@ -610,7 +610,8 @@ test('Australia: hard mode start in Sydney, dear transit and waves, cheap IX por
|
|||
assert.equal(ev('S.home'), 'syd');
|
||||
assert.equal(ev("regionMult('syd')"), 3, 'transit into Australia costs more than Asia');
|
||||
assert.ok(ev("regionMult('syd')>regionMult('sin')&®ionMult('syd')<regionMult('icn')"));
|
||||
assert.equal(ev("regionMult('akl')"), 1.8, 'Auckland keeps the Oceania price');
|
||||
assert.ok(ev("regionMult('akl')") < ev('AU_TRANSIT'), 'Auckland is not priced like Australia');
|
||||
assert.equal(ev("regionMult('akl')"), ev("Math.round(1.8*txComp('akl')*10)/10"), 'Auckland pays the Oceania price, adjusted for its market');
|
||||
assert.equal(ev("waveMarket('syd','lax',true).reg"), 2.6, 'any subsea wave touching Australia');
|
||||
assert.equal(ev("waveMarket('mel','syd',false).reg"), 1.8);
|
||||
assert.ok(ev("ixPortMo('syd',1)<PORT[1].ix"), 'IX ports are the cheap exception');
|
||||
|
|
@ -1070,3 +1071,25 @@ test('city density: no small city crowds a bigger one, Brazil is slimmer than Eu
|
|||
ev('cam.x=CITY.cpv.x;cam.y=CITY.cpv.y;cam.z=6;draw(0)');
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
test('prices follow real connectivity: thin markets cost more, hubs stay put', () => {
|
||||
const { ev, errors } = load();
|
||||
start(ev);
|
||||
assert.deepEqual(JSON.parse(ev('JSON.stringify(Object.keys(CITY_PDB).filter(c=>!CITY[c]))')), [], 'every entry is a city on the map');
|
||||
assert.ok(ev('Object.keys(CITY_PDB).length') >= 190, 'real-world data for most cities');
|
||||
// A city without data keeps the plain regional price.
|
||||
assert.equal(ev("(()=>{const q=CITY_PDB.fra;delete CITY_PDB.fra;const r=[txComp('fra'),colo('fra'),popMo('fra')];CITY_PDB.fra=q;return r.join()})()"), `1,1,${ev('POP_MO')}`);
|
||||
assert.equal(ev("regionMult('syd')"), ev('AU_TRANSIT'), 'Australia keeps its hand-set transit price');
|
||||
for (const c of ['fra', 'ams', 'lon', 'nyc']) assert.equal(ev(`txComp('${c}')`), 1, `${c} is a hub`);
|
||||
assert.equal(ev("regionMult('sao')"), 1.6, 'São Paulo keeps the South American price');
|
||||
assert.ok(ev("regionMult('rbr')") > ev("regionMult('sao')") * 1.5, 'Rio Branco has few sellers');
|
||||
assert.ok(ev("txComp('rbr')") <= 1.8);
|
||||
assert.equal(ev("colo('rbr')"), 1.5, 'no neutral data center');
|
||||
assert.equal(ev("popCost('rbr')"), ev('POP_COST') * 1.5);
|
||||
assert.equal(ev("popMo('fra')"), ev('POP_MO'));
|
||||
ev("ACT.buildPop({city:'rbr'});compute()");
|
||||
assert.ok(ev('R.cost.pops') >= ev("popMo('rbr')"), 'running cost uses the city rent');
|
||||
ev("selectCity('rbr')");
|
||||
assert.ok(ev("CITY_PDB.sao[2]>=2000&&CITY_PDB.nyc[2]>=2000&&CITY_PDB.kgl[2]<2000"), 'Brazil and the US are dense in ASNs, Rwanda is not');
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue