MCPcopy Create free account
hub / github.com/codecombat/codecombat / constructSolutions

Function constructSolutions

app/lib/level-generation.js:1735–1748  ·  view source on GitHub ↗
({ solutionCode, starterCode })

Source from the content-addressed store, hash-verified

1733}
1734
1735function constructSolutions ({ solutionCode, starterCode }) {
1736 const solutions = []
1737 solutions.push({ source: solutionCode, language: 'javascript', succeeds: true })
1738 solutions.push({ source: starterCode, language: 'javascript', succeeds: false })
1739 const solutionCodeLines = solutionCode.split('\n')
1740 for (let i = 0; i < solutionCodeLines.length; ++i) {
1741 if (i !== solutionCodeLines.length - 1) {
1742 // Maybe we don't need to test all the intermediate lines, and just testing starter code plus solution less last line is enough
1743 continue
1744 }
1745 solutions.push({ source: solutionCodeLines.slice(0, i).join('\n'), language: 'javascript', succeeds: false })
1746 }
1747 return solutions
1748}
1749
1750function createVerifierTestListener (testContext, onAllTestsCompleted) {
1751 return (e) => {

Callers 1

verifyLevelFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected