Missing Last
Your program should print ‘not missing’. If the last character is removed, it should print ‘missing’. Tests are run multiple times to ensure the solution is not luck based.
Judge
(async function*(context: Context): Challenge { yield (await context.run()).assertEquals('not missing'); yield (await context.runCode(context.code.slice(0,-1))).assertEquals('missing'); // only run the luck tests if you pass if(context.testCases.every((i) => i.pass !== 'Fail')) { for(let i = 0; i < 23; i++) { if (Math.random() > 0.5) { yield (await context.run()).assertEquals('not missing'); } else { yield (await context.runCode(context.code.slice(0,-1))).assertEquals('missing'); } } } return context.noFailures(); })
Example Code
process.on('uncaughtException', e => console.log(e ? 'not missing' : 'missing')); throw 0.1