diff --git a/metar.html b/metar.html index 5f252b2..c22147e 100644 --- a/metar.html +++ b/metar.html @@ -536,18 +536,43 @@ function testAllMetars() { console.log(`--- Starting test of ${metars.length} METARs ---`); let failed = 0; + let withUnknowns = 0; + const originalConsoleLog = console.log; + metars.forEach(metarString => { + const tempLogs = []; + console.log = (...args) => { + tempLogs.push(args.join(' ')); + }; + try { const sections = generateMetarSections(metarString); if (sections.length === 0 && metarString.length > 0) { throw new Error("Parser produced no sections"); } + + const hasUnknowns = tempLogs.some(msg => msg.includes('Unknown') || msg.includes('Other remark')); + if (hasUnknowns) { + withUnknowns++; + originalConsoleLog(`METAR with decoding issues: ${metarString}`); + tempLogs.forEach(msg => originalConsoleLog(` -> ${msg}`)); + } + } catch (e) { console.error("Failed to parse:", metarString, e); failed++; } }); - console.log(`--- Test finished, ${failed} failures ---`); + + console.log = originalConsoleLog; + const total = metars.length; + const clean = total - failed - withUnknowns; + + console.log(`--- Test finished ---`); + console.log(`Total METARs: ${total}`); + console.log(`Clean decodes: ${clean} (${(clean/total*100).toFixed(1)}%)`); + console.log(`Decodes with issues: ${withUnknowns} (${(withUnknowns/total*100).toFixed(1)}%)`); + console.log(`Failed to parse: ${failed} (${(failed/total*100).toFixed(1)}%)`); } testAllBtn.addEventListener('click', testAllMetars);