Skip to content

Commit

Permalink
remove old quiz testcase and add new one :)
Browse files Browse the repository at this point in the history
  • Loading branch information
m7medVision committed Feb 8, 2024
1 parent 3386c11 commit b01260c
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions testcases/numbers/intro.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,21 @@ function handleCodeRun(code) {
}
}
const output = handleCodeRun(code);
if (!output.includes(50)) {
if (output != "50") {
isPass = false;
msg = "هناك خطاء في الكود";
} else {
// TODO: complete the regex
const regexWidth = ''
const regexLength = ''
const regexArea = ''
const regexWidth = /(let|const|var)(\s*)width(\s*)?=(\s*)?10(;)?/g
const regexLength = /(let|const|var)(\s*)length(\s*)?=(\s*)?5(;)?/g
const regexArea = /(let|const|var)(\s*)area(\s*)?=(\s*)?((width[\s*]?\*[\s*]?length)|(length[\s*]?\*[\s*]?width))/g
const regex = [regexWidth, regexLength, regexArea]
const results = regex.map((reg) => reg.test(code))
if (results.includes(false)) {
isPass = false;
msg = "هناك خطاء في الكود";
} else {
isPass = true;
msg = "احسنت";
}
}

0 comments on commit b01260c

Please sign in to comment.