Ruined
This commit is contained in:
+43
-13
@@ -61,7 +61,8 @@ test('named manifest covers all requested world, ecology, craftitem, wildlife an
|
||||
const art=worldArt();
|
||||
const requiredWorld='stone soil grass_top grass_side sand log_top log_side leaves planks wall roof thatch foundation frame stairs door window vent storage pantry reeds berry_bush berry_bush_bare sapling grain_patch crop_1 crop_2 crop_3 crop_4 clay_bank iron_ore_vein water fire fire_lit torch sticks loose_stone bedroll drying_rack fish_trap weir_stone meadow_grass wildflowers fern litter fungi deadwood tree_seedling young_tree mature_tree dung leaves_spring leaves_autumn leaves_winter meadow_grass_dormant fern_dormant wildflowers_dormant spring_greens spring_greens_dormant autumn_mushrooms autumn_mushrooms_dormant'.split(' ');
|
||||
const requiredItems='berries grain grain_seed raw_food cooked_food fish_bait raw_fish cooked_fish fish_drying_charge dried_fish iron_ore iron_ingot charcoal charcoal_charge smelt_charge clay clay_jar clay_jar_charge dried_food dried_food_charge cloak vessel water_raw water_clean firestarter iron_axe spring_greens autumn_mushrooms'.split(' ');
|
||||
const species=['oak','birch','pine','willow','alder','beech','aspen','rowan','hazel','spruce'], rocks=['granite','basalt','limestone','slate','sandstone'];
|
||||
const species=['oak','birch','pine','willow','alder','beech','aspen','rowan','hazel','spruce',
|
||||
'crab_apple','wild_cherry','field_maple'], rocks=['granite','basalt','limestone','slate','sandstone'];
|
||||
const understory=['clover','nettle','heather','bluebell','sedge','bulrush','moss','lichen'];
|
||||
const biome=[...rocks,...rocks.map(n=>`${n}_bricks`),
|
||||
...'forest_floor podzol alluvium peat alpine_turf gravel scree snow quartz_vein copper_ore_vein coal_ore_vein'.split(' '),
|
||||
@@ -69,7 +70,7 @@ test('named manifest covers all requested world, ecology, craftitem, wildlife an
|
||||
const seasonal=species.filter(s=>s!=='pine' && s!=='spruce').flatMap(s=>['spring','autumn','winter'].map(n=>`${s}_leaves_${n}`));
|
||||
const dormant=understory.slice(0,6).map(n=>`${n}_dormant`);
|
||||
assert.deepEqual(SPECIES_NAMES,species); assert.deepEqual(ROCK_NAMES,rocks);
|
||||
assert.deepEqual(BIOME_WORLD_NAMES,biome); assert.equal(biome.length,61);
|
||||
assert.deepEqual(BIOME_WORLD_NAMES,biome); assert.equal(biome.length,73);
|
||||
assert.deepEqual(UNDERSTORY_NAMES,understory); assert.deepEqual(DORMANT_UNDERSTORY_NAMES,dormant);
|
||||
assert.deepEqual(SPECIES_SEASONAL_NAMES,seasonal);
|
||||
assert.deepEqual([...WORLD_NAMES].sort(),[...requiredWorld,...biome,...seasonal,...understory,...dormant].sort());
|
||||
@@ -78,24 +79,28 @@ test('named manifest covers all requested world, ecology, craftitem, wildlife an
|
||||
'hearth_hotbar.png','hearth_selected.png','hearth_crosshair.png',...ANIMAL_NAMES.map(n=>`hearth_${n}.png`),
|
||||
...BOTANY_SPRITE_NAMES.map(n=>`hearth_${n}.png`)];
|
||||
assert.equal(new Set(names).size,names.length); assert.deepEqual([...art.keys()],names);
|
||||
assert.equal(art.size,360); assert.equal(WORLD_NAMES.length,160); assert.equal(ITEM_NAMES.length,34);
|
||||
assert.equal(art.size,421); assert.equal(WORLD_NAMES.length,181); assert.equal(ITEM_NAMES.length,34);
|
||||
for(const [name,image] of art) {
|
||||
assert.match(name,/^hearth_[a-z0-9_]+\.png$/); assert.equal(image.width,32); assert.equal(image.height,32);
|
||||
assert.equal(image.data.length,4096); assert.ok(image.data.some(n=>n>0));
|
||||
}
|
||||
});
|
||||
|
||||
test('all 80 exact catalogue IDs and Latin identities match the actual Lua records, with two manifest states each',async()=> {
|
||||
test('all 100 exact catalogue IDs and Latin identities match the actual Lua records, with two manifest states each',async()=> {
|
||||
const source=await fs.readFile(new URL('../mods/hearth/botany.lua',import.meta.url),'utf8');
|
||||
const rows=[...source.matchAll(/^\s*add\("([a-z_]+)","[^"]+","([^"]+)"/gm)].map(([,id,latin])=>({id,latin}));
|
||||
assert.equal(rows.length,80); assert.equal(new Set(rows.map(r=>r.id)).size,80);
|
||||
assert.equal(new Set(rows.map(r=>r.latin)).size,80);
|
||||
assert.equal(rows.length,100); assert.equal(new Set(rows.map(r=>r.id)).size,100);
|
||||
assert.equal(new Set(rows.map(r=>r.latin)).size,100);
|
||||
assert.deepEqual(BOTANY_ART_NAMES,rows.map(r=>r.id));
|
||||
assert.deepEqual(BOTANY_CATALOGUE.map(({id,latin})=>({id,latin})),rows);
|
||||
const groups=['trees','shrubs','grasses','herbs','ferns_mosses','fungi','aquatic','lichens'];
|
||||
for(const [i,g] of groups.entries()) assert.deepEqual(BOTANY_CATALOGUE.slice(i*10,i*10+10).map(r=>r.group),Array(10).fill(g));
|
||||
assert.deepEqual(BOTANY_ART_NAMES.slice(0,10),SPECIES_NAMES);
|
||||
assert.equal(BOTANY_ART_MANIFEST.length,160);
|
||||
const counts=[13,14,10,22,11,10,10,10]; let offset=0;
|
||||
for(const [i,g] of groups.entries()) {
|
||||
assert.deepEqual(BOTANY_CATALOGUE.slice(offset,offset+counts[i]).map(r=>r.group),Array(counts[i]).fill(g));
|
||||
offset+=counts[i];
|
||||
}
|
||||
assert.deepEqual(BOTANY_ART_NAMES.slice(0,13),SPECIES_NAMES);
|
||||
assert.equal(BOTANY_ART_MANIFEST.length,200);
|
||||
assert.deepEqual(BOTANY_ART_MANIFEST.map(r=>r.filename),BOTANY_SPRITE_NAMES.map(n=>`hearth_${n}.png`));
|
||||
for(const r of BOTANY_ART_MANIFEST) {
|
||||
assert.equal(r.botanicalLatin,rows.find(row=>row.id===r.id).latin);
|
||||
@@ -104,7 +109,7 @@ test('all 80 exact catalogue IDs and Latin identities match the actual Lua recor
|
||||
}
|
||||
});
|
||||
|
||||
test('80 recognizable botanical cutouts have unique silhouettes, crisp padded alpha, and 80 distinct bloom-free inactive drawings',()=> {
|
||||
test('100 recognizable botanical cutouts have unique silhouettes, crisp padded alpha, and 100 distinct bloom-free inactive drawings',()=> {
|
||||
const art=worldArt(), activeMasks=new Set(), dormantMasks=new Set(), allBytes=new Set();
|
||||
for(const id of BOTANY_ART_NAMES) {
|
||||
const active=tile(art,`botany_${id}`), dormant=tile(art,`botany_${id}_dormant`);
|
||||
@@ -122,9 +127,9 @@ test('80 recognizable botanical cutouts have unique silhouettes, crisp padded al
|
||||
if(state==='dormant') assert.ok(ps.every(p=>!p[3] || !(p[1]>p[0] && p[1]>p[2])),`${id}: dry inactive state`);
|
||||
}
|
||||
}
|
||||
assert.equal(activeMasks.size,80,'no two taxa masquerade as the same recoloured silhouette');
|
||||
assert.equal(dormantMasks.size,80,'each inactive species retains its own structure');
|
||||
assert.equal(allBytes.size,160);
|
||||
assert.equal(activeMasks.size,100,'no two taxa masquerade as the same recoloured silhouette');
|
||||
assert.equal(dormantMasks.size,100,'each inactive species retains its own structure');
|
||||
assert.equal(allBytes.size,200);
|
||||
});
|
||||
|
||||
test('botanical diagnostic landmarks distinguish flowers, pinnate ferns, moss cushions, fungi and true floating lily pads',()=> {
|
||||
@@ -161,6 +166,31 @@ test('approved leaf PNG bytes survive the catalogue extension without rewriting
|
||||
}
|
||||
});
|
||||
|
||||
test('twenty additions retain exact contract identities and diagnostic flowers, climbing structures, seedheads and fern forks',()=> {
|
||||
const additions='crab_apple wild_cherry field_maple honeysuckle ivy gorse broom dandelion daisy red_clover birdsfoot_trefoil ribwort_plantain selfheal knapweed oxeye_daisy field_scabious teasel cow_parsley garlic_mustard holly_fern'.split(' ');
|
||||
const art=worldArt(),has=(id,color)=>pixels(tile(art,`botany_${id}`)).some(p=>p[3]&&p.slice(0,3).join()===PALETTE[color].join());
|
||||
assert.equal(additions.length,20);
|
||||
for(const id of additions) {
|
||||
assert.ok(BOTANY_ART_NAMES.includes(id));
|
||||
assert.equal(BOTANY_ART_MANIFEST.filter(r=>r.id===id).length,2);
|
||||
const active=tile(art,`botany_${id}`),dry=tile(art,`botany_${id}_dormant`);
|
||||
assert.notDeepEqual(active.data,dry.data);
|
||||
const upper=pixels(active).filter((p,i)=>p[3]&&Math.floor(i/32)<18).length;
|
||||
assert.ok(upper>8,`${id}: diagnostic upper specimen, not only a generic basal tuft`);
|
||||
}
|
||||
for(const [id,colors] of Object.entries({honeysuckle:['cream','gold','rose'],ivy:['ochre','barkLight'],
|
||||
gorse:['gold','ochre'],broom:['gold','leafLight'],dandelion:['gold','ochre'],daisy:['cream','gold'],
|
||||
red_clover:['wine','mauve'],birdsfoot_trefoil:['gold','ochre'],ribwort_plantain:['cream','bark'],
|
||||
selfheal:['wine','mauve'],knapweed:['wine','rose'],oxeye_daisy:['cream','gold'],
|
||||
field_scabious:['mauve','rose'],teasel:['wood','mauve'],cow_parsley:['cream','sage'],
|
||||
garlic_mustard:['cream','straw'],holly_fern:['ochre','leafLight']}))
|
||||
for(const color of colors) assert.ok(has(id,color),`${id}: ${color} diagnostic landmark`);
|
||||
// Ivy's climbing support/rootlets remain through dormancy; honey tubes are
|
||||
// narrow at the mouth, unlike a daisy's radial head or a teasel's seed cone.
|
||||
for(const y of [8,12,16,20,24]) assert.ok([12,13,14].some(x=>pixel(tile(art,'botany_ivy'),x,y)[3]===255));
|
||||
assert.ok(pixels(tile(art,'botany_garlic_mustard_dormant')).filter(p=>p[3]).length>50);
|
||||
});
|
||||
|
||||
test('every tile is deterministic original clustered palette art, not independent speckle noise or a recolored square',()=> {
|
||||
const first=worldArt(), second=worldArt();
|
||||
const allowed=new Set(Object.values(PALETTE).map(c=>c.join(','))), unique=new Set();
|
||||
|
||||
Reference in New Issue
Block a user