const vm = require("vm");
const fs = require("fs");
const w = { ExamData: { "sc-900": { questions: [] } } };
try {
  vm.runInNewContext(fs.readFileSync("js/data/sc900_p5.js", "utf8"), { window: w });
} catch(e) {
  console.log("PARSE ERROR: " + e.message);
  process.exit(1);
}
const q = w.ExamData["sc-900"].questions;
console.log("Count: " + q.length);
const missing = [];
for (let i = 401; i <= 500; i++) {
  if (!q.find(x => x.id === "sc900-" + i)) missing.push("sc900-" + i);
}
if (missing.length) console.log("MISSING: " + missing.join(", "));
else console.log("All IDs sc900-401 to sc900-500 present");
if (q.length === 100 && missing.length === 0) console.log("PASS");
else console.log("FAIL");
