Files
cpubro/test-matching.js
2025-10-13 08:21:26 +13:00

39 lines
1.7 KiB
JavaScript

const { fetchBenchmarkData, findBenchmarkScore } = require('./scrapers/cpubenchmark');
async function testMatching() {
console.log('Fetching benchmark data...');
const benchmarkData = await fetchBenchmarkData(console.log);
console.log(`\nLoaded ${Object.keys(benchmarkData).length} benchmarks\n`);
// Test with sample CPU names from PB Tech
const testCPUs = [
"AMD Ryzen 7 9800X3D CPU 8 Core / 16 Thread - 104MB Total Cache - AM5 Socket - 120W TDP - AMD Radeon Graphics - Heatsink Required",
"Intel Core i7-14700F CPU 20 Core (8P 12E) / 28 Thread - Max Boost 5.4GHz - 33MB Cache - LGA1700 Socket - 65W TDP - Heatsink Required",
"AMD Ryzen 5 9600X CPU 6 Core / 12 Thread - Max Boost 5.4GHz - 38MB Cache - AM5 Socket - 65W TDP - AMD Radeon Graphics - Heatsink Required",
"Intel Core i9-14900K CPU 24 Core (8P 16E) / 32 Thread - Max Boost 6.0GHz - 36MB Cache - LGA1700 Socket - 125W TDP - Intel UHD Graphics 770 - Heatsink Required"
];
testCPUs.forEach(cpu => {
console.log(`\nPB Tech Name: ${cpu.substring(0, 60)}...`);
const score = findBenchmarkScore(cpu, benchmarkData);
console.log(`Found Score: ${score}`);
// Also check what it should be
const cpuModel = cpu.match(/(?:Ryzen [579] \w+|Core i[3579]-\w+)/)?.[0];
console.log(`Expected Model: ${cpuModel}`);
if (cpuModel) {
const exactMatches = Object.keys(benchmarkData)
.filter(name => name.includes(cpuModel))
.slice(0, 3);
console.log(`Similar in database: ${exactMatches.join(', ')}`);
exactMatches.forEach(match => {
console.log(` - ${match}: ${benchmarkData[match]}`);
});
}
});
}
testMatching().catch(console.error);