Improve increment and decrement instructions, tests
This commit is contained in:
@ -393,6 +393,7 @@
|
|||||||
"<code>i++;</code>",
|
"<code>i++;</code>",
|
||||||
"is the equivalent of",
|
"is the equivalent of",
|
||||||
"<code>i = i + 1;</code>",
|
"<code>i = i + 1;</code>",
|
||||||
|
"<strong>Note</strong><br>The entire line becomes <code>i++;</code>, eliminating the need for the equal sign.",
|
||||||
"<h4>Instructions</h4>",
|
"<h4>Instructions</h4>",
|
||||||
"Change the code to use the <code>++</code> operator on <code>myVar</code>"
|
"Change the code to use the <code>++</code> operator on <code>myVar</code>"
|
||||||
],
|
],
|
||||||
@ -412,7 +413,7 @@
|
|||||||
],
|
],
|
||||||
"tests": [
|
"tests": [
|
||||||
"assert(myVar === 88, 'message: <code>myVar</code> should equal <code>88</code>');",
|
"assert(myVar === 88, 'message: <code>myVar</code> should equal <code>88</code>');",
|
||||||
"assert(/[+]{2}/.test(code), 'message: Use the <code>++</code> operator');",
|
"assert(/myVar\\s*[+]{2}/.test(code), 'message: Use the <code>++</code> operator');",
|
||||||
"assert(/var myVar = 87;/.test(code), 'message: Do not change code above the line');"
|
"assert(/var myVar = 87;/.test(code), 'message: Do not change code above the line');"
|
||||||
],
|
],
|
||||||
"type": "waypoint",
|
"type": "waypoint",
|
||||||
@ -431,6 +432,7 @@
|
|||||||
"<code>i--;</code>",
|
"<code>i--;</code>",
|
||||||
"is the equivalent of",
|
"is the equivalent of",
|
||||||
"<code>i = i - 1;</code>",
|
"<code>i = i - 1;</code>",
|
||||||
|
"<strong>Note</strong><br>The entire line becomes <code>i--;</code>, eliminating the need for the equal sign.",
|
||||||
"<h4>Instructions</h4>",
|
"<h4>Instructions</h4>",
|
||||||
"Change the code to use the <code>--</code> operator on <code>myVar</code>"
|
"Change the code to use the <code>--</code> operator on <code>myVar</code>"
|
||||||
],
|
],
|
||||||
@ -450,7 +452,7 @@
|
|||||||
],
|
],
|
||||||
"tests": [
|
"tests": [
|
||||||
"assert(myVar === 10, 'message: <code>myVar</code> should equal <code>10</code>');",
|
"assert(myVar === 10, 'message: <code>myVar</code> should equal <code>10</code>');",
|
||||||
"assert(/myVar[-]{2}/.test(code), 'message: Use the <code>--</code> operator on <code>myVar</code>');",
|
"assert(/myVar\\s*[-]{2}/.test(code), 'message: Use the <code>--</code> operator on <code>myVar</code>');",
|
||||||
"assert(/var myVar = 11;/.test(code), 'message: Do not change code above the line');"
|
"assert(/var myVar = 11;/.test(code), 'message: Do not change code above the line');"
|
||||||
],
|
],
|
||||||
"type": "waypoint",
|
"type": "waypoint",
|
||||||
|
Reference in New Issue
Block a user