fix(curriculum): Remove unnecessary assert message argument from English Coding Interview Prep challenges - 02 (#36412)

* fix: removed assert msg argument

* fix: removed msgs surrounded by 2 single quotes

* fix: removed missing 2 assert msg arguments

* fix: remove msg surrounded by two single quotes

* fix: removed unnecessary assert msg args

* fix; remove msgs surrounded by double quotes

* fix: removed unnecessary assert msg args

* fix: remove unnecessary assert msg args

* fix: removed unnecessary assert msg arg

* fix: removed unnecessary assert msg args

* fix: removed unnecessary assert msg arg

* fix: removed unnecessary assert msg args

* fix: removed unnecessary assert msg args

* fix: removed unnecessary assert msg args

* fix: removed unnecessary assert msg args

* fix: removed unnecessary assert msg args

* fix: removed unnecessary assert msg arg

* fix: removed unnecessary assert msg args

* fix: Restore expected values to assertions

* fix: remove assertion message

Co-authored-by: Vivek Agrawal <vivekmittalagrawal@gmail.com>
This commit is contained in:
Randell Dawson 2019-07-26 05:24:52 -07:00 committed by Oliver Eyton-Williams
parent 603c842c97
commit 04f18e43f6
85 changed files with 454 additions and 454 deletions

View File

@ -20,11 +20,11 @@ Implement a function to determine the state of the doors after the last pass. Re
```yml
tests:
- text: <code>getFinalOpenedDoors</code> is a function.
testString: assert(typeof getFinalOpenedDoors === 'function', '<code>getFinalOpenedDoors</code> is a function.');
testString: assert(typeof getFinalOpenedDoors === 'function');
- text: <code>getFinalOpenedDoors</code> should return an array.
testString: assert(Array.isArray(getFinalOpenedDoors(100)), '<code>getFinalOpenedDoors</code> should return an array.');
testString: assert(Array.isArray(getFinalOpenedDoors(100)));
- text: <code>getFinalOpenedDoors</code> did not produce the correct results.
testString: assert.deepEqual(getFinalOpenedDoors(100), solution, '<code>getFinalOpenedDoors</code> did not produce the correct results.');
testString: assert.deepEqual(getFinalOpenedDoors(100), solution);
```

View File

@ -36,15 +36,15 @@ Implement a function that takes a string of four digits as its argument, with ea
```yml
tests:
- text: <code>solve24</code> is a function.
testString: assert(typeof solve24 === 'function', '<code>solve24</code> is a function.');
testString: assert(typeof solve24 === 'function');
- text: <code>solve24("4878")</code> should return <code>(7-8/8)*4</code> or <code>4*(7-8/8)</code>
testString: assert(include(answers[0], solve24(testCases[0])), '<code>solve24("4878")</code> should return <code>(7-8/8)*4</code> or <code>4*(7-8/8)</code>');
testString: assert(include(answers[0], solve24(testCases[0])));
- text: <code>solve24("1234")</code> should return any arrangement of <code>1*2*3*4</code>
testString: assert(include(answers[1], solve24(testCases[1])), '<code>solve24("1234")</code> should return any arrangement of <code>1*2*3*4</code>');
testString: assert(include(answers[1], solve24(testCases[1])));
- text: <code>solve24("6789")</code> should return <code>(6*8)/(9-7)</code> or <code>(8*6)/(9-7)</code>
testString: assert(include(answers[2], solve24(testCases[2])), '<code>solve24("6789")</code> should return <code>(6*8)/(9-7)</code> or <code>(8*6)/(9-7)</code>');
testString: assert(include(answers[2], solve24(testCases[2])));
- text: <code>solve24("1127")</code> should return a permutation of <code>(1+7)*(1*2)</code>
testString: assert(include(answers[3], solve24(testCases[3])), '<code>solve24("1127")</code> should return a permutation of <code>(1+7)*(1*2)</code>');
testString: assert(include(answers[3], solve24(testCases[3])));
```

View File

@ -40,19 +40,19 @@ Implement a function that returns the sum of the $n$-th row.
```yml
tests:
- text: <code>numberOfNames</code> is a function.
testString: assert(typeof numberOfNames === 'function', '<code>numberOfNames</code> is a function.');
testString: assert(typeof numberOfNames === 'function');
- text: <code>numberOfNames(5)</code> should equal 7.
testString: assert.equal(numberOfNames(5), 7, '<code>numberOfNames(5)</code> should equal 7.');
testString: assert.equal(numberOfNames(5), 7);
- text: <code>numberOfNames(12)</code> should equal 77.
testString: assert.equal(numberOfNames(12), 77, '<code>numberOfNames(12)</code> should equal 77.');
testString: assert.equal(numberOfNames(12), 77);
- text: <code>numberOfNames(18)</code> should equal 385.
testString: assert.equal(numberOfNames(18), 385, '<code>numberOfNames(18)</code> should equal 385.');
testString: assert.equal(numberOfNames(18), 385);
- text: <code>numberOfNames(23)</code> should equal 1255.
testString: assert.equal(numberOfNames(23), 1255, '<code>numberOfNames(23)</code> should equal 1255.');
testString: assert.equal(numberOfNames(23), 1255);
- text: <code>numberOfNames(42)</code> should equal 53174.
testString: assert.equal(numberOfNames(42), 53174, '<code>numberOfNames(42)</code> should equal 53174.');
testString: assert.equal(numberOfNames(42), 53174);
- text: <code>numberOfNames(123)</code> should equal 2552338241.
testString: assert.equal(numberOfNames(123), 2552338241, '<code>numberOfNames(123)</code> should equal 2552338241.');
testString: assert.equal(numberOfNames(123), 2552338241);
```

View File

@ -47,21 +47,21 @@ Some rules to keep in mind:
```yml
tests:
- text: <code>canMakeWord</code> is a function.
testString: assert(typeof canMakeWord === 'function', '<code>canMakeWord</code> is a function.');
testString: assert(typeof canMakeWord === 'function');
- text: <code>canMakeWord</code> should return a boolean.
testString: assert(typeof canMakeWord('hi') === 'boolean', '<code>canMakeWord</code> should return a boolean.');
testString: assert(typeof canMakeWord('hi') === 'boolean');
- text: <code>canMakeWord("bark")</code> should return true.
testString: assert(canMakeWord(words[0]), '<code>canMakeWord("bark")</code> should return true.');
testString: assert(canMakeWord(words[0]));
- text: <code>canMakeWord("BooK")</code> should return false.
testString: assert(!canMakeWord(words[1]), '<code>canMakeWord("BooK")</code> should return false.');
testString: assert(!canMakeWord(words[1]));
- text: <code>canMakeWord("TReAT")</code> should return true.
testString: assert(canMakeWord(words[2]), '<code>canMakeWord("TReAT")</code> should return true.');
testString: assert(canMakeWord(words[2]));
- text: <code>canMakeWord("COMMON")</code> should return false.
testString: assert(!canMakeWord(words[3]), '<code>canMakeWord("COMMON")</code> should return false.');
testString: assert(!canMakeWord(words[3]));
- text: <code>canMakeWord("squAD")</code> should return true.
testString: assert(canMakeWord(words[4]), '<code>canMakeWord("squAD")</code> should return true.');
testString: assert(canMakeWord(words[4]));
- text: <code>canMakeWord("conFUSE")</code> should return true.
testString: assert(canMakeWord(words[5]), '<code>canMakeWord("conFUSE")</code> should return true.');
testString: assert(canMakeWord(words[5]));
```

View File

@ -31,13 +31,13 @@ Implement a function that calculates how many of the integers from <code>1</code
```yml
tests:
- text: <code>getDPA</code> is a function.
testString: assert(typeof getDPA === 'function', '<code>getDPA</code> is a function.');
testString: assert(typeof getDPA === 'function');
- text: <code>getDPA</code> should return an array.
testString: assert(Array.isArray(getDPA(100)), '<code>getDPA</code> should return an array.');
testString: assert(Array.isArray(getDPA(100)));
- text: <code>getDPA</code> return value should have a length of 3.
testString: assert(getDPA(100).length === 3, '<code>getDPA</code> return value should have a length of 3.');
testString: assert(getDPA(100).length === 3);
- text: <code>getDPA(20000)</code> should equal [15043, 4, 4953]
testString: assert.deepEqual(getDPA(20000), solution, '<code>getDPA(20000)</code> should equal [15043, 4, 4953]');
testString: assert.deepEqual(getDPA(20000), solution);
```

View File

@ -24,13 +24,13 @@ Closures save outer state.
```yml
tests:
- text: <code>accumulator</code> is a function.
testString: assert(typeof accumulator === 'function', '<code>accumulator</code> is a function.');
testString: assert(typeof accumulator === 'function');
- text: <code>accumulator(0)</code> should return a function.
testString: assert(typeof accumulator(0) === 'function', '<code>accumulator(0)</code> should return a function.');
testString: assert(typeof accumulator(0) === 'function');
- text: <code>accumulator(0)(2)</code> should return a number.
testString: assert(typeof accumulator(0)(2) === 'number', '<code>accumulator(0)(2)</code> should return a number.');
testString: assert(typeof accumulator(0)(2) === 'number');
- text: Passing in the values 3, -4, 1.5, and 5 should return 5.5.
testString: assert(testFn(5) === 5.5, 'Passing in the values 3, -4, 1.5, and 5 should return 5.5.');
testString: assert(testFn(5) === 5.5);
```

View File

@ -23,15 +23,15 @@ Write a function which returns the value of $A(m, n)$. Arbitrary precision is pr
```yml
tests:
- text: <code>ack</code> is a function.
testString: assert(typeof ack === 'function', '<code>ack</code> is a function.');
testString: assert(typeof ack === 'function');
- text: <code>ack(0, 0)</code> should return 1.
testString: assert(ack(0, 0) === 1, '<code>ack(0, 0)</code> should return 1.');
testString: assert(ack(0, 0) === 1);
- text: <code>ack(1, 1)</code> should return 3.
testString: assert(ack(1, 1) === 3, '<code>ack(1, 1)</code> should return 3.');
testString: assert(ack(1, 1) === 3);
- text: <code>ack(2, 5)</code> should return 13.
testString: assert(ack(2, 5) === 13, '<code>ack(2, 5)</code> should return 13.');
testString: assert(ack(2, 5) === 13);
- text: <code>ack(3, 3)</code> should return 61.
testString: assert(ack(3, 3) === 61, '<code>ack(3, 3)</code> should return 61.');
testString: assert(ack(3, 3) === 61);
```

View File

@ -43,7 +43,7 @@ or$center$justified$within$its$column.
```yml
tests:
- text: <code>formatText</code> is a function.
testString: assert(typeof formatText === 'function', '<code>formatText</code> is a function.');
testString: assert(typeof formatText === 'function');
- text: '<code>formatText</code> with the above input and "right" justification should produce the following: '
testString: 'assert.strictEqual(formatText(testInput, ''right''), rightAligned);'
- text: '<code>formatText</code> with the above input and "left" justification should produce the following: '

View File

@ -26,13 +26,13 @@ Calculate and show here the Amicable pairs below 20,000 (there are eight).
```yml
tests:
- text: <code>amicablePairsUpTo</code> is a function.
testString: assert(typeof amicablePairsUpTo === 'function', '<code>amicablePairsUpTo</code> is a function.');
testString: assert(typeof amicablePairsUpTo === 'function');
- text: <code>amicablePairsUpTo(300)</code> should return <code>[[220,284]]</code>.
testString: assert.deepEqual(amicablePairsUpTo(300), answer300, '<code>amicablePairsUpTo(300)</code> should return <code>[[220,284]]</code>.');
testString: assert.deepEqual(amicablePairsUpTo(300), answer300);
- text: <code>amicablePairsUpTo(3000)</code> should return <code>[[220,284],[1184,1210],[2620,2924]]</code>.
testString: assert.deepEqual(amicablePairsUpTo(3000), answer3000, '<code>amicablePairsUpTo(3000)</code> should return <code>[[220,284],[1184,1210],[2620,2924]]</code>.');
testString: assert.deepEqual(amicablePairsUpTo(3000), answer3000);
- text: <code>amicablePairsUpTo(20000)</code> should return <code>[[220,284],[1184,1210],[2620,2924],[5020,5564],[6232,6368],[10744,10856],[12285,14595],[17296,18416]]</code>.
testString: assert.deepEqual(amicablePairsUpTo(20000), answer20000, '<code>amicablePairsUpTo(20000)</code> should return <code>[[220,284],[1184,1210],[2620,2924],[5020,5564],[6232,6368],[10744,10856],[12285,14595],[17296,18416]]</code>.');
testString: assert.deepEqual(amicablePairsUpTo(20000), answer20000);
```

View File

@ -22,11 +22,11 @@ If it is not appropriate or possible to support a general collection, use a vect
```yml
tests:
- text: <code>mode</code> is a function.
testString: assert(typeof mode === 'function', '<code>mode</code> is a function.');
testString: assert(typeof mode === 'function');
- text: <code>mode([1, 3, 6, 6, 6, 6, 7, 7, 12, 12, 17])</code> should equal <code>[6]</code>
testString: assert.deepEqual(mode(arr1), [6], '<code>mode([1, 3, 6, 6, 6, 6, 7, 7, 12, 12, 17])</code> should equal <code>[6]</code>');
testString: assert.deepEqual(mode(arr1), [6]);
- text: <code>mode([1, 2, 4, 4, 1])</code> should equal <code>[1, 4]</code>.
testString: assert.deepEqual(mode(arr2).sort(), [1, 4], '<code>mode([1, 2, 4, 4, 1])</code> should equal <code>[1, 4]</code>.');
testString: assert.deepEqual(mode(arr2).sort(), [1, 4]);
```

View File

@ -42,9 +42,9 @@ For the answer, please output an object in the following format:
```yml
tests:
- text: <code>pythagoreanMeans</code> is a function.
testString: assert(typeof pythagoreanMeans === 'function', '<code>pythagoreanMeans</code> is a function.');
testString: assert(typeof pythagoreanMeans === 'function');
- text: <code>pythagoreanMeans([1, 2, ..., 10])</code> should equal the same output above.
testString: assert.deepEqual(pythagoreanMeans(range1), answer1, '<code>pythagoreanMeans([1, 2, ..., 10])</code> should equal the same output above.');
testString: assert.deepEqual(pythagoreanMeans(range1), answer1);
```

View File

@ -23,9 +23,9 @@ The RMS is calculated as the mean of the squares of the numbers, square-rooted:
```yml
tests:
- text: <code>rms</code> is a function.
testString: assert(typeof rms === 'function', '<code>rms</code> is a function.');
testString: assert(typeof rms === 'function');
- text: <code>rms([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])</code> should equal <code>6.2048368229954285</code>.
testString: assert.equal(rms(arr1), answer1, '<code>rms([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])</code> should equal <code>6.2048368229954285</code>.');
testString: assert.equal(rms(arr1), answer1);
```

View File

@ -26,9 +26,9 @@ Implement a function to return the lowest integer that satisfies the Babbage pro
```yml
tests:
- text: <code>babbage</code> is a function.
testString: assert(typeof babbage === 'function', '<code>babbage</code> is a function.');
testString: assert(typeof babbage === 'function');
- text: <code>babbage(99736, 269696)</code> should not return 99736 (there is a smaller answer).
testString: assert.equal(babbage(babbageAns, endDigits), answer, '<code>babbage(99736, 269696)</code> should not return 99736 (there is a smaller answer).');
testString: assert.equal(babbage(babbageAns, endDigits), answer);
```

View File

@ -30,43 +30,43 @@ Determine whether a generated string of brackets is balanced; that is, whether i
```yml
tests:
- text: <code>isBalanced</code> is a function.
testString: assert(typeof isBalanced === 'function', '<code>isBalanced</code> is a function.');
testString: assert(typeof isBalanced === 'function');
- text: <code>isBalanced("[]")</code> should return true.
testString: assert(isBalanced(testCases[0]), '<code>isBalanced("[]")</code> should return true.');
testString: assert(isBalanced(testCases[0]));
- text: <code>isBalanced("]][[[][][][]][")</code> should return false.
testString: assert(!isBalanced(testCases[1]), '<code>isBalanced("]][[[][][][]][")</code> should return false.');
testString: assert(!isBalanced(testCases[1]));
- text: <code>isBalanced("[][[[[][][[[]]]]]]")</code> should return true.
testString: assert(isBalanced(testCases[2]), '<code>isBalanced("[][[[[][][[[]]]]]]")</code> should return true.');
testString: assert(isBalanced(testCases[2]));
- text: <code>isBalanced("][")</code> should return true.
testString: assert(!isBalanced(testCases[3]), '<code>isBalanced("][")</code> should return true.');
testString: assert(!isBalanced(testCases[3]));
- text: <code>isBalanced("[[[]]]][[]")</code> should return true.
testString: assert(!isBalanced(testCases[4]), '<code>isBalanced("[[[]]]][[]")</code> should return true.');
testString: assert(!isBalanced(testCases[4]));
- text: <code>isBalanced("][[]")</code> should return true.
testString: assert(!isBalanced(testCases[5]), '<code>isBalanced("][[]")</code> should return true.');
testString: assert(!isBalanced(testCases[5]));
- text: <code>isBalanced("][[][]][[[]]")</code> should return true.
testString: assert(!isBalanced(testCases[6]), '<code>isBalanced("][[][]][[[]]")</code> should return true.');
testString: assert(!isBalanced(testCases[6]));
- text: <code>isBalanced("[[][]]][")</code> should return true.
testString: assert(!isBalanced(testCases[7]), '<code>isBalanced("[[][]]][")</code> should return true.');
testString: assert(!isBalanced(testCases[7]));
- text: <code>isBalanced("[[[]]][[]]]][][[")</code> should return true.
testString: assert(!isBalanced(testCases[8]), '<code>isBalanced("[[[]]][[]]]][][[")</code> should return true.');
testString: assert(!isBalanced(testCases[8]));
- text: <code>isBalanced("[]][[]]][[[[][]]")</code> should return true.
testString: assert(!isBalanced(testCases[9]), '<code>isBalanced("[]][[]]][[[[][]]")</code> should return true.');
testString: assert(!isBalanced(testCases[9]));
- text: <code>isBalanced("][]][[][")</code> should return true.
testString: assert(!isBalanced(testCases[10]), '<code>isBalanced("][]][[][")</code> should return true.');
testString: assert(!isBalanced(testCases[10]));
- text: <code>isBalanced("[[]][[][]]")</code> should return true.
testString: assert(isBalanced(testCases[11]), '<code>isBalanced("[[]][[][]]")</code> should return true.');
testString: assert(isBalanced(testCases[11]));
- text: <code>isBalanced("[[]]")</code> should return true.
testString: assert(isBalanced(testCases[12]), '<code>isBalanced("[[]]")</code> should return true.');
testString: assert(isBalanced(testCases[12]));
- text: <code>isBalanced("]][]][[]][[[")</code> should return true.
testString: assert(!isBalanced(testCases[13]), '<code>isBalanced("]][]][[]][[[")</code> should return true.');
testString: assert(!isBalanced(testCases[13]));
- text: <code>isBalanced("][]][][[")</code> should return true.
testString: assert(!isBalanced(testCases[14]), '<code>isBalanced("][]][][[")</code> should return true.');
testString: assert(!isBalanced(testCases[14]));
- text: <code>isBalanced("][][")</code> should return true.
testString: assert(!isBalanced(testCases[15]), '<code>isBalanced("][][")</code> should return true.');
testString: assert(!isBalanced(testCases[15]));
- text: <code>isBalanced("[[]]][][][[]][")</code> should return true.
testString: assert(!isBalanced(testCases[16]), '<code>isBalanced("[[]]][][][[]][")</code> should return true.');
testString: assert(!isBalanced(testCases[16]));
- text: <code>isBalanced("")</code> should return true.
testString: assert(isBalanced(testCases[17]), '<code>isBalanced("")</code> should return true.');
testString: assert(isBalanced(testCases[17]));
```

View File

@ -42,17 +42,17 @@ Implement a function that takes two points and a radius and returns the two circ
```yml
tests:
- text: <code>getCircles</code> is a function.
testString: assert(typeof getCircles === 'function', '<code>getCircles</code> is a function.');
testString: assert(typeof getCircles === 'function');
- text: <code>getCircles([0.1234, 0.9876], [0.8765, 0.2345], 2.0)</code> should return <code>[[1.8631, 1.9742], [-0.8632, -0.7521]]</code>.
testString: assert.deepEqual(getCircles(...testCases[0]), answers[0], '<code>getCircles([0.1234, 0.9876], [0.8765, 0.2345], 2.0)</code> should return <code>[[1.8631, 1.9742], [-0.8632, -0.7521]]</code>.');
testString: assert.deepEqual(getCircles(...testCases[0]), answers[0]);
- text: <code>getCircles([0.0000, 2.0000], [0.0000, 0.0000], 1.0)</code> should return <code>[0, 1]</code>
testString: assert.deepEqual(getCircles(...testCases[1]), answers[1], '<code>getCircles([0.0000, 2.0000], [0.0000, 0.0000], 1.0)</code> should return <code>[0, 1]</code>');
testString: assert.deepEqual(getCircles(...testCases[1]), answers[1]);
- text: <code>getCircles([0.1234, 0.9876], [0.1234, 0.9876], 2.0)</code> should return <code>Coincident point. Infinite solutions</code>
testString: assert.deepEqual(getCircles(...testCases[2]), answers[2], '<code>getCircles([0.1234, 0.9876], [0.1234, 0.9876], 2.0)</code> should return <code>Coincident point. Infinite solutions</code>');
testString: assert.deepEqual(getCircles(...testCases[2]), answers[2]);
- text: <code>getCircles([0.1234, 0.9876], [0.8765, 0.2345], 0.5)</code> should return <code>No intersection. Points further apart than circle diameter</code>
testString: assert.deepEqual(getCircles(...testCases[3]), answers[3], '<code>getCircles([0.1234, 0.9876], [0.8765, 0.2345], 0.5)</code> should return <code>No intersection. Points further apart than circle diameter</code>');
testString: assert.deepEqual(getCircles(...testCases[3]), answers[3]);
- text: <code>getCircles([0.1234, 0.9876], [0.1234, 0.9876], 0.0)</code> should return <code>Radius Zero</code>
testString: assert.deepEqual(getCircles(...testCases[4]), answers[4], '<code>getCircles([0.1234, 0.9876], [0.1234, 0.9876], 0.0)</code> should return <code>Radius Zero</code>');
testString: assert.deepEqual(getCircles(...testCases[4]), answers[4]);
```

View File

@ -81,15 +81,15 @@ For the input, expect the argument to be an array of objects (points) with <code
```yml
tests:
- text: <code>getClosestPair</code> is a function.
testString: assert(typeof getClosestPair === 'function', '<code>getClosestPair</code> is a function.');
testString: assert(typeof getClosestPair === 'function');
- text: Distance should be the following.
testString: assert.equal(getClosestPair(points1).distance, answer1.distance, 'Distance should be the following.');
testString: assert.equal(getClosestPair(points1).distance, answer1.distance);
- text: Points should be the following.
testString: assert.deepEqual(JSON.parse(JSON.stringify(getClosestPair(points1))).pair, answer1.pair, 'Points should be the following.');
testString: assert.deepEqual(JSON.parse(JSON.stringify(getClosestPair(points1))).pair, answer1.pair);
- text: Distance should be the following.
testString: assert.equal(getClosestPair(points2).distance, answer2.distance, 'Distance should be the following.');
testString: assert.equal(getClosestPair(points2).distance, answer2.distance);
- text: Points should be the following.
testString: assert.deepEqual(JSON.parse(JSON.stringify(getClosestPair(points2))).pair, answer2.pair, 'Points should be the following.');
testString: assert.deepEqual(JSON.parse(JSON.stringify(getClosestPair(points2))).pair, answer2.pair);
```

View File

@ -34,11 +34,11 @@ Given non-negative integers <code>m</code> and <code>n</code>, generate all size
```yml
tests:
- text: <code>combinations</code> is a function.
testString: assert(typeof combinations === 'function', '<code>combinations</code> is a function.');
testString: assert(typeof combinations === 'function');
- text: <code>combinations(3, 5)</code> should return <code>[[0, 1, 2], [0, 1, 3], [0, 1, 4], [0, 2, 3], [0, 2, 4], [0, 3, 4], [1, 2, 3], [1, 2, 4], [1, 3, 4], [2, 3, 4]]</code>.
testString: assert.deepEqual(combinations(testInput1[0], testInput1[1]), testOutput1, '<code>combinations(3, 5)</code> should return <code>[[0, 1, 2], [0, 1, 3], [0, 1, 4], [0, 2, 3], [0, 2, 4], [0, 3, 4], [1, 2, 3], [1, 2, 4], [1, 3, 4], [2, 3, 4]]</code>.');
testString: assert.deepEqual(combinations(testInput1[0], testInput1[1]), testOutput1);
- text: <code>combinations(4, 6)</code> should return <code>[[0,1,2,3], [0,1,2,4], [0,1,2,5], [0,1,3,4], [0,1,3,5], [0,1,4,5], [0,2,3,4], [0,2,3,5], [0,2,4,5], [0,3,4,5], [1,2,3,4], [1,2,3,5], [1,2,4,5], [1,3,4,5], [2,3,4,5]]</code>
testString: assert.deepEqual(combinations(testInput2[0], testInput2[1]), testOutput2, '<code>combinations(4, 6)</code> should return <code>[[0,1,2,3], [0,1,2,4], [0,1,2,5], [0,1,3,4], [0,1,3,5], [0,1,4,5], [0,2,3,4], [0,2,3,5], [0,2,4,5], [0,3,4,5], [1,2,3,4], [1,2,3,5], [1,2,4,5], [1,3,4,5], [2,3,4,5]]</code>');
testString: assert.deepEqual(combinations(testInput2[0], testInput2[1]), testOutput2);
```

View File

@ -34,17 +34,17 @@ Test your function with the following series of inputs showing your output here
```yml
tests:
- text: <code>quibble</code> is a function.
testString: assert(typeof quibble === 'function', '<code>quibble</code> is a function.');
testString: assert(typeof quibble === 'function');
- text: <code>quibble(["ABC"])</code> should return a string.
testString: assert(typeof quibble(["ABC"]) === 'string', '<code>quibble(["ABC"])</code> should return a string.');
testString: assert(typeof quibble(["ABC"]) === 'string');
- text: <code>quibble([])</code> should return "{}".
testString: assert.equal(quibble(testCases[0]), results[0], '<code>quibble([])</code> should return "{}".');
testString: assert.equal(quibble(testCases[0]), results[0]);
- text: <code>quibble(["ABC"])</code> should return "{ABC}".
testString: assert.equal(quibble(testCases[1]), results[1], '<code>quibble(["ABC"])</code> should return "{ABC}".');
testString: assert.equal(quibble(testCases[1]), results[1]);
- text: <code>quibble(["ABC", "DEF"])</code> should return "{ABC and DEF}".
testString: assert.equal(quibble(testCases[2]), results[2], '<code>quibble(["ABC", "DEF"])</code> should return "{ABC and DEF}".');
testString: assert.equal(quibble(testCases[2]), results[2]);
- text: <code>quibble(["ABC", "DEF", "G", "H"])</code> should return "{ABC,DEF,G and H}".
testString: assert.equal(quibble(testCases[3]), results[3], '<code>quibble(["ABC", "DEF", "G", "H"])</code> should return "{ABC,DEF,G and H}".');
testString: assert.equal(quibble(testCases[3]), results[3]);
```

View File

@ -24,29 +24,29 @@ Given a <a href="https://en.wikipedia.org/wiki/List_(abstract_data_type)" title=
```yml
tests:
- text: <code>allEqual</code> is a function.
testString: assert(typeof allEqual === 'function', '<code>allEqual</code> is a function.');
testString: assert(typeof allEqual === 'function');
- text: <code>azSorted</code> is a function.
testString: assert(typeof azSorted === 'function', '<code>azSorted</code> is a function.');
testString: assert(typeof azSorted === 'function');
- text: <code>allEqual(["AA", "AA", "AA", "AA"])</code> returns true.
testString: assert(allEqual(testCases[0]), '<code>allEqual(["AA", "AA", "AA", "AA"])</code> returns true.');
testString: assert(allEqual(testCases[0]));
- text: <code>azSorted(["AA", "AA", "AA", "AA"])</code> returns false.
testString: assert(!azSorted(testCases[0]), '<code>azSorted(["AA", "AA", "AA", "AA"])</code> returns false.');
testString: assert(!azSorted(testCases[0]));
- text: <code>allEqual(["AA", "ACB", "BB", "CC"])</code> returns false.
testString: assert(!allEqual(testCases[1]), '<code>allEqual(["AA", "ACB", "BB", "CC"])</code> returns false.');
testString: assert(!allEqual(testCases[1]));
- text: <code>azSorted(["AA", "ACB", "BB", "CC"])</code> returns true.
testString: assert(azSorted(testCases[1]), '<code>azSorted(["AA", "ACB", "BB", "CC"])</code> returns true.');
testString: assert(azSorted(testCases[1]));
- text: <code>allEqual([])</code> returns true.
testString: assert(allEqual(testCases[2]), '<code>allEqual([])</code> returns true.');
testString: assert(allEqual(testCases[2]));
- text: <code>azSorted([])</code> returns true.
testString: assert(azSorted(testCases[2]), '<code>azSorted([])</code> returns true.');
testString: assert(azSorted(testCases[2]));
- text: <code>allEqual(["AA"])</code> returns true.
testString: assert(allEqual(testCases[3]), '<code>allEqual(["AA"])</code> returns true.');
testString: assert(allEqual(testCases[3]));
- text: <code>azSorted(["AA"])</code> returns true.
testString: assert(azSorted(testCases[3]), '<code>azSorted(["AA"])</code> returns true.');
testString: assert(azSorted(testCases[3]));
- text: <code>allEqual(["BB", "AA"])</code> returns false.
testString: assert(!allEqual(testCases[4]), '<code>allEqual(["BB", "AA"])</code> returns false.');
testString: assert(!allEqual(testCases[4]));
- text: <code>azSorted(["BB", "AA"])</code> returns false.
testString: assert(!azSorted(testCases[4]), '<code>azSorted(["BB", "AA"])</code> returns false.');
testString: assert(!azSorted(testCases[4]));
```

View File

@ -55,13 +55,13 @@ Demonstrate that it passes the following three test-cases:
```yml
tests:
- text: <code>convertSeconds</code> is a function.
testString: assert(typeof convertSeconds === 'function', '<code>convertSeconds</code> is a function.');
testString: assert(typeof convertSeconds === 'function');
- text: <code>convertSeconds(7259)</code> should return <code>2 hr, 59 sec</code>.
testString: assert.equal(convertSeconds(testCases[0]), results[0], '<code>convertSeconds(7259)</code> should return <code>2 hr, 59 sec</code>.');
testString: assert.equal(convertSeconds(testCases[0]), results[0]);
- text: <code>convertSeconds(86400)</code> should return <code>1 d</code>.
testString: assert.equal(convertSeconds(testCases[1]), results[1], '<code>convertSeconds(86400)</code> should return <code>1 d</code>.');
testString: assert.equal(convertSeconds(testCases[1]), results[1]);
- text: <code>convertSeconds(6000000)</code> should return <code>9 wk, 6 d, 10 hr, 40 min</code>.
testString: assert.equal(convertSeconds(testCases[2]), results[2], '<code>convertSeconds(6000000)</code> should return <code>9 wk, 6 d, 10 hr, 40 min</code>.');
testString: assert.equal(convertSeconds(testCases[2]), results[2]);
```

View File

@ -28,13 +28,13 @@ In general, this essentially means matching from left-to-right or right-to-left.
```yml
tests:
- text: <code>countSubstring</code> is a function.
testString: assert(typeof countSubstring === 'function', '<code>countSubstring</code> is a function.');
testString: assert(typeof countSubstring === 'function');
- text: <code>countSubstring("the three truths", "th")</code> should return <code>3</code>.
testString: assert.equal(countSubstring(testCases[0], searchString[0]), results[0], '<code>countSubstring("the three truths", "th")</code> should return <code>3</code>.');
testString: assert.equal(countSubstring(testCases[0], searchString[0]), results[0]);
- text: <code>countSubstring("ababababab", "abab")</code> should return <code>2</code>.
testString: assert.equal(countSubstring(testCases[1], searchString[1]), results[1], '<code>countSubstring("ababababab", "abab")</code> should return <code>2</code>.');
testString: assert.equal(countSubstring(testCases[1], searchString[1]), results[1]);
- text: <code>countSubstring("abaabba*bbaba*bbab", "a*b")</code> should return <code>2</code>.
testString: assert.equal(countSubstring(testCases[2], searchString[2]), results[2], '<code>countSubstring("abaabba*bbaba*bbab", "a*b")</code> should return <code>2</code>.');
testString: assert.equal(countSubstring(testCases[2], searchString[2]), results[2]);
```

View File

@ -35,9 +35,9 @@ Implement a function to determine how many ways there are to make change for a d
```yml
tests:
- text: <code>countCoins</code> is a function.
testString: assert(typeof countCoins === 'function', '<code>countCoins</code> is a function.');
testString: assert(typeof countCoins === 'function');
- text: <code>countCoints()</code> should return 242.
testString: assert.equal(countCoins(), 242, '<code>countCoints()</code> should return 242.');
testString: assert.equal(countCoins(), 242);
```

View File

@ -41,11 +41,11 @@ solve for <big>$w$, $x$, $y$</big> and <big>$z$</big>, using Cramer's rule.
```yml
tests:
- text: <code>cramersRule</code> is a function.
testString: assert(typeof cramersRule === 'function', '<code>cramersRule</code> is a function.');
testString: assert(typeof cramersRule === 'function');
- text: <code>cramersRule([[2, -1, 5, 1], [3, 2, 2, -6], [1, 3, 3, -1], [5, -2, -3, 3]], [-3, -32, -47, 49])</code> should return <code>[2, -12, -4, 1]</code>.
testString: assert.deepEqual(cramersRule(matrices[0], freeTerms[0]), answers[0], '<code>cramersRule([[2, -1, 5, 1], [3, 2, 2, -6], [1, 3, 3, -1], [5, -2, -3, 3]], [-3, -32, -47, 49])</code> should return <code>[2, -12, -4, 1]</code>.');
testString: assert.deepEqual(cramersRule(matrices[0], freeTerms[0]), answers[0]);
- text: <code>cramersRule([[3, 1, 1], [2, 2, 5], [1, -3, -4]], [3, -1, 2])</code> should return <code>[1, 1, -1]</code>.
testString: assert.deepEqual(cramersRule(matrices[1], freeTerms[1]), answers[1], '<code>cramersRule([[3, 1, 1], [2, 2, 5], [1, -3, -4]], [3, -1, 2])</code> should return <code>[1, 1, -1]</code>.');
testString: assert.deepEqual(cramersRule(matrices[1], freeTerms[1]), answers[1]);
```

View File

@ -25,11 +25,11 @@ Example output: <code>['2007-11-23', 'Sunday, November 23, 2007']</code>
```yml
tests:
- text: <code>getDateFormats</code> is a function.
testString: assert(typeof getDateFormats === 'function', '<code>getDateFormats</code> is a function.');
testString: assert(typeof getDateFormats === 'function');
- text: Should return an object.
testString: assert(typeof getDateFormats() === 'object', 'Should return an object.');
testString: assert(typeof getDateFormats() === 'object');
- text: Should returned an array with 2 elements.
testString: assert(getDateFormats().length === 2, 'Should returned an array with 2 elements.');
testString: assert(getDateFormats().length === 2);
- text: Should return the correct date in the right format
testString: assert.deepEqual(getDateFormats(), dates, equalsMessage);

View File

@ -22,19 +22,19 @@ Example output: <code>"March 8 2009 7:30am EST"</code>
```yml
tests:
- text: <code>add12Hours</code> is a function.
testString: assert(typeof add12Hours === 'function', '<code>add12Hours</code> is a function.');
testString: assert(typeof add12Hours === 'function');
- text: <code>add12Hours(dateString)</code> should return a string.
testString: assert(typeof add12Hours('January 17 2017 11:43am EST') === 'string', '<code>add12Hours(dateString)</code> should return a string.');
testString: assert(typeof add12Hours('January 17 2017 11:43am EST') === 'string');
- text: <code>add12Hours("January 17 2017 11:43am EST")</code> should return <code>"January 17 2017 11:43pm EST"</code>
testString: assert(add12Hours('January 17 2017 11:43am EST') === 'January 17 2017 11:43pm EST', '<code>add12Hours("January 17 2017 11:43am EST")</code> should return <code>"January 17 2017 11:43pm EST"</code>');
testString: assert(add12Hours('January 17 2017 11:43am EST') === 'January 17 2017 11:43pm EST');
- text: Should handel day change. <code>add12Hours("March 7 2009 7:30pm EST")</code> should return <code>"March 8 2009 7:30am EST"</code>
testString: assert(add12Hours('March 7 2009 7:30pm EST') === 'March 8 2009 7:30am EST', 'Should handel day change. <code>add12Hours("March 7 2009 7:30pm EST")</code> should return <code>"March 8 2009 7:30am EST"</code>');
testString: assert(add12Hours('March 7 2009 7:30pm EST') === 'March 8 2009 7:30am EST');
- text: Should handel month change in a leap years. <code>add12Hours("February 29 2004 9:15pm EST")</code> should return <code>"March 1 2004 9:15am EST"</code>
testString: assert(add12Hours('February 29 2004 9:15pm EST') === 'March 1 2004 9:15am EST', 'Should handel month change in a leap years. <code>add12Hours("February 29 2004 9:15pm EST")</code> should return <code>"March 1 2004 9:15am EST"</code>');
testString: assert(add12Hours('February 29 2004 9:15pm EST') === 'March 1 2004 9:15am EST');
- text: Should handel month change in a common years. <code>add12Hours("February 28 1999 3:15pm EST")</code> should return <code>"March 1 1999 3:15am EST"</code>
testString: assert(add12Hours('February 28 1999 3:15pm EST') === 'March 1 1999 3:15am EST', 'Should handel month change in a common years. <code>add12Hours("February 28 1999 3:15pm EST")</code> should return <code>"March 1 1999 3:15am EST"</code>');
testString: assert(add12Hours('February 28 1999 3:15pm EST') === 'March 1 1999 3:15am EST');
- text: Should handel year change. <code>add12Hours("December 31 2020 1:45pm EST")</code> should return <code>"January 1 2021 1:45am EST"</code>
testString: assert(add12Hours('December 31 2020 1:45pm EST') === 'January 1 2021 1:45am EST', 'Should handel year change. <code>add12Hours("December 31 2020 1:45pm EST")</code> should return <code>"January 1 2021 1:45am EST"</code>');
testString: assert(add12Hours('December 31 2020 1:45pm EST') === 'January 1 2021 1:45am EST');
```

View File

@ -20,13 +20,13 @@ Write a function that takes a start year and an end year and return an array of
```yml
tests:
- text: <code>findXmasSunday</code> is a function.
testString: assert(typeof findXmasSunday === 'function', '<code>findXmasSunday</code> is a function.');
testString: assert(typeof findXmasSunday === 'function');
- text: <code>findChristmasSunday(2000, 2100)</code> should return an array.
testString: assert(typeof findXmasSunday(2000, 2100) === 'object', '<code>findChristmasSunday(2000, 2100)</code> should return an array.');
testString: assert(typeof findXmasSunday(2000, 2100) === 'object');
- text: <code>findChristmasSunday(2008, 2121</code> should return [1977, 1983, 1988, 1994, 2005, 2011, 2016]
testString: assert.deepEqual(findXmasSunday(1970, 2017), firstSolution, '<code>findChristmasSunday(2008, 2121</code> should return [1977, 1983, 1988, 1994, 2005, 2011, 2016]');
testString: assert.deepEqual(findXmasSunday(1970, 2017), firstSolution);
- text: <code>findChristmasSunday(2008, 2121</code> should return [2011, 2016, 2022, 2033, 2039, 2044, 2050, 2061, 2067, 2072, 2078, 2089, 2095, 2101, 2107, 2112, 2118]
testString: assert.deepEqual(findXmasSunday(2008, 2121), secondSolution, '<code>findChristmasSunday(2008, 2121</code> should return [2011, 2016, 2022, 2033, 2039, 2044, 2050, 2061, 2067, 2072, 2078, 2089, 2095, 2101, 2107, 2112, 2118]');
testString: assert.deepEqual(findXmasSunday(2008, 2121), secondSolution);
```

View File

@ -78,11 +78,11 @@ Deals can also be checked against <a href="https://freecellgamesolutions.com/" t
```yml
tests:
- text: <code>dealFreeCell</code> is a function.
testString: assert(typeof dealFreeCell === 'function', '<code>dealFreeCell</code> is a function.');
testString: assert(typeof dealFreeCell === 'function');
- text: <code>dealFreeCell(seed)</code> should return an object.
testString: assert(typeof dealFreeCell(1) === 'object', '<code>dealFreeCell(seed)</code> should return an object.');
testString: assert(typeof dealFreeCell(1) === 'object');
- text: <code>dealFreeCell(seed)</code> should return an array of length 7.
testString: assert(dealFreeCell(1).length === 7, '<code>dealFreeCell(seed)</code> should return an array of length 7.');
testString: assert(dealFreeCell(1).length === 7);
- text: "<code>dealFreeCell(1)</code> should return an array identical to example \"Game #1\""
testString: "assert.deepEqual(dealFreeCell(1), game1);"
- text: "<code>dealFreeCell(617)</code> should return an array identical to example \"Game #617\""

View File

@ -27,15 +27,15 @@ This task will not test for:
```yml
tests:
- text: <code>deepcopy</code> should be a function.
testString: assert(typeof deepcopy === 'function', '<code>deepcopy</code> should be a function.');
testString: assert(typeof deepcopy === 'function');
- text: '<code>deepcopy({test: "test"})</code> should return an object.'
testString: 'assert(typeof deepcopy(obj1) === ''object'');'
- text: Should not return the same object that was provided.
testString: assert(deepcopy(obj2) != obj2, 'Should not return the same object that was provided.');
testString: assert(deepcopy(obj2) != obj2);
- text: When passed an object containing an array, should return a deep copy of the object.
testString: assert.deepEqual(deepcopy(obj2), obj2, 'When passed an object containing an array, should return a deep copy of the object.');
testString: assert.deepEqual(deepcopy(obj2), obj2);
- text: When passed an object containing another object, should return a deep copy of the object.
testString: assert.deepEqual(deepcopy(obj3), obj3, 'When passed an object containing another object, should return a deep copy of the object.');
testString: assert.deepEqual(deepcopy(obj3), obj3);
```

View File

@ -29,15 +29,15 @@ tests:
- text: <code>new Num(4)</code> should return an object.
testString: assert(typeof (new Num(4)) === 'object');
- text: <code>new Num('test')</code> should throw a TypeError with message 'Not a Number'.
testString: assert.throws(() => new Num('test'), TypeError, 'Not a Number');
testString: assert.throws(() => new Num('test'), TypeError);
- text: <code>new Num(0)</code> should throw a TypeError with message 'Out of range'.
testString: assert.throws(() => new Num(0), TypeError, 'Out of range');
testString: assert.throws(() => new Num(0), TypeError);
- text: <code>new Num(-5)</code> should throw a TypeError with message 'Out of range'.
testString: assert.throws(() => new Num(-5), TypeError, 'Out of range');
testString: assert.throws(() => new Num(-5), TypeError);
- text: <code>new Num(10)</code> should throw a TypeError with message 'Out of range'.
testString: assert.throws(() => new Num(11), TypeError, 'Out of range');
testString: assert.throws(() => new Num(11), TypeError);
- text: <code>new Num(20)</code> should throw a TypeError with message 'Out of range'.
testString: assert.throws(() => new Num(20), TypeError, 'Out of range');
testString: assert.throws(() => new Num(20), TypeError);
- text: <code>new Num(3) + new Num(4)</code> should equal 7.
testString: assert.equal(new Num(3) + new Num(4), 7);
- text: <code>new Num(3) - new Num(4)</code> should equal -1.

View File

@ -37,13 +37,13 @@ Write a program which outputs all valid combinations as an array.
```yml
tests:
- text: <code>combinations</code> should be a function.
testString: assert(typeof combinations === 'function', '<code>combinations</code> should be a function.');
testString: assert(typeof combinations === 'function');
- text: <code>combinations([1, 2, 3], 6)</code> should return an Array.
testString: assert(Array.isArray(combinations([1, 2, 3], 6)), '<code>combinations([1, 2, 3], 6)</code> should return an Array.');
testString: assert(Array.isArray(combinations([1, 2, 3], 6)));
- text: <code>combinations([1, 2, 3, 4, 5, 6, 7], 12)</code> should return an array of length 14.
testString: assert(combinations(nums, total).length === len, '<code>combinations([1, 2, 3, 4, 5, 6, 7], 12)</code> should return an array of length 14.');
testString: assert(combinations(nums, total).length === len);
- text: <code>combinations([1, 2, 3, 4, 5, 6, 7], 12)</code> should return all valid combinations.
testString: assert.deepEqual(combinations(nums, total), result, '<code>combinations([1, 2, 3, 4, 5, 6, 7], 12)</code> should return all valid combinations.');
testString: assert.deepEqual(combinations(nums, total), result);
```

View File

@ -20,21 +20,21 @@ Convert a given date from the <a href="https://en.wikipedia.org/wiki/Gregorian
```yml
tests:
- text: <code>discordianDate</code> is a function.
testString: assert(typeof discordianDate === 'function', '<code>discordianDate</code> is a function.');
testString: assert(typeof discordianDate === 'function');
- text: <code>discordianDate(new Date(2010, 6, 22))</code> should return <code>"Pungenday, the 57th day of Confusion in the YOLD 3176"</code>.
testString: assert(discordianDate(new Date(2010, 6, 22)) === 'Pungenday, the 57th day of Confusion in the YOLD 3176', '<code>discordianDate(new Date(2010, 6, 22))</code> should return <code>"Pungenday, the 57th day of Confusion in the YOLD 3176"</code>.');
testString: assert(discordianDate(new Date(2010, 6, 22)) === 'Pungenday, the 57th day of Confusion in the YOLD 3176');
- text: <code>discordianDate(new Date(2012, 1, 28))</code> should return <code>"Prickle-Prickle, the 59th day of Chaos in the YOLD 3178"</code>.
testString: assert(discordianDate(new Date(2012, 1, 28)) === 'Prickle-Prickle, the 59th day of Chaos in the YOLD 3178', '<code>discordianDate(new Date(2012, 1, 28))</code> should return <code>"Prickle-Prickle, the 59th day of Chaos in the YOLD 3178"</code>.');
testString: assert(discordianDate(new Date(2012, 1, 28)) === 'Prickle-Prickle, the 59th day of Chaos in the YOLD 3178');
- text: <code>discordianDate(new Date(2012, 1, 29))</code> should return <code>"Setting Orange, the 60th day of Chaos in the YOLD 3178. Celebrate St. Tib\'s Day!"</code>.
testString: assert(discordianDate(new Date(2012, 1, 29)) === 'Setting Orange, the 60th day of Chaos in the YOLD 3178. Celebrate St. Tib\'s Day!', '<code>discordianDate(new Date(2012, 1, 29))</code> should return <code>"Setting Orange, the 60th day of Chaos in the YOLD 3178. Celebrate St. Tib\'s Day!"</code>.');
testString: assert(discordianDate(new Date(2012, 1, 29)) === 'Setting Orange, the 60th day of Chaos in the YOLD 3178. Celebrate St. Tib\'s Day!');
- text: <code>discordianDate(new Date(2012, 2, 1))</code> should return <code>"Setting Orange, the 60th day of Chaos in the YOLD 3178"</code>.
testString: assert(discordianDate(new Date(2012, 2, 1)) === 'Setting Orange, the 60th day of Chaos in the YOLD 3178', '<code>discordianDate(new Date(2012, 2, 1))</code> should return <code>"Setting Orange, the 60th day of Chaos in the YOLD 3178"</code>.');
testString: assert(discordianDate(new Date(2012, 2, 1)) === 'Setting Orange, the 60th day of Chaos in the YOLD 3178');
- text: <code>discordianDate(new Date(2010, 0, 5))</code> should return <code>"Setting Orange, the 5th day of Chaos in the YOLD 3176. Celebrate Mungday!"</code>.
testString: assert(discordianDate(new Date(2010, 0, 5)) === 'Setting Orange, the 5th day of Chaos in the YOLD 3176. Celebrate Mungday!', '<code>discordianDate(new Date(2010, 0, 5))</code> should return <code>"Setting Orange, the 5th day of Chaos in the YOLD 3176. Celebrate Mungday!"</code>.');
testString: assert(discordianDate(new Date(2010, 0, 5)) === 'Setting Orange, the 5th day of Chaos in the YOLD 3176. Celebrate Mungday!');
- text: <code>discordianDate(new Date(2011, 4, 3))</code> should return <code>"Pungenday, the 50th day of Discord in the YOLD 3177. Celebrate Discoflux!"</code>.
testString: assert(discordianDate(new Date(2011, 4, 3)) === 'Pungenday, the 50th day of Discord in the YOLD 3177. Celebrate Discoflux!', '<code>discordianDate(new Date(2011, 4, 3))</code> should return <code>"Pungenday, the 50th day of Discord in the YOLD 3177. Celebrate Discoflux!"</code>.');
testString: assert(discordianDate(new Date(2011, 4, 3)) === 'Pungenday, the 50th day of Discord in the YOLD 3177. Celebrate Discoflux!');
- text: <code>discordianDate(new Date(2015, 9, 19))</code> should return <code>"Boomtime, the 73rd day of Bureaucracy in the YOLD 3181"</code>.
testString: assert(discordianDate(new Date(2015, 9, 19)) === 'Boomtime, the 73rd day of Bureaucracy in the YOLD 3181', '<code>discordianDate(new Date(2015, 9, 19))</code> should return <code>"Boomtime, the 73rd day of Bureaucracy in the YOLD 3181"</code>.');
testString: assert(discordianDate(new Date(2015, 9, 19)) === 'Boomtime, the 73rd day of Bureaucracy in the YOLD 3181');
```

View File

@ -29,21 +29,21 @@ The first parameter will be the operation to be performed, for example, "m_add"
```yml
tests:
- text: <code>operation</code> is a function.
testString: assert(typeof operation === 'function', '<code>operation</code> is a function.');
testString: assert(typeof operation === 'function');
- text: <code>operation("m_add",[[1,2],[3,4]],[[1,2],[3,4]])</code> should return <code>[[2,4],[6,8]]</code>.
testString: assert.deepEqual(operation('m_add', [[1, 2], [3, 4]], [[1, 2], [3, 4]]), [[2, 4], [6, 8]], '<code>operation("m_add",[[1,2],[3,4]],[[1,2],[3,4]])</code> should return <code>[[2,4],[6,8]]</code>.');
testString: assert.deepEqual(operation('m_add', [[1, 2], [3, 4]], [[1, 2], [3, 4]]), [[2, 4], [6, 8]]);
- text: <code>operation("s_add",[[1,2],[3,4]],[[1,2],[3,4]])</code> should return <code>[[3,4],[5,6]]</code>.
testString: assert.deepEqual(operation('s_add', [[1, 2], [3, 4]], 2), [[3, 4], [5, 6]], '<code>operation("s_add",[[1,2],[3,4]],[[1,2],[3,4]])</code> should return <code>[[3,4],[5,6]]</code>.');
testString: assert.deepEqual(operation('s_add', [[1, 2], [3, 4]], 2), [[3, 4], [5, 6]]);
- text: <code>operation("m_sub",[[1,2],[3,4]],[[1,2],[3,4]])</code> should return <code>[[0,0],[0,0]]</code>.
testString: assert.deepEqual(operation('m_sub', [[1, 2], [3, 4]], [[1, 2], [3, 4]]), [[0, 0], [0, 0]], '<code>operation("m_sub",[[1,2],[3,4]],[[1,2],[3,4]])</code> should return <code>[[0,0],[0,0]]</code>.');
testString: assert.deepEqual(operation('m_sub', [[1, 2], [3, 4]], [[1, 2], [3, 4]]), [[0, 0], [0, 0]]);
- text: <code>operation("m_mult",[[1,2],[3,4]],[[1,2],[3,4]])</code> should return <code>[[1,4],[9,16]]</code>.
testString: assert.deepEqual(operation('m_mult', [[1, 2], [3, 4]], [[1, 2], [3, 4]]), [[1, 4], [9, 16]], '<code>operation("m_mult",[[1,2],[3,4]],[[1,2],[3,4]])</code> should return <code>[[1,4],[9,16]]</code>.');
testString: assert.deepEqual(operation('m_mult', [[1, 2], [3, 4]], [[1, 2], [3, 4]]), [[1, 4], [9, 16]]);
- text: <code>operation("m_div",[[1,2],[3,4]],[[1,2],[3,4]])</code> should return <code>[[1,1],[1,1]]</code>.
testString: assert.deepEqual(operation('m_div', [[1, 2], [3, 4]], [[1, 2], [3, 4]]), [[1, 1], [1, 1]], '<code>operation("m_div",[[1,2],[3,4]],[[1,2],[3,4]])</code> should return <code>[[1,1],[1,1]]</code>.');
testString: assert.deepEqual(operation('m_div', [[1, 2], [3, 4]], [[1, 2], [3, 4]]), [[1, 1], [1, 1]]);
- text: <code>operation("m_exp",[[1,2],[3,4]],[[1,2],[3,4]])</code> should return <code>[[1,4],[27,256]]</code>.
testString: assert.deepEqual(operation('m_exp', [[1, 2], [3, 4]], [[1, 2], [3, 4]]), [[1, 4], [27, 256]], '<code>operation("m_exp",[[1,2],[3,4]],[[1,2],[3,4]])</code> should return <code>[[1,4],[27,256]]</code>.');
testString: assert.deepEqual(operation('m_exp', [[1, 2], [3, 4]], [[1, 2], [3, 4]]), [[1, 4], [27, 256]]);
- text: <code>operation("m_add",[[1,2,3,4],[5,6,7,8]],[[9,10,11,12],[13,14,15,16]])</code> should return <code>[[10,12,14,16],[18,20,22,24]]</code>.
testString: assert.deepEqual(operation('m_add', [[1, 2, 3, 4], [5, 6, 7, 8]], [[9, 10, 11, 12], [13, 14, 15, 16]]), [[10, 12, 14, 16], [18, 20, 22, 24]], '<code>operation("m_add",[[1,2,3,4],[5,6,7,8]],[[9,10,11,12],[13,14,15,16]])</code> should return <code>[[10,12,14,16],[18,20,22,24]]</code>.');
testString: assert.deepEqual(operation('m_add', [[1, 2, 3, 4], [5, 6, 7, 8]], [[9, 10, 11, 12], [13, 14, 15, 16]]), [[10, 12, 14, 16], [18, 20, 22, 24]]);
```

View File

@ -27,15 +27,15 @@ The function should accept two parameters. The first will receive <code>n</code>
```yml
tests:
- text: <code>emirps</code> is a function.
testString: assert(typeof emirps === 'function', '<code>emirps</code> is a function.');
testString: assert(typeof emirps === 'function');
- text: <code>emirps(20,true)</code> should return <code>[13,17,31,37,71,73,79,97,107,113,149,157,167,179,199,311,337,347,359,389]</code>
testString: assert.deepEqual(emirps(20, true), [13, 17, 31, 37, 71, 73, 79, 97, 107, 113, 149, 157, 167, 179, 199, 311, 337, 347, 359, 389], '<code>emirps(20,true)</code> should return <code>[13,17,31,37,71,73,79,97,107,113,149,157,167,179,199,311,337,347,359,389]</code>');
testString: assert.deepEqual(emirps(20, true), [13, 17, 31, 37, 71, 73, 79, 97, 107, 113, 149, 157, 167, 179, 199, 311, 337, 347, 359, 389]);
- text: <code>emirps(10000)</code> should return <code>948349</code>
testString: assert.deepEqual(emirps(10000), 948349, '<code>emirps(10000)</code> should return <code>948349</code>');
testString: assert.deepEqual(emirps(10000), 948349);
- text: <code>emirps([7700,8000],true)</code> should return <code>[7717,7757,7817,7841,7867,7879,7901,7927,7949,7951,7963]</code>
testString: assert.deepEqual(emirps([7700, 8000], true), [7717, 7757, 7817, 7841, 7867, 7879, 7901, 7927, 7949, 7951, 7963], '<code>emirps([7700,8000],true)</code> should return <code>[7717,7757,7817,7841,7867,7879,7901,7927,7949,7951,7963]</code>');
testString: assert.deepEqual(emirps([7700, 8000], true), [7717, 7757, 7817, 7841, 7867, 7879, 7901, 7927, 7949, 7951, 7963]);
- text: <code>emirps([7700,8000],true)</code> should return <code>11</code>
testString: assert.deepEqual(emirps([7700, 8000], false), 11, '<code>emirps([7700,8000],true)</code> should return <code>11</code>');
testString: assert.deepEqual(emirps([7700, 8000], false), 11);
```

View File

@ -23,19 +23,19 @@ where $count_i$ is the count of character $n_i$.
```yml
tests:
- text: <code>entropy</code> is a function.
testString: assert(typeof entropy === 'function', '<code>entropy</code> is a function.');
testString: assert(typeof entropy === 'function');
- text: <code>entropy("0")</code> should return <code>0</code>
testString: assert.equal(entropy('0'), 0, '<code>entropy("0")</code> should return <code>0</code>');
testString: assert.equal(entropy('0'), 0);
- text: <code>entropy("01")</code> should return <code>1</code>
testString: assert.equal(entropy('01'), 1, '<code>entropy("01")</code> should return <code>1</code>');
testString: assert.equal(entropy('01'), 1);
- text: <code>entropy("0123")</code> should return <code>2</code>
testString: assert.equal(entropy('0123'), 2, '<code>entropy("0123")</code> should return <code>2</code>');
testString: assert.equal(entropy('0123'), 2);
- text: <code>entropy("01234567")</code> should return <code>3</code>
testString: assert.equal(entropy('01234567'), 3, '<code>entropy("01234567")</code> should return <code>3</code>');
testString: assert.equal(entropy('01234567'), 3);
- text: <code>entropy("0123456789abcdef")</code> should return <code>4</code>
testString: assert.equal(entropy('0123456789abcdef'), 4, '<code>entropy("0123456789abcdef")</code> should return <code>4</code>');
testString: assert.equal(entropy('0123456789abcdef'), 4);
- text: <code>entropy("1223334444")</code> should return <code>1.8464393446710154</code>
testString: assert.equal(entropy('1223334444'), 1.8464393446710154, '<code>entropy("1223334444")</code> should return <code>1.8464393446710154</code>');
testString: assert.equal(entropy('1223334444'), 1.8464393446710154);
```

View File

@ -41,19 +41,19 @@ Assume that the sequence may be very long.
```yml
tests:
- text: <code>equilibrium</code> is a function.
testString: assert(typeof equilibrium === 'function', '<code>equilibrium</code> is a function.');
testString: assert(typeof equilibrium === 'function');
- text: <code>equilibrium([-7, 1, 5, 2, -4, 3, 0])</code> should return <code>[3,6]</code>.
testString: assert.deepEqual(equilibrium(equilibriumTests[0]), ans[0], '<code>equilibrium([-7, 1, 5, 2, -4, 3, 0])</code> should return <code>[3,6]</code>.');
testString: assert.deepEqual(equilibrium(equilibriumTests[0]), ans[0]);
- text: <code>equilibrium([2, 4, 6])</code> should return <code>[]</code>.
testString: assert.deepEqual(equilibrium(equilibriumTests[1]), ans[1], '<code>equilibrium([2, 4, 6])</code> should return <code>[]</code>.');
testString: assert.deepEqual(equilibrium(equilibriumTests[1]), ans[1]);
- text: <code>equilibrium([2, 9, 2])</code> should return <code>[1]</code>.
testString: assert.deepEqual(equilibrium(equilibriumTests[2]), ans[2], '<code>equilibrium([2, 9, 2])</code> should return <code>[1]</code>.');
testString: assert.deepEqual(equilibrium(equilibriumTests[2]), ans[2]);
- text: <code>equilibrium([1, -1, 1, -1, 1, -1, 1])</code> should return <code>[0,1,2,3,4,5,6]</code>.
testString: assert.deepEqual(equilibrium(equilibriumTests[3]), ans[3], '<code>equilibrium([1, -1, 1, -1, 1, -1, 1])</code> should return <code>[0,1,2,3,4,5,6]</code>.');
testString: assert.deepEqual(equilibrium(equilibriumTests[3]), ans[3]);
- text: <code>equilibrium([1])</code> should return <code>[0]</code>.
testString: assert.deepEqual(equilibrium(equilibriumTests[4]), ans[4], '<code>equilibrium([1])</code> should return <code>[0]</code>.');
testString: assert.deepEqual(equilibrium(equilibriumTests[4]), ans[4]);
- text: <code>equilibrium([])</code> should return <code>[]</code>.
testString: assert.deepEqual(equilibrium(equilibriumTests[5]), ans[5], '<code>equilibrium([])</code> should return <code>[]</code>.');
testString: assert.deepEqual(equilibrium(equilibriumTests[5]), ans[5]);
```

View File

@ -73,17 +73,17 @@ Use these functions to create a function that does Ethiopian multiplication.
```yml
tests:
- text: <code>eth_mult</code> is a function.
testString: assert(typeof eth_mult === 'function', '<code>eth_mult</code> is a function.');
testString: assert(typeof eth_mult === 'function');
- text: <code>eth_mult(17,34)</code> should return <code>578</code>.
testString: assert.equal(eth_mult(17, 34), 578, '<code>eth_mult(17,34)</code> should return <code>578</code>.');
testString: assert.equal(eth_mult(17, 34), 578);
- text: <code>eth_mult(23,46)</code> should return <code>1058</code>.
testString: assert.equal(eth_mult(23, 46), 1058, '<code>eth_mult(23,46)</code> should return <code>1058</code>.');
testString: assert.equal(eth_mult(23, 46), 1058);
- text: <code>eth_mult(12,27)</code> should return <code>324</code>.
testString: assert.equal(eth_mult(12, 27), 324, '<code>eth_mult(12,27)</code> should return <code>324</code>.');
testString: assert.equal(eth_mult(12, 27), 324);
- text: <code>eth_mult(56,98)</code> should return <code>5488</code>.
testString: assert.equal(eth_mult(56, 98), 5488, '<code>eth_mult(56,98)</code> should return <code>5488</code>.');
testString: assert.equal(eth_mult(56, 98), 5488);
- text: <code>eth_mult(63,74)</code> should return <code>4662</code>.
testString: assert.equal(eth_mult(63, 74), 4662, '<code>eth_mult(63,74)</code> should return <code>4662</code>.');
testString: assert.equal(eth_mult(63, 74), 4662);
```

View File

@ -72,15 +72,15 @@ and to compare with the analytical solution.
```yml
tests:
- text: <code>eulersMethod</code> is a function.
testString: assert(typeof eulersMethod === 'function', '<code>eulersMethod</code> is a function.');
testString: assert(typeof eulersMethod === 'function');
- text: <code>eulersMethod(0, 100, 100, 10)</code> should return a number.
testString: assert(typeof eulersMethod(0, 100, 100, 10) === 'number', '<code>eulersMethod(0, 100, 100, 10)</code> should return a number.');
testString: assert(typeof eulersMethod(0, 100, 100, 10) === 'number');
- text: <code>eulersMethod(0, 100, 100, 10)</code> should return 20.0424631833732.
testString: assert.equal(eulersMethod(0, 100, 100, 2), 20.0424631833732, '<code>eulersMethod(0, 100, 100, 10)</code> should return 20.0424631833732.');
testString: assert.equal(eulersMethod(0, 100, 100, 2), 20.0424631833732);
- text: <code>eulersMethod(0, 100, 100, 10)</code> should return 20.01449963666907.
testString: assert.equal(eulersMethod(0, 100, 100, 5), 20.01449963666907, '<code>eulersMethod(0, 100, 100, 10)</code> should return 20.01449963666907.');
testString: assert.equal(eulersMethod(0, 100, 100, 5), 20.01449963666907);
- text: <code>eulersMethod(0, 100, 100, 10)</code> should return 20.000472392.
testString: assert.equal(eulersMethod(0, 100, 100, 10), 20.000472392, '<code>eulersMethod(0, 100, 100, 10)</code> should return 20.000472392.');
testString: assert.equal(eulersMethod(0, 100, 100, 10), 20.000472392);
```

View File

@ -22,17 +22,17 @@ $\binom{n}{k} = \frac{n!}{(n-k)!k!} = \frac{n(n-1)(n-2)\ldots(n-k+1)}{k(k-1)(k-2
```yml
tests:
- text: <code>binom</code> is a function.
testString: assert(typeof binom === 'function', '<code>binom</code> is a function.');
testString: assert(typeof binom === 'function');
- text: <code>binom(5,3)</code> should return 10.
testString: assert.equal(binom(5, 3), 10, '<code>binom(5,3)</code> should return 10.');
testString: assert.equal(binom(5, 3), 10);
- text: <code>binom(7,2)</code> should return 21.
testString: assert.equal(binom(7, 2), 21, '<code>binom(7,2)</code> should return 21.');
testString: assert.equal(binom(7, 2), 21);
- text: <code>binom(10,4)</code> should return 210.
testString: assert.equal(binom(10, 4), 210, '<code>binom(10,4)</code> should return 210.');
testString: assert.equal(binom(10, 4), 210);
- text: <code>binom(6,1)</code> should return 6.
testString: assert.equal(binom(6, 1), 6, '<code>binom(6,1)</code> should return 6.');
testString: assert.equal(binom(6, 1), 6);
- text: <code>binom(12,8)</code> should return 495.
testString: assert.equal(binom(12, 8), 495, '<code>binom(12,8)</code> should return 495.');
testString: assert.equal(binom(12, 8), 495);
```

View File

@ -142,17 +142,17 @@ into
```yml
tests:
- text: <code>markov</code> is a function.
testString: assert(typeof markov === 'function', '<code>markov</code> is a function.');
testString: assert(typeof markov === 'function');
- text: <code>markov(["A -> apple","B -> bag","S -> shop","T -> the","the shop -> my brother","a never used -> .terminating rule"],"I bought a B of As from T S.")</code> should return "I bought a bag of apples from my brother.".
testString: assert.deepEqual(markov(rules[0],tests[0]),outputs[0],'<code>markov(["A -> apple","B -> bag","S -> shop","T -> the","the shop -> my brother","a never used -> .terminating rule"],"I bought a B of As from T S.")</code> should return "I bought a bag of apples from my brother.".');
testString: assert.deepEqual(markov(rules[0],tests[0]),outputs[0]);
- text: <code>markov(["A -> apple","B -> bag","S -> .shop","T -> the","the shop -> my brother","a never used -> .terminating rule"],"I bought a B of As from T S.")</code> should return "I bought a bag of apples from T shop.".
testString: assert.deepEqual(markov(rules[1],tests[1]),outputs[1],'<code>markov(["A -> apple","B -> bag","S -> .shop","T -> the","the shop -> my brother","a never used -> .terminating rule"],"I bought a B of As from T S.")</code> should return "I bought a bag of apples from T shop.".');
testString: assert.deepEqual(markov(rules[1],tests[1]),outputs[1]);
- text: <code>markov(["A -> apple","WWWW -> with","Bgage -> ->.*","B -> bag","->.* -> money","W -> WW","S -> .shop","T -> the","the shop -> my brother","a never used -> .terminating rule"],"I bought a B of As W my Bgage from T S.")</code> should return "I bought a bag of apples with my money from T shop.".
testString: assert.deepEqual(markov(rules[2],tests[2]),outputs[2],'<code>markov(["A -> apple","WWWW -> with","Bgage -> ->.*","B -> bag","->.* -> money","W -> WW","S -> .shop","T -> the","the shop -> my brother","a never used -> .terminating rule"],"I bought a B of As W my Bgage from T S.")</code> should return "I bought a bag of apples with my money from T shop.".');
testString: assert.deepEqual(markov(rules[2],tests[2]),outputs[2]);
- text: <code>markov(["_+1 -> _1+","1+1 -> 11+","1! -> !1",",! -> !+","_! -> _","1*1 -> x,@y","1x -> xX","X, -> 1,1","X1 -> 1X","_x -> _X",",x -> ,X","y1 -> 1y","y_ -> _","1@1 -> x,@y","1@_ -> @_",",@_ -> !_","++ -> +","_1 -> 1","1+_ -> 1","_+_ -> "],"_1111*11111_")</code> should return "11111111111111111111".
testString: assert.deepEqual(markov(rules[3],tests[3]),outputs[3],'<code>markov(["_+1 -> _1+","1+1 -> 11+","1! -> !1",",! -> !+","_! -> _","1*1 -> x,@y","1x -> xX","X, -> 1,1","X1 -> 1X","_x -> _X",",x -> ,X","y1 -> 1y","y_ -> _","1@1 -> x,@y","1@_ -> @_",",@_ -> !_","++ -> +","_1 -> 1","1+_ -> 1","_+_ -> "],"_1111*11111_")</code> should return "11111111111111111111".');
testString: assert.deepEqual(markov(rules[3],tests[3]),outputs[3]);
- text: <code>markov(["A0 -> 1B","0A1 -> C01","1A1 -> C11","0B0 -> A01","1B0 -> A11","B1 -> 1B","0C0 -> B01","1C0 -> B11","0C1 -> H01","1C1 -> H11"],"")</code> should return "00011H1111000".
testString: assert.deepEqual(markov(rules[4],tests[4]),outputs[4],'<code>markov(["A0 -> 1B","0A1 -> C01","1A1 -> C11","0B0 -> A01","1B0 -> A11","B1 -> 1B","0C0 -> B01","1C0 -> B11","0C1 -> H01","1C1 -> H11"],"")</code> should return "00011H1111000".');
testString: assert.deepEqual(markov(rules[4],tests[4]),outputs[4]);
```

View File

@ -35,15 +35,15 @@ Any cell size is allowed, EOF (<u>E</u>nd-<u>O</u>-<u>F</u>ile) support is optio
```yml
tests:
- text: <code>brain(bye)</code> should return a string
testString: assert(typeof brain(bye) === 'string', '<code>brain(bye)</code> should return a string');
testString: assert(typeof brain(bye) === 'string');
- text: <code>brain("++++++[>++++++++++<-]>+++++.")</code should return "A"
testString: assert.equal(brain("++++++[>++++++++++<-]>+++++."),"A", '<code>brain("++++++[>++++++++++<-]>+++++.")</code should return "A"');
testString: assert.equal(brain("++++++[>++++++++++<-]>+++++."),"A");
- text: <code>brain(bye)</code> should return <code>Goodbye, World!\\r\\n</code>
testString: assert.equal(brain(bye), 'Goodbye, World!\r\n', '<code>brain(bye)</code> should return <code>Goodbye, World!\\r\\n</code>');
- text: <code>brain(hello)</code> should return <code>Hello World!\\n</code>'
testString: assert.equal(brain(hello), "Hello World!\n", '<code>brain(hello)</code> should return <code>Hello World!\\n</code>');
- text: <code>brain(hello)</code> should return <code>Hello World!\\n</code>
testString: assert.equal(brain(hello), "Hello World!\n");
- text: <code>brain(fib)</code> should return <code>1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89</code>
testString: assert.equal(brain(fib), "1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89", '<code>brain(fib)</code> should return <code>1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89</code>');
testString: assert.equal(brain(fib), "1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89");
```

View File

@ -28,15 +28,15 @@ The function should have two parameters. The first will receive <code>n</code> o
```yml
tests:
- text: <code>primeGenerator</code> is a function.
testString: assert(typeof primeGenerator === 'function', '<code>primeGenerator</code> is a function.');
testString: assert(typeof primeGenerator === 'function');
- text: <code>primeGenerator</code> is a function.
testString: assert.deepEqual(primeGenerator(20, true), [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71], '<code>primeGenerator</code> is a function.');
testString: assert.deepEqual(primeGenerator(20, true), [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71]);
- text: <code>primeGenerator</code> is a function.
testString: assert.deepEqual(primeGenerator([100, 150], true), [101, 103, 107, 109, 113, 127, 131, 137, 139, 149], '<code>primeGenerator</code> is a function.');
testString: assert.deepEqual(primeGenerator([100, 150], true), [101, 103, 107, 109, 113, 127, 131, 137, 139, 149]);
- text: <code>primeGenerator</code> is a function.
testString: assert.equal(primeGenerator([7700, 8000], false), 30, '<code>primeGenerator</code> is a function.');
testString: assert.equal(primeGenerator([7700, 8000], false), 30);
- text: <code>primeGenerator</code> is a function.
testString: assert.equal(primeGenerator(10000, false), 104729, '<code>primeGenerator</code> is a function.');
testString: assert.equal(primeGenerator(10000, false), 104729);
```

View File

@ -30,9 +30,9 @@ For example:
```yml
tests:
- text: <code>factorial</code> is a function.
testString: assert(typeof factorial === 'function', '<code>factorial</code> is a function.');
testString: assert(typeof factorial === 'function');
- text: <code>factorial(2)</code> should return a number.
testString: assert(typeof factorial(2) === 'number', '<code>factorial(2)</code> should return a number.');
testString: assert(typeof factorial(2) === 'number');
- text: <code>factorial(3)</code> should return 6.
testString: assert.equal(factorial(3),results[0]);
- text: <code>factorial(3)</code> should return 120.

View File

@ -46,15 +46,15 @@ Using the above method find a factor of <code>2<sup>929</sup>-1</code> (aka M92
```yml
tests:
- text: <code>check_mersenne</code> is a function.
testString: assert(typeof check_mersenne === 'function', '<code>check_mersenne</code> is a function.');
testString: assert(typeof check_mersenne === 'function');
- text: <code>check_mersenne(3)</code> should return a string.
testString: assert(typeof check_mersenne(3) == 'string', '<code>check_mersenne(3)</code> should return a string.');
testString: assert(typeof check_mersenne(3) == 'string');
- text: <code>check_mersenne(3)</code> should return "M3 = 2^3-1 is prime".
testString: assert.equal(check_mersenne(3),"M3 = 2^3-1 is prime",'<code>check_mersenne(3)</code> should return "M3 = 2^3-1 is prime".');
testString: assert.equal(check_mersenne(3),"M3 = 2^3-1 is prime");
- text: <code>check_mersenne(23)</code> should return "M23 = 2^23-1 is composite with factor 47".
testString: assert.equal(check_mersenne(23),"M23 = 2^23-1 is composite with factor 47",'<code>check_mersenne(23)</code> should return "M23 = 2^23-1 is composite with factor 47".');
testString: assert.equal(check_mersenne(23),"M23 = 2^23-1 is composite with factor 47");
- text: <code>check_mersenne(929)</code> should return "M929 = 2^929-1 is composite with factor 13007
testString: assert.equal(check_mersenne(929),"M929 = 2^929-1 is composite with factor 13007",'<code>check_mersenne(929)</code> should return "M929 = 2^929-1 is composite with factor 13007');
testString: assert.equal(check_mersenne(929),"M929 = 2^929-1 is composite with factor 13007");
```

View File

@ -21,13 +21,13 @@ These factors are the positive integers by which the number being factored can b
```yml
tests:
- text: <code>factors</code> is a function.
testString: assert(typeof factors === 'function', '<code>factors</code> is a function.');
testString: assert(typeof factors === 'function');
- text: <code>factors(45)</code> should return <code>[1,3,5,9,15,45]</code>.
testString: assert.deepEqual(factors(45), ans[0], '<code>factors(45)</code> should return <code>[1,3,5,9,15,45]</code>.');
testString: assert.deepEqual(factors(45), ans[0]);
- text: <code>factors(53)</code> should return <code>[1,53]</code>.
testString: assert.deepEqual(factors(53), ans[1], '<code>factors(53)</code> should return <code>[1,53]</code>.');
testString: assert.deepEqual(factors(53), ans[1]);
- text: <code>factors(64)</code> should return <code>[1,2,4,8,16,32,64]</code>.
testString: assert.deepEqual(factors(64), ans[2], '<code>factors(64)</code> should return <code>[1,2,4,8,16,32,64]</code>.');
testString: assert.deepEqual(factors(64), ans[2]);
```

View File

@ -34,15 +34,15 @@ Write a function that returns the Farey sequence of order <code>n</code>. The fu
```yml
tests:
- text: <code>farey</code> is a function.
testString: assert(typeof farey === 'function', '<code>farey</code> is a function.');
testString: assert(typeof farey === 'function');
- text: <code>farey(3)</code> should return an array
testString: assert(Array.isArray(farey(3)), '<code>farey(3)</code> should return an array');
testString: assert(Array.isArray(farey(3)));
- text: <code>farey(3)</code> should return <code>["1/3","1/2","2/3"]</code>
testString: assert.deepEqual(farey(3), ["1/3","1/2","2/3"], '<code>farey(3)</code> should return <code>["1/3","1/2","2/3"]</code>');
testString: assert.deepEqual(farey(3), ["1/3","1/2","2/3"]);
- text: <code>farey(4)</code> should return <code>["1/4","1/3","1/2","2/4","2/3","3/4"]</code>
testString: assert.deepEqual(farey(4), ["1/4","1/3","1/2","2/4","2/3","3/4"], '<code>farey(4)</code> should return <code>["1/4","1/3","1/2","2/4","2/3","3/4"]</code>');
testString: assert.deepEqual(farey(4), ["1/4","1/3","1/2","2/4","2/3","3/4"]);
- text: <code>farey(5)</code> should return <code>["1/5","1/4","1/3","2/5","1/2","2/4","3/5","2/3","3/4","4/5"]</code>
testString: assert.deepEqual(farey(5), ["1/5","1/4","1/3","2/5","1/2","2/4","3/5","2/3","3/4","4/5"], '<code>farey(5)</code> should return <code>["1/5","1/4","1/3","2/5","1/2","2/4","3/5","2/3","3/4","4/5"]</code>');
testString: assert.deepEqual(farey(5), ["1/5","1/4","1/3","2/5","1/2","2/4","3/5","2/3","3/4","4/5"]);
```

View File

@ -42,21 +42,21 @@ Write a function to generate Fibonacci $n$-step number sequences and Lucas seque
```yml
tests:
- text: <code>fib_luc</code> is a function.
testString: assert(typeof fib_luc === 'function', '<code>fib_luc</code> is a function.');
testString: assert(typeof fib_luc === 'function');
- text: <code>fib_luc(2,10,"f")</code> should return <code>[1,1,2,3,5,8,13,21,34,55]</code>.
testString: assert.deepEqual(fib_luc(2,10,"f"),ans[0],'<code>fib_luc(2,10,"f")</code> should return <code>[1,1,2,3,5,8,13,21,34,55]</code>.');
testString: assert.deepEqual(fib_luc(2,10,"f"),ans[0]);
- text: <code>fib_luc(3,15,"f")</code> should return <code>[1,1,2,4,7,13,24,44,81,149,274,504,927,1705,3136]</code>.
testString: assert.deepEqual(fib_luc(3,15,"f"),ans[1],'<code>fib_luc(3,15,"f")</code> should return <code>[1,1,2,4,7,13,24,44,81,149,274,504,927,1705,3136]</code>.');
testString: assert.deepEqual(fib_luc(3,15,"f"),ans[1]);
- text: <code>fib_luc(4,15,"f")</code> should return <code>[1,1,2,4,8,15,29,56,108,208,401,773,1490,2872,5536]</code>.
testString: assert.deepEqual(fib_luc(4,15,"f"),ans[2],'<code>fib_luc(4,15,"f")</code> should return <code>[1,1,2,4,8,15,29,56,108,208,401,773,1490,2872,5536]</code>.');
testString: assert.deepEqual(fib_luc(4,15,"f"),ans[2]);
- text: <code>fib_luc(2,10,"l")</code> should return <code>[ 2, 1, 3, 4, 7, 11, 18, 29, 47, 76]</code>.
testString: assert.deepEqual(fib_luc(2,10,"l"),ans[3],'<code>fib_luc(2,10,"l")</code> should return <code>[ 2, 1, 3, 4, 7, 11, 18, 29, 47, 76]</code>.');
testString: assert.deepEqual(fib_luc(2,10,"l"),ans[3]);
- text: <code>fib_luc(3,15,"l")</code> should return <code>[ 2, 1, 3, 6, 10, 19, 35, 64, 118, 217, 399, 734, 1350, 2483, 4567 ]</code>.
testString: assert.deepEqual(fib_luc(3,15,"l"),ans[4],'<code>fib_luc(3,15,"l")</code> should return <code>[ 2, 1, 3, 6, 10, 19, 35, 64, 118, 217, 399, 734, 1350, 2483, 4567 ]</code>.');
testString: assert.deepEqual(fib_luc(3,15,"l"),ans[4]);
- text: <code>fib_luc(4,15,"l")</code> should return <code>[ 2, 1, 3, 6, 12, 22, 43, 83, 160, 308, 594, 1145, 2207, 4254, 8200 ]</code>.
testString: assert.deepEqual(fib_luc(4,15,"l"),ans[5],'<code>fib_luc(4,15,"l")</code> should return <code>[ 2, 1, 3, 6, 12, 22, 43, 83, 160, 308, 594, 1145, 2207, 4254, 8200 ]</code>.');
testString: assert.deepEqual(fib_luc(4,15,"l"),ans[5]);
- text: <code>fib_luc(5,15,"l")</code> should return <code>[ 2, 1, 3, 6, 12, 24, 46, 91, 179, 352, 692, 1360, 2674, 5257, 10335 ]</code>.
testString: assert.deepEqual(fib_luc(5,15,"l"),ans[6],'<code>fib_luc(5,15,"l")</code> should return <code>[ 2, 1, 3, 6, 12, 24, 46, 91, 179, 352, 692, 1360, 2674, 5257, 10335 ]</code>.');
testString: assert.deepEqual(fib_luc(5,15,"l"),ans[6]);
```

View File

@ -24,9 +24,9 @@ Hence, the series is: 0, 1, 1, 2, 3, 5, 8, 13...
```yml
tests:
- text: <code>fibonacci</code> is a function.
testString: assert(typeof fibonacci === 'function', '<code>fibonacci</code> is a function.');
testString: assert(typeof fibonacci === 'function');
- text: <code>fibonacci(2)</code> should return a number.
testString: assert(typeof fibonacci(2) == 'number', '<code>fibonacci(2)</code> should return a number.');
testString: assert(typeof fibonacci(2) == 'number');
- text: <code>fibonacci(3)</code> should return 1.
testString: assert.equal(fibonacci(3),1);
- text: <code>fibonacci(5)</code> should return 3.

View File

@ -33,19 +33,19 @@ Write a function that takes a fractran program as a string parameter and returns
```yml
tests:
- text: <code>fractran</code> should be a function.
testString: assert(typeof fractran=='function','<code>fractran</code> should be a function.');
testString: assert(typeof fractran=='function');
- text: <code>fractran("3/2, 1/3")</code> should return an array.
testString: assert(Array.isArray(fractran('3/2, 1/3')),'<code>fractran("3/2, 1/3")</code> should return an array.');
testString: assert(Array.isArray(fractran('3/2, 1/3')));
- text: <code>fractran("3/2, 1/3")</code> should return <code>[ 2, 3, 1 ]</code>.
testString: assert.deepEqual(fractran('3/2, 1/3'), [ 2, 3, 1 ],'<code>fractran("3/2, 1/3")</code> should return <code>[ 2, 3, 1 ]</code>.');
testString: assert.deepEqual(fractran('3/2, 1/3'), [ 2, 3, 1 ]);
- text: <code>fractran("3/2, 5/3, 1/5")</code> should return <code>[ 2, 3, 5, 1 ]</code>.
testString: assert.deepEqual(fractran('3/2, 5/3, 1/5'), [ 2, 3, 5, 1 ],'<code>fractran("3/2, 5/3, 1/5")</code> should return <code>[ 2, 3, 5, 1 ]</code>.');
testString: assert.deepEqual(fractran('3/2, 5/3, 1/5'), [ 2, 3, 5, 1 ]);
- text: <code>fractran("3/2, 6/3")</code> should return <code>[ 2, 3, 6, 9, 18, 27, 54, 81, 162, 243 ]</code>.
testString: assert.deepEqual(fractran('3/2, 6/3'), [ 2, 3, 6, 9, 18, 27, 54, 81, 162, 243 ],'<code>fractran("3/2, 6/3")</code> should return <code>[ 2, 3, 6, 9, 18, 27, 54, 81, 162, 243 ]</code>.');
testString: assert.deepEqual(fractran('3/2, 6/3'), [ 2, 3, 6, 9, 18, 27, 54, 81, 162, 243 ]);
- text: <code>fractran("2/7, 7/2")</code> should return <code>[ 2, 7, 2, 7, 2, 7, 2, 7, 2, 7 ]</code>.
testString: assert.deepEqual(fractran('2/7, 7/2'), [ 2, 7, 2, 7, 2, 7, 2, 7, 2, 7 ],'<code>fractran("2/7, 7/2")</code> should return <code>[ 2, 7, 2, 7, 2, 7, 2, 7, 2, 7 ]</code>.');
testString: assert.deepEqual(fractran('2/7, 7/2'), [ 2, 7, 2, 7, 2, 7, 2, 7, 2, 7 ]);
- text: <code>fractran("17/91, 78/85, 19/51, 23/38, 29/33, 77/29, 95/23, 77/19, 1/17, 11/13, 13/11, 15/14, 15/2, 55/1")</code> should return <code>[ 2, 15, 825, 725, 1925, 2275, 425, 390, 330, 290 ]</code>.
testString: assert.deepEqual(fractran('17/91, 78/85, 19/51, 23/38, 29/33, 77/29, 95/23, 77/19, 1/17, 11/13, 13/11, 15/14, 15/2, 55/1'), [ 2, 15, 825, 725, 1925, 2275, 425, 390, 330, 290 ],'<code>fractran("17/91, 78/85, 19/51, 23/38, 29/33, 77/29, 95/23, 77/19, 1/17, 11/13, 13/11, 15/14, 15/2, 55/1")</code> should return <code>[ 2, 15, 825, 725, 1925, 2275, 425, 390, 330, 290 ]</code>.');
testString: assert.deepEqual(fractran('17/91, 78/85, 19/51, 23/38, 29/33, 77/29, 95/23, 77/19, 1/17, 11/13, 13/11, 15/14, 15/2, 55/1'), [ 2, 15, 825, 725, 1925, 2275, 425, 390, 330, 290 ]);
```

View File

@ -22,19 +22,19 @@ To improve accuracy, please use partial pivoting and scaling.
```yml
tests:
- text: <code>gaussianElimination</code> should be a function.
testString: assert(typeof gaussianElimination=='function','<code>gaussianElimination</code> should be a function.');
testString: assert(typeof gaussianElimination=='function');
- text: <code>gaussianElimination([[1,1],[1,-1]], [5,1])</code> should return an array.
testString: assert(Array.isArray(gaussianElimination([[1,1],[1,-1]], [5,1])),'<code>gaussianElimination([[1,1],[1,-1]], [5,1])</code> should return an array.');
testString: assert(Array.isArray(gaussianElimination([[1,1],[1,-1]], [5,1])));
- text: <code>gaussianElimination([[1,1],[1,-1]], [5,1])</code> should return <code>[ 3, 2 ]</code>.
testString: assert.deepEqual(gaussianElimination([[1,1],[1,-1]], [5,1]), [ 3, 2 ],'<code>gaussianElimination([[1,1],[1,-1]], [5,1])</code> should return <code>[ 3, 2 ]</code>.');
testString: assert.deepEqual(gaussianElimination([[1,1],[1,-1]], [5,1]), [ 3, 2 ]);
- text: <code>gaussianElimination([[2,3],[2,1]] , [8,4])</code> should return <code>[ 1, 2 ]</code>.
testString: assert.deepEqual(gaussianElimination([[2,3],[2,1]] , [8,4]), [ 1, 2 ],'<code>gaussianElimination([[2,3],[2,1]] , [8,4])</code> should return <code>[ 1, 2 ]</code>.');
testString: assert.deepEqual(gaussianElimination([[2,3],[2,1]] , [8,4]), [ 1, 2 ]);
- text: <code>gaussianElimination([[1,3],[5,-2]], [14,19])</code> should return <code>[ 5, 3 ]</code>.
testString: assert.deepEqual(gaussianElimination([[1,3],[5,-2]], [14,19]), [ 5, 3 ],'<code>gaussianElimination([[1,3],[5,-2]], [14,19])</code> should return <code>[ 5, 3 ]</code>.');
testString: assert.deepEqual(gaussianElimination([[1,3],[5,-2]], [14,19]), [ 5, 3 ]);
- text: <code>gaussianElimination([[1,1],[5,-1]] , [10,14])</code> should return <code>[ 4, 6 ]</code>.
testString: assert.deepEqual(gaussianElimination([[1,1],[5,-1]] , [10,14]), [ 4, 6 ],'<code>gaussianElimination([[1,1],[5,-1]] , [10,14])</code> should return <code>[ 4, 6 ]</code>.');
testString: assert.deepEqual(gaussianElimination([[1,1],[5,-1]] , [10,14]), [ 4, 6 ]);
- text: <code>gaussianElimination([[1,2,3],[4,5,6],[7,8,8]] , [6,15,23])</code> should return <code>[ 1, 1, 1 ]</code>.
testString: assert.deepEqual(gaussianElimination([[1,2,3],[4,5,6],[7,8,8]] , [6,15,23]), [ 1, 1, 1 ],'<code>gaussianElimination([[1,2,3],[4,5,6],[7,8,8]] , [6,15,23])</code> should return <code>[ 1, 1, 1 ]</code>.');
testString: assert.deepEqual(gaussianElimination([[1,2,3],[4,5,6],[7,8,8]] , [6,15,23]), [ 1, 1, 1 ]);
```

View File

@ -24,23 +24,23 @@ The second parameter is the number for which the function should return a string
```yml
tests:
- text: <code>genFizzBuzz</code> should be a function.
testString: assert(typeof genFizzBuzz=='function','<code>genFizzBuzz</code> should be a function.');
testString: assert(typeof genFizzBuzz=='function');
- text: <code>genFizzBuzz([[3, "Fizz"],[5, "Buzz"]], 6)</code> should return a string.
testString: assert(typeof genFizzBuzz([[3, "Fizz"],[5, "Buzz"]], 6)=='string','<code>genFizzBuzz([[3, "Fizz"],[5, "Buzz"]], 6)</code> should return a string.');
testString: assert(typeof genFizzBuzz([[3, "Fizz"],[5, "Buzz"]], 6)=='string');
- text: <code>genFizzBuzz([[3, "Fizz"],[5, "Buzz"]], 6)</code> should return <code>"Fizz"</code>.
testString: assert.equal(genFizzBuzz([[3, "Fizz"],[5, "Buzz"]], 6), "Fizz",'<code>genFizzBuzz([[3, "Fizz"],[5, "Buzz"]], 6)</code> should return <code>"Fizz"</code>.');
testString: assert.equal(genFizzBuzz([[3, "Fizz"],[5, "Buzz"]], 6), "Fizz");
- text: <code>genFizzBuzz([[3, "Fizz"],[5, "Buzz"]], 10)</code> should return <code>"Buzz"</code>.
testString: assert.equal(genFizzBuzz([[3, "Fizz"],[5, "Buzz"]], 10), "Buzz",'<code>genFizzBuzz([[3, "Fizz"],[5, "Buzz"]], 10)</code> should return <code>"Buzz"</code>.');
testString: assert.equal(genFizzBuzz([[3, "Fizz"],[5, "Buzz"]], 10), "Buzz");
- text: <code>genFizzBuzz([[3, "Buzz"],[5, "Fizz"]], 12)</code> should return <code>"Buzz"</code>.
testString: assert.equal(genFizzBuzz([[3, "Buzz"],[5, "Fizz"]], 12), "Buzz",'<code>genFizzBuzz([[3, "Buzz"],[5, "Fizz"]], 12)</code> should return <code>"Buzz"</code>.');
testString: assert.equal(genFizzBuzz([[3, "Buzz"],[5, "Fizz"]], 12), "Buzz");
- text: <code>genFizzBuzz([[3, "Buzz"],[5, "Fizz"]], 13)</code> should return <code>"13"</code>.
testString: assert.equal(genFizzBuzz([[3, "Buzz"],[5, "Fizz"]], 13), '13','<code>genFizzBuzz([[3, "Buzz"],[5, "Fizz"]], 13)</code> should return <code>"13"</code>.');
testString: assert.equal(genFizzBuzz([[3, "Buzz"],[5, "Fizz"]], 13), '13');
- text: <code>genFizzBuzz([[3, "Buzz"],[5, "Fizz"]], 15)</code> should return <code>"BuzzFizz"</code>.
testString: assert.equal(genFizzBuzz([[3, "Buzz"],[5, "Fizz"]], 15), 'BuzzFizz','<code>genFizzBuzz([[3, "Buzz"],[5, "Fizz"]], 15)</code> should return <code>"BuzzFizz"</code>.');
testString: assert.equal(genFizzBuzz([[3, "Buzz"],[5, "Fizz"]], 15), "BuzzFizz");
- text: <code>genFizzBuzz([[3, "Fizz"],[5, "Buzz"]], 15)</code> should return <code>"FizzBuzz"</code>.
testString: assert.equal(genFizzBuzz([[3, "Fizz"],[5, "Buzz"]], 15), 'FizzBuzz','<code>genFizzBuzz([[3, "Fizz"],[5, "Buzz"]], 15)</code> should return <code>"FizzBuzz"</code>.');
testString: assert.equal(genFizzBuzz([[3, "Fizz"],[5, "Buzz"]], 15), "FizzBuzz");
- text: <code>genFizzBuzz([[3, "Fizz"],[5, "Buzz"],[7, "Baxx"]], 105)</code> should return <code>"FizzBuzzBaxx"</code>.
testString: assert.equal(genFizzBuzz([[3, "Fizz"],[5, "Buzz"],[7, "Baxx"]], 105), 'FizzBuzzBaxx','<code>genFizzBuzz([[3, "Fizz"],[5, "Buzz"],[7, "Baxx"]], 105)</code> should return <code>"FizzBuzzBaxx"</code>.');
testString: assert.equal(genFizzBuzz([[3, "Fizz"],[5, "Buzz"],[7, "Baxx"]], 105), "FizzBuzzBaxx");
```

View File

@ -20,19 +20,19 @@ Write a function to generate an array of lower case ASCII characters for a given
```yml
tests:
- text: <code>lascii</code> should be a function.
testString: assert(typeof lascii=='function','<code>lascii</code> should be a function.');
testString: assert(typeof lascii=='function');
- text: <code>lascii("a","d")</code> should return an array.
testString: assert(Array.isArray(lascii('a','d')),'<code>lascii("a","d")</code> should return an array.');
testString: assert(Array.isArray(lascii('a','d')));
- text: "<code>lascii('a','d')</code> should return <code>[ 'a', 'b', 'c', 'd' ]</code>."
testString: assert.deepEqual(lascii("a","d"),results[0],"<code>lascii('a','d')</code> should return <code>[ 'a', 'b', 'c', 'd' ]</code>.");
testString: assert.deepEqual(lascii("a","d"),results[0]);
- text: <code>lascii('c','i')</code> should return <code>[ 'c', 'd', 'e', 'f', 'g', 'h', 'i' ]</code>.
testString: assert.deepEqual(lascii("c","i"),results[1],"<code>lascii('c','i')</code> should return <code>[ 'c', 'd', 'e', 'f', 'g', 'h', 'i' ]</code>.");
testString: assert.deepEqual(lascii("c","i"),results[1]);
- text: <code>lascii('m','q')</code> should return <code>[ 'm', 'n', 'o', 'p', 'q' ]</code>.
testString: assert.deepEqual(lascii("m","q"),results[2],"<code>lascii('m','q')</code> should return <code>[ 'm', 'n', 'o', 'p', 'q' ]</code>.");
testString: assert.deepEqual(lascii("m","q"),results[2]);
- text: <code>lascii('k','n')</code> should return <code>[ 'k', 'l', 'm', 'n' ]</code>.
testString: assert.deepEqual(lascii("k","n"),results[3],"<code>lascii('k','n')</code> should return <code>[ 'k', 'l', 'm', 'n' ]</code>.");
testString: assert.deepEqual(lascii("k","n"),results[3]);
- text: <code>lascii('t','z')</code> should return <code>[ 't', 'u', 'v', 'w', 'x', 'y', 'z' ]</code>.
testString: assert.deepEqual(lascii("t","z"),results[4],"<code>lascii('t','z')</code> should return <code>[ 't', 'u', 'v', 'w', 'x', 'y', 'z' ]</code>.");
testString: assert.deepEqual(lascii("t","z"),results[4]);
```

View File

@ -24,19 +24,19 @@ For example for \(n=7\), the function should return 81 as the sequence would be
```yml
tests:
- text: <code>exponentialGenerator</code> should be a function.
testString: assert(typeof exponentialGenerator=='function','<code>exponentialGenerator</code> should be a function.');
testString: assert(typeof exponentialGenerator=='function');
- text: <code>exponentialGenerator()</code> should return a number.
testString: assert(typeof exponentialGenerator(10)=='number','<code>exponentialGenerator()</code> should return a number.');
testString: assert(typeof exponentialGenerator(10)=='number');
- text: <code>exponentialGenerator(10)</code> should return <code>144</code>.
testString: assert.equal(exponentialGenerator(10),144,'<code>exponentialGenerator(10)</code> should return <code>144</code>.');
testString: assert.equal(exponentialGenerator(10),144);
- text: <code>exponentialGenerator(12)</code> should return <code>196</code>.
testString: assert.equal(exponentialGenerator(12),196,'<code>exponentialGenerator(12)</code> should return <code>196</code>.');
testString: assert.equal(exponentialGenerator(12),196);
- text: <code>exponentialGenerator(14)</code> should return <code>256</code>.
testString: assert.equal(exponentialGenerator(14),256,'<code>exponentialGenerator(14)</code> should return <code>256</code>.');
testString: assert.equal(exponentialGenerator(14),256);
- text: <code>exponentialGenerator(20)</code> should return <code>484</code>.
testString: assert.equal(exponentialGenerator(20),484,'<code>exponentialGenerator(20)</code> should return <code>484</code>.');
testString: assert.equal(exponentialGenerator(20),484);
- text: <code>exponentialGenerator(25)</code> should return <code>784</code>.
testString: assert.equal(exponentialGenerator(25),784,'<code>exponentialGenerator(25)</code> should return <code>784</code>.');
testString: assert.equal(exponentialGenerator(25),784);
```

View File

@ -42,21 +42,21 @@ b[i] = g[i] xor b[i-1]
```yml
tests:
- text: <code>gray</code> should be a function.
testString: assert(typeof gray=='function','<code>gray</code> should be a function.');
testString: assert(typeof gray=='function');
- text: <code>gray(true,177)</code> should return a number.
testString: assert(typeof gray(true,177)=='number','<code>gray(true,177)</code> should return a number.');
testString: assert(typeof gray(true,177)=='number');
- text: <code>gray(true,177)</code> should return <code>233</code>.
testString: assert.equal(gray(true,177),233,'<code>gray(true,177)</code> should return <code>233</code>.');
testString: assert.equal(gray(true,177),233);
- text: <code>gray(true,425)</code> should return <code>381</code>.
testString: assert.equal(gray(true,425),381,'<code>gray(true,425)</code> should return <code>381</code>.');
testString: assert.equal(gray(true,425),381);
- text: <code>gray(true,870)</code> should return <code>725</code>.
testString: assert.equal(gray(true,870),725,'<code>gray(true,870)</code> should return <code>725</code>.');
testString: assert.equal(gray(true,870),725);
- text: <code>gray(false,233)</code> should return <code>177</code>.
testString: assert.equal(gray(false,233),177,'<code>gray(false,233)</code> should return <code>177</code>.');
testString: assert.equal(gray(false,233),177);
- text: <code>gray(false,381)</code> should return <code>425</code>.
testString: assert.equal(gray(false,381),425,'<code>gray(false,381)</code> should return <code>425</code>.');
testString: assert.equal(gray(false,381),425);
- text: <code>gray(false,725)</code> should return <code>870</code>.
testString: assert.equal(gray(false,725),870,'<code>gray(false,725)</code> should return <code>870</code>.');
testString: assert.equal(gray(false,725),870);
```

View File

@ -20,21 +20,21 @@ Write a function that returns the greatest common divisor of two integers.
```yml
tests:
- text: <code>gcd</code> should be a function.
testString: assert(typeof gcd=='function','<code>gcd</code> should be a function.');
testString: assert(typeof gcd=='function');
- text: <code>gcd(24,36)</code> should return a number.
testString: assert(typeof gcd(24,36)=='number','<code>gcd(24,36)</code> should return a number.');
testString: assert(typeof gcd(24,36)=='number');
- text: <code>gcd(24,36)</code> should return <code>12</code>.
testString: assert.equal(gcd(24,36),12,'<code>gcd(24,36)</code> should return <code>12</code>.');
testString: assert.equal(gcd(24,36),12);
- text: <code>gcd(30,48)</code> should return <code>6</code>.
testString: assert.equal(gcd(30,48),6,'<code>gcd(30,48)</code> should return <code>6</code>.');
testString: assert.equal(gcd(30,48),6);
- text: <code>gcd(10,15)</code> should return <code>5</code>.
testString: assert.equal(gcd(10,15),5,'<code>gcd(10,15)</code> should return <code>5</code>.');
testString: assert.equal(gcd(10,15),5);
- text: <code>gcd(100,25)</code> should return <code>25</code>.
testString: assert.equal(gcd(100,25),25,'<code>gcd(100,25)</code> should return <code>25</code>.');
testString: assert.equal(gcd(100,25),25);
- text: <code>gcd(13,250)</code> should return <code>1</code>.
testString: assert.equal(gcd(13,250),1,'<code>gcd(13,250)</code> should return <code>1</code>.');
testString: assert.equal(gcd(13,250),1);
- text: <code>gcd(1300,250)</code> should return <code>50</code>.
testString: assert.equal(gcd(1300,250),50,'<code>gcd(1300,250)</code> should return <code>50</code>.');
testString: assert.equal(gcd(1300,250),50);
```

View File

@ -21,21 +21,21 @@ An empty subsequence is considered to have the sum of \( 0 \); thus if all elem
```yml
tests:
- text: <code>maximumSubsequence</code> should be a function.
testString: assert(typeof maximumSubsequence=='function','<code>maximumSubsequence</code> should be a function.');
testString: assert(typeof maximumSubsequence=='function');
- text: <code>maximumSubsequence([ 1, 2, -1, 3, 10, -10 ])</code> should return an array.
testString: assert(Array.isArray(maximumSubsequence([ 1, 2,-1, 3, 10, -10 ])),'<code>maximumSubsequence([ 1, 2, -1, 3, 10, -10 ])</code> should return an array.');
testString: assert(Array.isArray(maximumSubsequence([ 1, 2,-1, 3, 10, -10 ])));
- text: <code>maximumSubsequence([ 1, 2, -1, 3, 10, -10 ])</code> should return <code>[ 1, 2, -1, 3, 10 ]</code>.
testString: assert.deepEqual(maximumSubsequence([1,2,-1,3,10,-10]), [ 1, 2, -1, 3, 10 ],'<code>maximumSubsequence([ 1, 2, -1, 3, 10, -10 ])</code> should return <code>[ 1, 2, -1, 3, 10 ]</code>.');
testString: assert.deepEqual(maximumSubsequence([1,2,-1,3,10,-10]), [ 1, 2, -1, 3, 10 ]);
- text: <code>maximumSubsequence([ 0, 8, 10, -2, -4, -1, -5, -3 ])</code> should return <code>[ 0, 8, 10 ]</code>.
testString: assert.deepEqual(maximumSubsequence([0, 8, 10, -2, -4, -1, -5, -3]), [ 0, 8, 10 ],'<code>maximumSubsequence([ 0, 8, 10, -2, -4, -1, -5, -3 ])</code> should return <code>[ 0, 8, 10 ]</code>.');
testString: assert.deepEqual(maximumSubsequence([0, 8, 10, -2, -4, -1, -5, -3]), [ 0, 8, 10 ]);
- text: <code>maximumSubsequence([ 9, 9, -10, 1 ])</code> should return <code>[ 9, 9 ]</code>.
testString: assert.deepEqual(maximumSubsequence([ 9, 9, -10, 1 ]), [ 9, 9 ],'<code>maximumSubsequence([ 9, 9, -10, 1 ])</code> should return <code>[ 9, 9 ]</code>.');
testString: assert.deepEqual(maximumSubsequence([ 9, 9, -10, 1 ]), [ 9, 9 ]);
- text: <code>maximumSubsequence([ 7, 1, -5, -3, -8, 1 ]</code> should return <code>[ 7, 1 ]</code>.
testString: assert.deepEqual(maximumSubsequence([ 7, 1, -5, -3, -8, 1 ]), [ 7, 1 ],'<code>maximumSubsequence([ 7, 1, -5, -3, -8, 1 ]</code> should return <code>[ 7, 1 ]</code>.');
testString: assert.deepEqual(maximumSubsequence([ 7, 1, -5, -3, -8, 1 ]), [ 7, 1 ]);
- text: <code>maximumSubsequence([ -3, 6, -1, 4, -4, -6 ])</code> should return <code>[ 6, -1, 4 ]</code>.
testString: assert.deepEqual(maximumSubsequence([ -3, 6, -1, 4, -4, -6 ]), [ 6, -1, 4 ],'<code>maximumSubsequence([ -3, 6, -1, 4, -4, -6 ])</code> should return <code>[ 6, -1, 4 ]</code>.');
testString: assert.deepEqual(maximumSubsequence([ -3, 6, -1, 4, -4, -6 ]), [ 6, -1, 4 ]);
- text: <code>maximumSubsequence([ -1, -2, 3, 5, 6, -2, -1, 4, -4, 2, -1 ])</code> should return <code>[ 3, 5, 6, -2, -1, 4 ]</code>.
testString: assert.deepEqual(maximumSubsequence([ -1, -2, 3, 5, 6, -2, -1, 4, -4, 2, -1 ]), [ 3, 5, 6, -2, -1, 4 ],'<code>maximumSubsequence([ -1, -2, 3, 5, 6, -2, -1, 4, -4, 2, -1 ])</code> should return <code>[ 3, 5, 6, -2, -1, 4 ]</code>.');
testString: assert.deepEqual(maximumSubsequence([ -1, -2, 3, 5, 6, -2, -1, 4, -4, 2, -1 ]), [ 3, 5, 6, -2, -1, 4 ]);
```

View File

@ -35,9 +35,9 @@ The hailstone sequence is also known as hailstone numbers (because the values ar
```yml
tests:
- text: <code>hailstoneSequence</code> is a function.
testString: assert(typeof hailstoneSequence === 'function', '<code>hailstoneSequence</code> is a function.');
testString: assert(typeof hailstoneSequence === 'function');
- text: <code>hailstoneSequence()</code> should return <code>[[27,82,41,124,8,4,2,1], [351, 77031]]</code>
testString: assert.deepEqual(hailstoneSequence(), res, '<code>hailstoneSequence()</code> should return <code>[[27,82,41,124,8,4,2,1], [351, 77031]]</code>');
testString: assert.deepEqual(hailstoneSequence(), res);
```

View File

@ -21,31 +21,31 @@ Implement a function that returns true if the number is happy, or false if not.
```yml
tests:
- text: <code>happy</code> is a function.
testString: assert(typeof happy === 'function', '<code>happy</code> is a function.');
testString: assert(typeof happy === 'function');
- text: <code>happy(1)</code> should return a boolean.
testString: assert(typeof happy(1) === 'boolean', '<code>happy(1)</code> should return a boolean.');
testString: assert(typeof happy(1) === 'boolean');
- text: <code>happy(1)</code> should return true.
testString: assert(happy(1), '<code>happy(1)</code> should return true.');
testString: assert(happy(1));
- text: <code>happy(2)</code> should return false.
testString: assert(!happy(2), '<code>happy(2)</code> should return false.');
testString: assert(!happy(2));
- text: <code>happy(7)</code> should return true.
testString: assert(happy(7), '<code>happy(7)</code> should return true.');
testString: assert(happy(7));
- text: <code>happy(10)</code> should return true.
testString: assert(happy(10), '<code>happy(10)</code> should return true.');
testString: assert(happy(10));
- text: <code>happy(13)</code> should return true.
testString: assert(happy(13), '<code>happy(13)</code> should return true.');
testString: assert(happy(13));
- text: <code>happy(19)</code> should return true.
testString: assert(happy(19), '<code>happy(19)</code> should return true.');
testString: assert(happy(19));
- text: <code>happy(23)</code> should return true.
testString: assert(happy(23), '<code>happy(23)</code> should return true.');
testString: assert(happy(23));
- text: <code>happy(28)</code> should return true.
testString: assert(happy(28), '<code>happy(28)</code> should return true.');
testString: assert(happy(28));
- text: <code>happy(31)</code> should return true.
testString: assert(happy(31), '<code>happy(31)</code> should return true.');
testString: assert(happy(31));
- text: <code>happy(32)</code> should return true:.
testString: assert(happy(32), '<code>happy(32)</code> should return true:.');
testString: assert(happy(32));
- text: <code>happy(33)</code> should return false.
testString: assert(!happy(33), '<code>happy(33)</code> should return false.');
testString: assert(!happy(33));
```

View File

@ -23,7 +23,7 @@ Use it to list the first twenty members of the sequence and list the first Harsh
```yml
tests:
- text: <code>isHarshadOrNiven</code> is a function.
testString: assert(typeof isHarshadOrNiven === 'function', '<code>isHarshadOrNiven</code> is a function.');
testString: assert(typeof isHarshadOrNiven === 'function');
- text: '<code>isHarshadOrNiven()</code> should return <code>{"firstTwenty": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 18, 20, 21, 24, 27, 30, 36, 40, 42],"firstOver1000": 1002}</code>'
testString: assert.deepEqual(isHarshadOrNiven(), res);

View File

@ -24,7 +24,7 @@ Using two Arrays of equal length, create a Hash object where the elements from o
```yml
tests:
- text: <code>arrToObj</code> is a function.
testString: assert(typeof arrToObj === 'function', '<code>arrToObj</code> is a function.');
testString: assert(typeof arrToObj === 'function');
- text: '<code>arrToObj([1, 2, 3, 4, 5], ["a", "b", "c", "d", "e"])</code> should return <code>{ 1: "a", 2: "b", 3: "c", 4: "d", 5: "e" }</code>'
testString: assert.deepEqual(arrToObj(...testCases[0]), res[0]);
- text: '<code>arrToObj([1, 2, 3, 4, 5], ["a", "b", "c", "d"])</code> should return <code>{ 1: "a", 2: "b", 3: "c", 4: "d", 5: undefined }</code>'

View File

@ -173,7 +173,7 @@ The order of the rows in the output table is not significant.
```yml
tests:
- text: <code>hashJoin</code> is a function.
testString: assert(typeof hashJoin === 'function', '<code>hashJoin</code> is a function.');
testString: assert(typeof hashJoin === 'function');
- text: '<code>hashJoin([{ age: 27, name: "Jonah" }, { age: 18, name: "Alan" }, { age: 28, name: "Glory" }, { age: 18, name: "Popeye" }, { age: 28, name: "Alan" }], [{ character: "Jonah", nemesis: "Whales" }, { character: "Jonah", nemesis: "Spiders" }, { character: "Alan", nemesis: "Ghosts" }, { character:"Alan", nemesis: "Zombies" }, { character: "Glory", nemesis: "Buffy" }, { character: "Bob", nemesis: "foo" }])</code> should return <code>[{"A_age": 27,"A_name": "Jonah", "B_character": "Jonah", "B_nemesis": "Whales"}, {"A_age": 27,"A_name": "Jonah", "B_character": "Jonah", "B_nemesis": "Spiders"}, {"A_age": 18,"A_name": "Alan", "B_character": "Alan", "B_nemesis": "Ghosts"}, {"A_age": 18,"A_name": "Alan", "B_character": "Alan", "B_nemesis": "Zombies"}, {"A_age": 28,"A_name": "Glory", "B_character": "Glory", "B_nemesis": "Buffy"}, {"A_age": 28,"A_name": "Alan", "B_character": "Alan", "B_nemesis": "Ghosts"}, {"A_age": 28,"A_name": "Alan", "B_character": "Alan", "B_nemesis": "Zombies"}]</code>'
testString: assert.deepEqual(hashJoin(hash1, hash2), res);

View File

@ -29,15 +29,15 @@ Implement a function based on Hero's formula that returns the first <code>n<sub>
```yml
tests:
- text: <code>heronianTriangle</code> is a function.
testString: assert(typeof heronianTriangle === 'function', '<code>heronianTriangle</code> is a function.');
testString: assert(typeof heronianTriangle === 'function');
- text: <code>heronianTriangle()</code> should return <code>[[3, 4, 5], [5, 5, 6], [5, 5, 8], [4, 13, 15], [5, 12, 13], [9, 10, 17], [3, 25, 26], [7, 15, 20], [10, 13, 13], [8, 15, 17]]</code>
testString: assert.deepEqual(heronianTriangle(testCases[0]), res[0], '<code>heronianTriangle()</code> should return <code>[[3, 4, 5], [5, 5, 6], [5, 5, 8], [4, 13, 15], [5, 12, 13], [9, 10, 17], [3, 25, 26], [7, 15, 20], [10, 13, 13], [8, 15, 17]]</code>');
testString: assert.deepEqual(heronianTriangle(testCases[0]), res[0]);
- text: <code>heronianTriangle()</code> should return <code>[[3, 4, 5], [5, 5, 6], [5, 5, 8], [4, 13, 15], [5, 12, 13], [9, 10, 17], [3, 25, 26], [7, 15, 20], [10, 13, 13], [8, 15, 17], [13, 13, 24], [6, 25, 29], [11, 13, 20], [5, 29, 30], [13, 14, 15]],</code>
testString: assert.deepEqual(heronianTriangle(testCases[1]), res[1], '<code>heronianTriangle()</code> should return <code>[[3, 4, 5], [5, 5, 6], [5, 5, 8], [4, 13, 15], [5, 12, 13], [9, 10, 17], [3, 25, 26], [7, 15, 20], [10, 13, 13], [8, 15, 17], [13, 13, 24], [6, 25, 29], [11, 13, 20], [5, 29, 30], [13, 14, 15]],</code>');
testString: assert.deepEqual(heronianTriangle(testCases[1]), res[1]);
- text: <code>heronianTriangle()</code> should return <code>[[3, 4, 5], [5, 5, 6], [5, 5, 8], [4, 13, 15], [5, 12, 13], [9, 10, 17], [3, 25, 26], [7, 15, 20], [10, 13, 13], [8, 15, 17], [13, 13, 24], [6, 25, 29], [11, 13, 20], [5, 29, 30], [13, 14, 15], [10, 17, 21], [7, 24, 25], [8, 29, 35], [12, 17, 25], [4, 51, 53]],</code>
testString: assert.deepEqual(heronianTriangle(testCases[2]), res[2], '<code>heronianTriangle()</code> should return <code>[[3, 4, 5], [5, 5, 6], [5, 5, 8], [4, 13, 15], [5, 12, 13], [9, 10, 17], [3, 25, 26], [7, 15, 20], [10, 13, 13], [8, 15, 17], [13, 13, 24], [6, 25, 29], [11, 13, 20], [5, 29, 30], [13, 14, 15], [10, 17, 21], [7, 24, 25], [8, 29, 35], [12, 17, 25], [4, 51, 53]],</code>');
testString: assert.deepEqual(heronianTriangle(testCases[2]), res[2]);
- text: <code>heronianTriangle()</code> should return <code>[[3, 4, 5], [5, 5, 6], [5, 5, 8], [4, 13, 15], [5, 12, 13], [9, 10, 17], [3, 25, 26], [7, 15, 20], [10, 13, 13], [8, 15, 17], [13, 13, 24], [6, 25, 29], [11, 13, 20], [5, 29, 30], [13, 14, 15], [10, 17, 21], [7, 24, 25], [8, 29, 35], [12, 17, 25], [4, 51, 53], [19, 20, 37],[16, 17, 17], [17, 17, 30], [16, 25, 39], [13, 20, 21]]</code>
testString: assert.deepEqual(heronianTriangle(testCases[3]), res[3], '<code>heronianTriangle()</code> should return <code>[[3, 4, 5], [5, 5, 6], [5, 5, 8], [4, 13, 15], [5, 12, 13], [9, 10, 17], [3, 25, 26], [7, 15, 20], [10, 13, 13], [8, 15, 17], [13, 13, 24], [6, 25, 29], [11, 13, 20], [5, 29, 30], [13, 14, 15], [10, 17, 21], [7, 24, 25], [8, 29, 35], [12, 17, 25], [4, 51, 53], [19, 20, 37],[16, 17, 17], [17, 17, 30], [16, 25, 39], [13, 20, 21]]</code>');
testString: assert.deepEqual(heronianTriangle(testCases[3]), res[3]);
```

View File

@ -36,29 +36,29 @@ No maximum value for <code>n</code> should be assumed.
```yml
tests:
- text: <code>ffr</code> is a function.
testString: assert(typeof ffr === 'function', '<code>ffr</code> is a function.');
testString: assert(typeof ffr === 'function');
- text: <code>ffs</code> is a function.
testString: assert(typeof ffs === 'function', '<code>ffs</code> is a function.');
testString: assert(typeof ffs === 'function');
- text: <code>ffr</code> should return integer.
testString: assert(Number.isInteger(ffr(1)), '<code>ffr</code> should return integer.');
testString: assert(Number.isInteger(ffr(1)));
- text: <code>ffs</code> should return integer.
testString: assert(Number.isInteger(ffs(1)), '<code>ffs</code> should return integer.');
testString: assert(Number.isInteger(ffs(1)));
- text: <code>ffr()</code> should return <code>69</code>
testString: assert.equal(ffr(ffrParamRes[0][0]), ffrParamRes[0][1], '<code>ffr()</code> should return <code>69</code>');
testString: assert.equal(ffr(ffrParamRes[0][0]), ffrParamRes[0][1]);
- text: <code>ffr()</code> should return <code>1509</code>
testString: assert.equal(ffr(ffrParamRes[1][0]), ffrParamRes[1][1], '<code>ffr()</code> should return <code>1509</code>');
testString: assert.equal(ffr(ffrParamRes[1][0]), ffrParamRes[1][1]);
- text: <code>ffr()</code> should return <code>5764</code>
testString: assert.equal(ffr(ffrParamRes[2][0]), ffrParamRes[2][1], '<code>ffr()</code> should return <code>5764</code>');
testString: assert.equal(ffr(ffrParamRes[2][0]), ffrParamRes[2][1]);
- text: <code>ffr()</code> should return <code>526334</code>
testString: assert.equal(ffr(ffrParamRes[3][0]), ffrParamRes[3][1], '<code>ffr()</code> should return <code>526334</code>');
testString: assert.equal(ffr(ffrParamRes[3][0]), ffrParamRes[3][1]);
- text: <code>ffs()</code> should return <code>14</code>
testString: assert.equal(ffs(ffsParamRes[0][0]), ffsParamRes[0][1], '<code>ffs()</code> should return <code>14</code>');
testString: assert.equal(ffs(ffsParamRes[0][0]), ffsParamRes[0][1]);
- text: <code>ffs()</code> should return <code>59</code>
testString: assert.equal(ffs(ffsParamRes[1][0]), ffsParamRes[1][1], '<code>ffs()</code> should return <code>59</code>');
testString: assert.equal(ffs(ffsParamRes[1][0]), ffsParamRes[1][1]);
- text: <code>ffs()</code> should return <code>112</code>
testString: assert.equal(ffs(ffsParamRes[2][0]), ffsParamRes[2][1], '<code>ffs()</code> should return <code>112</code>');
testString: assert.equal(ffs(ffsParamRes[2][0]), ffsParamRes[2][1]);
- text: <code>ffs()</code> should return <code>1041</code>
testString: assert.equal(ffs(ffsParamRes[3][0]), ffsParamRes[3][1], '<code>ffs()</code> should return <code>1041</code>');
testString: assert.equal(ffs(ffsParamRes[3][0]), ffsParamRes[3][1]);
```

View File

@ -22,17 +22,17 @@ Implement the Hofstadter Q Sequence equation as a function. The function should
```yml
tests:
- text: <code>hofstadterQ</code> is a function.
testString: assert(typeof hofstadterQ === 'function', '<code>hofstadterQ</code> is a function.');
testString: assert(typeof hofstadterQ === 'function');
- text: <code>hofstadterQ()</code> should return <code>integer</code>
testString: assert(Number.isInteger(hofstadterQ(1000)), '<code>hofstadterQ()</code> should return <code>integer</code>');
testString: assert(Number.isInteger(hofstadterQ(1000)));
- text: <code>hofstadterQ(1000)</code> should return <code>502</code>
testString: assert.equal(hofstadterQ(testCase[0]), res[0], '<code>hofstadterQ(1000)</code> should return <code>502</code>');
testString: assert.equal(hofstadterQ(testCase[0]), res[0]);
- text: <code>hofstadterQ(1500)</code> should return <code>755</code>
testString: assert.equal(hofstadterQ(testCase[1]), res[1], '<code>hofstadterQ(1500)</code> should return <code>755</code>');
testString: assert.equal(hofstadterQ(testCase[1]), res[1]);
- text: <code>hofstadterQ(2000)</code> should return <code>1005</code>
testString: assert.equal(hofstadterQ(testCase[2]), res[2], '<code>hofstadterQ(2000)</code> should return <code>1005</code>');
testString: assert.equal(hofstadterQ(testCase[2]), res[2]);
- text: <code>hofstadterQ(2500)</code> should return <code>1261</code>
testString: assert.equal(hofstadterQ(testCase[3]), res[3], '<code>hofstadterQ(2500)</code> should return <code>1261</code>');
testString: assert.equal(hofstadterQ(testCase[3]), res[3]);
```

View File

@ -30,21 +30,21 @@ Write a function that accepts a word and check if the word follows this rule. Th
```yml
tests:
- text: <code>IBeforeExceptC</code> should be a function.
testString: assert(typeof IBeforeExceptC=='function','<code>IBeforeExceptC</code> should be a function.');
testString: assert(typeof IBeforeExceptC=='function');
- text: <code>IBeforeExceptC("receive")</code> should return a boolean.
testString: assert(typeof IBeforeExceptC("receive")=='boolean','<code>IBeforeExceptC("receive")</code> should return a boolean.');
testString: assert(typeof IBeforeExceptC("receive")=='boolean');
- text: <code>IBeforeExceptC("receive")</code> should return <code>true</code>.
testString: assert.equal(IBeforeExceptC("receive"),true,'<code>IBeforeExceptC("receive")</code> should return <code>true</code>.');
testString: assert.equal(IBeforeExceptC("receive"),true);
- text: <code>IBeforeExceptC("science")</code> should return <code>false</code>.
testString: assert.equal(IBeforeExceptC("science"),false,'<code>IBeforeExceptC("science")</code> should return <code>false</code>.');
testString: assert.equal(IBeforeExceptC("science"),false);
- text: <code>IBeforeExceptC("imperceivable")</code> should return <code>true</code>.
testString: assert.equal(IBeforeExceptC("imperceivable"),true,'<code>IBeforeExceptC("imperceivable")</code> should return <code>true</code>.');
testString: assert.equal(IBeforeExceptC("imperceivable"),true);
- text: <code>IBeforeExceptC("inconceivable")</code> should return <code>true</code>.
testString: assert.equal(IBeforeExceptC("inconceivable"),true,'<code>IBeforeExceptC("inconceivable")</code> should return <code>true</code>.');
testString: assert.equal(IBeforeExceptC("inconceivable"),true);
- text: <code>IBeforeExceptC("insufficient")</code> should return <code>false</code>.
testString: assert.equal(IBeforeExceptC("insufficient"),false,'<code>IBeforeExceptC("insufficient")</code> should return <code>false</code>.');
testString: assert.equal(IBeforeExceptC("insufficient"),false);
- text: <code>IBeforeExceptC("omniscient")</code> should return <code>false</code>.
testString: assert.equal(IBeforeExceptC("omniscient"),false,'<code>IBeforeExceptC("omniscient")</code> should return <code>false</code>.');
testString: assert.equal(IBeforeExceptC("omniscient"),false);
```

View File

@ -27,19 +27,19 @@ Write a function that takes IBAN string as parameter. If it is valid return true
```yml
tests:
- text: <code>isValid</code> should be a function.
testString: assert(typeof isValid=='function','<code>isValid</code> should be a function.');
testString: assert(typeof isValid=='function');
- text: <code>isValid("GB82 WEST 1234 5698 7654 32")</code> should return a boolean.
testString: assert(typeof isValid('GB82 WEST 1234 5698 7654 32')=='boolean','<code>isValid("GB82 WEST 1234 5698 7654 32")</code> should return a boolean.');
testString: assert(typeof isValid('GB82 WEST 1234 5698 7654 32')=='boolean');
- text: <code>isValid("GB82 WEST 1234 5698 7654 32")</code> should return <code>true</code>.
testString: assert.equal(isValid('GB82 WEST 1234 5698 7654 32'),true,'<code>isValid("GB82 WEST 1234 5698 7654 32")</code> should return <code>true</code>.');
testString: assert.equal(isValid('GB82 WEST 1234 5698 7654 32'),true);
- text: <code>isValid("GB82 WEST 1.34 5698 7654 32")</code> should return <code>false</code>.
testString: assert.equal(isValid('GB82 WEST 1.34 5698 7654 32'),false,'<code>isValid("GB82 WEST 1.34 5698 7654 32")</code> should return <code>false</code>.');
testString: assert.equal(isValid('GB82 WEST 1.34 5698 7654 32'),false);
- text: <code>isValid("GB82 WEST 1234 5698 7654 325")</code> should return <code>false</code>.
testString: assert.equal(isValid('GB82 WEST 1234 5698 7654 325'),false,'<code>isValid("GB82 WEST 1234 5698 7654 325")</code> should return <code>false</code>.');
testString: assert.equal(isValid('GB82 WEST 1234 5698 7654 325'),false);
- text: <code>isValid("GB82 TEST 1234 5698 7654 32")</code> should return <code>false</code>.
testString: assert.equal(isValid('GB82 TEST 1234 5698 7654 32'),false,'<code>isValid("GB82 TEST 1234 5698 7654 32")</code> should return <code>false</code>.');
testString: assert.equal(isValid('GB82 TEST 1234 5698 7654 32'),false);
- text: <code>isValid("SA03 8000 0000 6080 1016 7519")</code> should return <code>true</code>.
testString: assert.equal(isValid('SA03 8000 0000 6080 1016 7519'),true,'<code>isValid("SA03 8000 0000 6080 1016 7519")</code> should return <code>true</code>.');
testString: assert.equal(isValid('SA03 8000 0000 6080 1016 7519'),true);
```

View File

@ -23,9 +23,9 @@ Write a function that takes a number <code>n</code> as a parameter and returns t
```yml
tests:
- text: <code>idMatrix</code> should be a function.
testString: assert(typeof idMatrix=='function','<code>idMatrix</code> should be a function.');
testString: assert(typeof idMatrix=='function');
- text: <code>idMatrix(1)</code> should return an array.
testString: assert(Array.isArray(idMatrix(1)),'<code>idMatrix(1)</code> should return an array.');
testString: assert(Array.isArray(idMatrix(1)));
- text: <code>idMatrix(1)</code> should return <code>[ [ 1 ] ]</code>.
testString: assert.deepEqual(idMatrix(1),results[0]);
- text: <code>idMatrix(2)</code> should return <code>[ [ 1, 0 ], [ 0, 1 ] ]</code>.

View File

@ -24,21 +24,21 @@ Write a function that takes a number as a parameter and returns 1 or 89 after pe
```yml
tests:
- text: <code>iteratedSquare</code> should be a function.
testString: assert(typeof iteratedSquare=='function','<code>iteratedSquare</code> should be a function.');
testString: assert(typeof iteratedSquare=='function');
- text: <code>iteratedSquare(4)</code> should return a number.
testString: assert(typeof iteratedSquare(4)=='number','<code>iteratedSquare(4)</code> should return a number.');
testString: assert(typeof iteratedSquare(4)=='number');
- text: <code>iteratedSquare(4)</code> should return <code>89</code>.
testString: assert.equal(iteratedSquare(4),89,'<code>iteratedSquare(4)</code> should return <code>89</code>.');
testString: assert.equal(iteratedSquare(4),89);
- text: <code>iteratedSquare(7)</code> should return <code>1</code>.
testString: assert.equal(iteratedSquare(7),1,'<code>iteratedSquare(7)</code> should return <code>1</code>.');
testString: assert.equal(iteratedSquare(7),1);
- text: <code>iteratedSquare(15)</code> should return <code>89</code>.
testString: assert.equal(iteratedSquare(15),89,'<code>iteratedSquare(15)</code> should return <code>89</code>.');
testString: assert.equal(iteratedSquare(15),89);
- text: <code>iteratedSquare(20)</code> should return <code>89</code>.
testString: assert.equal(iteratedSquare(20),89,'<code>iteratedSquare(20)</code> should return <code>89</code>.');
testString: assert.equal(iteratedSquare(20),89);
- text: <code>iteratedSquare(70)</code> should return <code>1</code>.
testString: assert.equal(iteratedSquare(70),1,'<code>iteratedSquare(70)</code> should return <code>1</code>.');
testString: assert.equal(iteratedSquare(70),1);
- text: <code>iteratedSquare(100)</code> should return <code>1</code>.
testString: assert.equal(iteratedSquare(100),1,'<code>iteratedSquare(100)</code> should return <code>1</code>.');
testString: assert.equal(iteratedSquare(100),1);
```

View File

@ -39,19 +39,19 @@ Write a function a that takes two strings as parameters and returns the associat
```yml
tests:
- text: <code>jaro</code> should be a function.
testString: assert(typeof jaro=='function','<code>jaro</code> should be a function.');
testString: assert(typeof jaro=='function');
- text: <code>jaro("MARTHA", "MARHTA")</code> should return a number.
testString: assert(typeof jaro('MARTHA', 'MARHTA')=='number','<code>jaro()</code> should return a number.');
testString: assert(typeof jaro('MARTHA', 'MARHTA')=='number');
- text: <code>jaro("MARTHA", "MARHTA")</code> should return <code>0.9444444444444445</code>.
testString: assert.equal(jaro('MARTHA', 'MARHTA'), 0.9444444444444445,'<code>jaro("MARTHA", "MARHTA")</code> should return <code>0.9444444444444445</code>.');
testString: assert.equal(jaro('MARTHA', 'MARHTA'), 0.9444444444444445);
- text: <code>jaro("DIXON", "DICKSONX")</code> should return <code>0.7666666666666666</code>.
testString: assert.equal(jaro('DIXON', 'DICKSONX'), 0.7666666666666666,'<code>jaro("DIXON", "DICKSONX")</code> should return <code>0.7666666666666666</code>.');
testString: assert.equal(jaro('DIXON', 'DICKSONX'), 0.7666666666666666);
- text: <code>jaro("JELLYFISH", "SMELLYFISH")</code> should return <code>0.8962962962962964</code>.
testString: assert.equal(jaro('JELLYFISH', 'SMELLYFISH'), 0.8962962962962964,'<code>jaro("JELLYFISH", "SMELLYFISH")</code> should return <code>0.8962962962962964</code>.');
testString: assert.equal(jaro('JELLYFISH', 'SMELLYFISH'), 0.8962962962962964);
- text: <code>jaro("HELLOS", "CHELLO")</code> should return <code>0.888888888888889</code>.
testString: assert.equal(jaro('HELLOS', 'CHELLO'), 0.888888888888889,'<code>jaro("HELLOS", "CHELLO")</code> should return <code>0.888888888888889</code>.');
testString: assert.equal(jaro('HELLOS', 'CHELLO'), 0.888888888888889);
- text: <code>jaro("ABCD", "BCDA")</code> should return <code>0.8333333333333334</code>.
testString: assert.equal(jaro('ABCD', 'BCDA'), 0.8333333333333334,'<code>jaro("ABCD", "BCDA")</code> should return <code>0.8333333333333334</code>.');
testString: assert.equal(jaro('ABCD', 'BCDA'), 0.8333333333333334);
```

View File

@ -21,21 +21,21 @@ jortSort is a function that takes a single array of comparable objects as its ar
```yml
tests:
- text: <code>jortsort</code> should be a function.
testString: assert(typeof jortsort=='function','<code>jortsort</code> should be a function.');
testString: assert(typeof jortsort=='function');
- text: <code>jortsort([1,2,3,4,5])</code> should return a boolean.
testString: assert(typeof jortsort([1,2,3,4,5])=='boolean','<code>jortsort([1,2,3,4,5])</code> should return a boolean.');
testString: assert(typeof jortsort([1,2,3,4,5])=='boolean');
- text: <code>jortsort([1,2,3,4,5])</code> should return <code>true</code>.
testString: assert.equal(jortsort([1,2,3,4,5]),true,'<code>jortsort([1,2,3,4,5])</code> should return <code>true</code>.');
testString: assert.equal(jortsort([1,2,3,4,5]),true);
- text: <code>jortsort([1,2,13,4,5])</code> should return <code>false</code>.
testString: assert.equal(jortsort([1,2,13,4,5]),false,'<code>jortsort([1,2,13,4,5])</code> should return <code>false</code>.');
testString: assert.equal(jortsort([1,2,13,4,5]),false);
- text: <code>jortsort([12,4,51,2,4])</code> should return <code>false</code>.
testString: assert.equal(jortsort([12,4,51,2,4]),false,'<code>jortsort([12,4,51,2,4])</code> should return <code>false</code>.');
testString: assert.equal(jortsort([12,4,51,2,4]),false);
- text: <code>jortsort([1,2])</code> should return <code>true</code>.
testString: assert.equal(jortsort([1,2]),true,'<code>jortsort([1,2])</code> should return <code>true</code>.');
testString: assert.equal(jortsort([1,2]),true);
- text: <code>jortsort([5,4,3,2,1])</code> should return <code>false</code>.
testString: assert.equal(jortsort([5,4,3,2,1]),false,'<code>jortsort([5,4,3,2,1])</code> should return <code>false</code>.');
testString: assert.equal(jortsort([5,4,3,2,1]),false);
- text: <code>jortsort([1,1,1,1,1])</code> should return <code>true</code>.
testString: assert.equal(jortsort([1,1,1,1,1]),true,'<code>jortsort([1,1,1,1,1])</code> should return <code>true</code>.');
testString: assert.equal(jortsort([1,1,1,1,1]),true);
```

View File

@ -27,19 +27,19 @@ Write a function that takes the initial number of prisoners and 'k' as parameter
```yml
tests:
- text: <code>josephus</code> should be a function.
testString: assert(typeof josephus=='function','<code>josephus</code> should be a function.');
testString: assert(typeof josephus=='function');
- text: <code>josephus(30,3)</code> should return a number.
testString: assert(typeof josephus(30,3)=='number','<code>josephus(30,3)</code> should return a number.');
testString: assert(typeof josephus(30,3)=='number');
- text: <code>josephus(30,3)</code> should return <code>29</code>.
testString: assert.equal(josephus(30,3),29,'<code>josephus(30,3)</code> should return <code>29</code>.');
testString: assert.equal(josephus(30,3),29);
- text: <code>josephus(30,5)</code> should return <code>3</code>.
testString: assert.equal(josephus(30,5),3,'<code>josephus(30,5)</code> should return <code>3</code>.');
testString: assert.equal(josephus(30,5),3);
- text: <code>josephus(20,2)</code> should return <code>9</code>.
testString: assert.equal(josephus(20,2),9,'<code>josephus(20,2)</code> should return <code>9</code>.');
testString: assert.equal(josephus(20,2),9);
- text: <code>josephus(17,6)</code> should return <code>2</code>.
testString: assert.equal(josephus(17,6),2,'<code>josephus(17,6)</code> should return <code>2</code>.');
testString: assert.equal(josephus(17,6),2);
- text: <code>josephus(29,4)</code> should return <code>2</code>.
testString: assert.equal(josephus(29,4),2,'<code>josephus(29,4)</code> should return <code>2</code>.');
testString: assert.equal(josephus(29,4),2);
```

View File

@ -32,11 +32,11 @@ and turn it into a native data structure. (See the <a href="https://rosettacode.
```yml
tests:
- text: <code>parseSexpr</code> is a function.
testString: assert(typeof parseSexpr === 'function', '<code>parseSexpr</code> is a function.');
testString: assert(typeof parseSexpr === 'function');
- text: <code>parseSexpr('(data1 data2 data3)')</code> should return <code>['data1', 'data2', 'data3']</code>
testString: assert.deepEqual(parseSexpr(simpleSExpr), simpleSolution, "<code>parseSexpr('(data1 data2 data3)')</code> should return ['data1', 'data2', 'data3']");
testString: assert.deepEqual(parseSexpr(simpleSExpr), simpleSolution);
- text: <code>parseSexpr('(data1 data2 data3)')</code> should return an array with 3 elements.
testString: assert.deepEqual(parseSexpr(basicSExpr), basicSolution, "<code>parseSexpr('(data1 data2 data3)')</code> should return an array with 3 elements");
testString: assert.deepEqual(parseSexpr(basicSExpr), basicSolution);
```

View File

@ -32,13 +32,13 @@ Of course the tale is told in a world where the collection of any amount of coco
```yml
tests:
- text: <code>splitCoconuts</code> is a function.
testString: assert(typeof splitCoconuts === 'function', '<code>splitCoconuts</code> is a function.');
testString: assert(typeof splitCoconuts === 'function');
- text: <code>splitCoconuts(5)</code> should return 3121.
testString: assert(splitCoconuts(5) === 3121, '<code>splitCoconuts(5)</code> should return 3121.');
testString: assert(splitCoconuts(5) === 3121);
- text: <code>splitCoconuts(6)</code> should return 233275.
testString: assert(splitCoconuts(6) === 233275, '<code>splitCoconuts(6)</code> should return 233275.');
testString: assert(splitCoconuts(6) === 233275);
- text: <code>splitCoconuts(7)</code> should return 823537.
testString: assert(splitCoconuts(7) === 823537, '<code>splitCoconuts(7)</code> should return 823537.');
testString: assert(splitCoconuts(7) === 823537);
```

View File

@ -36,7 +36,7 @@ Check that each input is correctly formed, especially with respect to valid char
```yml
tests:
- text: <code>sedol</code> is a function.
testString: assert(typeof sedol === 'function', '<code>sedol</code> is a function.');
testString: assert(typeof sedol === 'function');
- text: <code>sedol('a')</code> should return null.
testString: assert(sedol('a') === null);
- text: <code>sedol('710889')</code> should return '7108899'.

View File

@ -20,15 +20,15 @@ Write a function that takes an array of objects as a parameter. The function sho
```yml
tests:
- text: <code>sortByKey</code> should be a function.
testString: assert(typeof sortByKey == 'function', '<code>sortByKey</code> should be a function.');
testString: assert(typeof sortByKey == 'function');
- text: '<code>sortByKey([{key: 3, value: "foo"}, {key: 2, value: "bar"}, {key: 4, value: "baz"}, {key: 1, value: 42}, {key: 5, value: "another string"}])</code> should return an array.'
testString: assert(Array.isArray(sortByKey([{key:3, value:"foo"}, {key:2, value:"bar"}, {key:4, value:"baz"}, {key:1, value:42}, {key:5, value:"another string"}])), '<code>sortByKey([{key:3, value:"foo"}, {key:2, value:"bar"}, {key:4, value:"baz"}, {key:1, value:42}, {key:5, value:"another string"}])</code> should return an array.');
testString: assert(Array.isArray(sortByKey([{key:3, value:"foo"}, {key:2, value:"bar"}, {key:4, value:"baz"}, {key:1, value:42}, {key:5, value:"another string"}])));
- text: '<code>sortByKey([{key: 3, value: "foo"}, {key: 2, value: "bar"}, {key: 4, value: "baz"}, {key: 1, value: 42}, {key: 5, value: "another string"}])</code> should return <code>[{key: 1, value: 42}, {key: 2, value: "bar"}, {key: 3, value: "foo"}, {key: 4, value: "baz"}, {key: 5, value: "another string"}]</code>.'
testString: assert.deepEqual(sortByKey([{key:3, value:"foo"}, {key:2, value:"bar"}, {key:4, value:"baz"}, {key:1, value:42}, {key:5, value:"another string"}]), [{key:1, value:42}, {key:2, value:"bar"}, {key:3, value:"foo"}, {key:4, value:"baz"}, {key:5, value:"another string"}], '<code>sortByKey([{key:3, value:"foo"}, {key:2, value:"bar"}, {key:4, value:"baz"}, {key:1, value:42}, {key:5, value:"another string"}])</code> should return <code>[{key:1, value:42}, {key:2, value:"bar"}, {key:3, value:"foo"}, {key:4, value:"baz"}, {key:5, value:"another string"}]</code>.');
testString: assert.deepEqual(sortByKey([{key:3, value:"foo"}, {key:2, value:"bar"}, {key:4, value:"baz"}, {key:1, value:42}, {key:5, value:"another string"}]), [{key:1, value:42}, {key:2, value:"bar"}, {key:3, value:"foo"}, {key:4, value:"baz"}, {key:5, value:"another string"}]);
- text: '<code>sortByKey([{key: 3, name: "Joe"}, {key: 4, name: "Bill"}, {key: 20, name: "Alice"}, {key: 5, name: "Harry"}])</code> should return <code>[{key: 3, name: "Joe"}, {key: 4, name: "Bill"}, {key: 5, name: "Harry"}, {key: 20, name: "Alice"}]</code>.'
testString: assert.deepEqual(sortByKey([{key:3, name:"Joe"}, {key:4, name:"Bill"}, {key:20, name:"Alice"}, {key:5, name:"Harry"}]), [{key:3, name:"Joe"}, {key:4, name:"Bill"}, {key:5, name:"Harry"}, {key:20, name:"Alice"}], '<code>sortByKey([{key:3, name:"Joe"}, {key:4, name:"Bill"}, {key:20, name:"Alice"}, {key:5, name:"Harry"}])</code> should return <code>[{key:3, name:"Joe"}, {key:4, name:"Bill"}, {key:5, name:"Harry"}, {key:20, name:"Alice"}]</code>.');
testString: assert.deepEqual(sortByKey([{key:3, name:"Joe"}, {key:4, name:"Bill"}, {key:20, name:"Alice"}, {key:5, name:"Harry"}]), [{key:3, name:"Joe"}, {key:4, name:"Bill"}, {key:5, name:"Harry"}, {key:20, name:"Alice"}]);
- text: '<code>sortByKey([{key: 2341, name: "Adam"}, {key: 122, name: "Bernie"}, {key: 19, name: "David"}, {key: 5531, name: "Joe"}, {key: 1234, name: "Walter"}])</code> should return <code>[{key: 19, name: "David"}, {key: 122, name: "Bernie"}, {key: 1234, name: "Walter"}, {key: 2341, name: "Adam"}, {key: 5531, name: "Joe"}]</code>.'
testString: assert.deepEqual(sortByKey([{key:2341, name:"Adam"}, {key:122, name:"Bernie"}, {key:19, name:"David"}, {key:5531, name:"Joe"}, {key:1234, name:"Walter"}]), [{key:19, name:"David"}, {key:122, name:"Bernie"}, {key:1234, name:"Walter"}, {key:2341, name:"Adam"}, {key:5531, name:"Joe"}], '<code>sortByKey([{key:2341, name:"Adam"}, {key:122, name:"Bernie"}, {key:19, name:"David"}, {key:5531, name:"Joe"}, {key:1234, name:"Walter"}])</code> should return <code>[{key:19, name:"David"}, {key:122, name:"Bernie"}, {key:1234, name:"Walter"}, {key:2341, name:"Adam"}, {key:5531, name:"Joe"}]</code>.');
testString: assert.deepEqual(sortByKey([{key:2341, name:"Adam"}, {key:122, name:"Bernie"}, {key:19, name:"David"}, {key:5531, name:"Joe"}, {key:1234, name:"Walter"}]), [{key:19, name:"David"}, {key:122, name:"Bernie"}, {key:1234, name:"Walter"}, {key:2341, name:"Adam"}, {key:5531, name:"Joe"}]);
```

View File

@ -35,17 +35,17 @@ Write a function that returns the lowest <code>n</code> taxicab numbers. For eac
```yml
tests:
- text: <code>taxicabNumbers</code> is a function.
testString: assert(typeof taxicabNumbers === 'function', '<code>taxicabNumbers</code> is a function.');
testString: assert(typeof taxicabNumbers === 'function');
- text: <code>taxicabNumbers</code> should return an array.
testString: assert(typeof taxicabNumbers(2) === 'object', '<code>taxicabNumbers</code> should return an array.');
testString: assert(typeof taxicabNumbers(2) === 'object');
- text: <code>taxicabNumbers</code> should return an array of numbers.
testString: assert(typeof taxicabNumbers(100)[0] === 'number', '<code>taxicabNumbers</code> should return an array of numbers.');
testString: assert(typeof taxicabNumbers(100)[0] === 'number');
- text: <code>taxicabNumbers(4)</code> must return [1729, 4104, 13832, 20683].
testString: assert.deepEqual(taxicabNumbers(4), res4, '<code>taxicabNumbers(4)</code> must return [1729, 4104, 13832, 20683].');
testString: assert.deepEqual(taxicabNumbers(4), res4);
- text: <code>taxicabNumbers(25)</code> should return [1729, 4104, 13832, 20683, 32832, 39312, 40033, 46683, 64232, 65728, 110656, 110808, 134379, 149389, 165464, 171288, 195841, 216027, 216125, 262656, 314496, 320264, 327763, 373464, 402597]
testString: assert.deepEqual(taxicabNumbers(25), res25, '<code>taxicabNumbers(25)</code> should return [1729, 4104, 13832, 20683, 32832, 39312, 40033, 46683, 64232, 65728, 110656, 110808, 134379, 149389, 165464, 171288, 195841, 216027, 216125, 262656, 314496, 320264, 327763, 373464, 402597]');
testString: assert.deepEqual(taxicabNumbers(25), res25);
- text: <code>taxicabNumbers(39)</code> resulting numbers from 20 - 29 should be [314496,320264,327763,373464,402597,439101,443889,513000,513856].
testString: assert.deepEqual(taxicabNumbers(39).slice(20, 29), res39From20To29, '<code>taxicabNumbers(39)</code> resulting numbers from 20 - 29 should be [314496,320264,327763,373464,402597,439101,443889,513000,513856].');
testString: assert.deepEqual(taxicabNumbers(39).slice(20, 29), res39From20To29);
```

View File

@ -45,13 +45,13 @@ and using <code>|</code> as a separator and <code>^</code> as escape character,
```yml
tests:
- text: <code>tokenize</code> is a function.
testString: assert(typeof tokenize === 'function', '<code>tokenize</code> is a function.');
testString: assert(typeof tokenize === 'function');
- text: <code>tokenize</code> should return an array.
testString: assert(typeof tokenize('a', 'b', 'c') === 'object', '<code>tokenize</code> should return an array.');
testString: assert(typeof tokenize('a', 'b', 'c') === 'object');
- text: <code>tokenize('one^|uno||three^^^^|four^^^|^cuatro|', '|', '^') </code> should return <code>['one|uno', '', 'three^^', 'four^|cuatro', '']</code>
testString: assert.deepEqual(tokenize(testStr1, '|', '^'), res1, "<code>tokenize('one^|uno||three^^^^|four^^^|^cuatro|', '|', '^') </code> should return ['one|uno', '', 'three^^', 'four^|cuatro', '']");
testString: assert.deepEqual(tokenize(testStr1, '|', '^'), res1);
- text: <code>tokenize('a@&bcd&ef&&@@hi', '&', '@')</code> should return <code>['a&bcd', 'ef', '', '@hi']</code>
testString: assert.deepEqual(tokenize(testStr2, '&', '@'), res2, '<code>tokenize("a@&bcd&ef&&@@hi", "&", "@")</code> should return <code>["a&bcd", "ef", "", "@hi"]</code>');
testString: assert.deepEqual(tokenize(testStr2, '&', '@'), res2);
```

View File

@ -52,19 +52,19 @@ one could rank the top-rated movie in each genre by calling
```yml
tests:
- text: <code>topRankPerGroup</code> is a function.
testString: assert(typeof topRankPerGroup === 'function', '<code>topRankPerGroup</code> is a function.');
testString: assert(typeof topRankPerGroup === 'function');
- text: <code>topRankPerGroup</code> returns undefined on negative n values.
testString: assert(typeof topRankPerGroup(-1, []) === 'undefined', '<code>topRankPerGroup</code> returns undefined on negative n values.');
testString: assert(typeof topRankPerGroup(-1, []) === 'undefined');
- text: First department must be D050
testString: assert.equal(res1[0][0].dept, 'D050', 'First department must be D050');
testString: assert.equal(res1[0][0].dept, 'D050');
- text: First department must be D050
testString: assert.equal(res1[0][1].salary, 21900, 'First department must be D050');
testString: assert.equal(res1[0][1].salary, 21900);
- text: The last department must be D202
testString: assert.equal(res1[3][3].dept, 'D202', 'The last department must be D202');
testString: assert.equal(res1[3][3].dept, 'D202');
- text: <code>topRankPerGroup(1, ...)</code> must return only top ranking result per group.
testString: assert.equal(res2[2].length, 1, '<code>topRankPerGroup(1, ...)</code> must return only top ranking result per group.');
testString: assert.equal(res2[2].length, 1);
- text: <code>topRankPerGroup(1, ...)</code> must return only top ranking result per group.
testString: assert.equal(res3[2][1].name, 'Maze Runner', '<code>topRankPerGroup(1, ...)</code> must return only top ranking result per group.');
testString: assert.equal(res3[2][1].name, 'Maze Runner');
```

View File

@ -57,15 +57,15 @@ There are two popular algorithms for topological sorting:
```yml
tests:
- text: <code>topologicalSort</code> is a function.
testString: assert(typeof topologicalSort === 'function', '<code>topologicalSort</code> is a function.');
testString: assert(typeof topologicalSort === 'function');
- text: <code>topologicalSort</code> must return correct library order..
testString: assert.deepEqual(topologicalSort(libsSimple), ['bbb', 'aaa'], '<code>topologicalSort</code> must return correct library order..');
testString: assert.deepEqual(topologicalSort(libsSimple), ['bbb', 'aaa']);
- text: <code>topologicalSort</code> must return correct library order..
testString: assert.deepEqual(topologicalSort(libsVHDL), solutionVHDL, '<code>topologicalSort</code> must return correct library order..');
testString: assert.deepEqual(topologicalSort(libsVHDL), solutionVHDL);
- text: <code>topologicalSort</code> must return correct library order..
testString: assert.deepEqual(topologicalSort(libsCustom), solutionCustom, '<code>topologicalSort</code> must return correct library order..');
testString: assert.deepEqual(topologicalSort(libsCustom), solutionCustom);
- text: <code>topologicalSort</code> must ignore unorderable dependencies..
testString: assert.deepEqual(topologicalSort(libsUnorderable), solutionUnorderable, '<code>topologicalSort</code> must ignore unorderable dependencies..');
testString: assert.deepEqual(topologicalSort(libsUnorderable), solutionUnorderable);
```

View File

@ -23,15 +23,15 @@ For example, the array <code>[['A', 'C'], ['B', 'A']]</code> indicates that the
```yml
tests:
- text: <code>towerOfHanoi</code> is a function.
testString: assert(typeof towerOfHanoi === 'function', '<code>towerOfHanoi</code> is a function.');
testString: assert(typeof towerOfHanoi === 'function');
- text: <code>towerOfHanoi(3, ...)</code> should return 7 moves.
testString: assert(res3.length === 7, '<code>towerOfHanoi(3, ...)</code> should return 7 moves.');
testString: assert(res3.length === 7);
- text: <code>towerOfHanoi(3, 'A', 'B', 'C')</code> should return <code>[['A','B'], ['A','C'], ['B','C'], ['A','B'], ['C','A'], ['C','B'], ['A','B']]</code>.
testString: assert.deepEqual(towerOfHanoi(3, 'A', 'B', 'C'), res3Moves, "<code>towerOfHanoi(3, 'A', 'B', 'C')</code> should return [['A','B'], ['A','C'], ['B','C'], ['A','B'], ['C','A'], ['C','B'], ['A','B']].");
testString: assert.deepEqual(towerOfHanoi(3, 'A', 'B', 'C'), res3Moves);
- text: <code>towerOfHanoi(5, "X", "Y", "Z")</code> 10th move should be Y -> X.
testString: assert.deepEqual(res5[9], ['Y', 'X'], '<code>towerOfHanoi(5, "X", "Y", "Z")</code> 10th move should be Y -> X.');
testString: assert.deepEqual(res5[9], ['Y', 'X']);
- text: <code>towerOfHanoi(7, 'A', 'B', 'C')</code> first ten moves are <code>[['A','B'], ['A','C'], ['B','C'], ['A','B'], ['C','A'], ['C','B'], ['A','B'], ['A','C'], ['B','C'], ['B','A']]</code>
testString: assert.deepEqual(towerOfHanoi(7, 'A', 'B', 'C').slice(0, 10), res7First10Moves, "<code>towerOfHanoi(7, 'A', 'B', 'C')</code> first ten moves are [['A','B'], ['A','C'], ['B','C'], ['A','B'], ['C','A'], ['C','B'], ['A','B'], ['A','C'], ['B','C'], ['B','A']].");
testString: assert.deepEqual(towerOfHanoi(7, 'A', 'B', 'C').slice(0, 10), res7First10Moves);
```

View File

@ -22,11 +22,11 @@ Write a function that takes two vectors (arrays) as input and computes their cro
```yml
tests:
- text: dotProduct must be a function
testString: assert.equal(typeof crossProduct, 'function', 'dotProduct must be a function');
testString: assert.equal(typeof crossProduct, 'function');
- text: dotProduct() must return null
testString: assert.equal(crossProduct(), null, 'dotProduct() must return null');
testString: assert.equal(crossProduct(), null);
- text: crossProduct([1, 2, 3], [4, 5, 6]) must return [-3, 6, -3].
testString: assert.deepEqual(res12, exp12, 'crossProduct([1, 2, 3], [4, 5, 6]) must return [-3, 6, -3].');
testString: assert.deepEqual(res12, exp12);
```

View File

@ -22,17 +22,17 @@ Write a function that takes any numbers of vectors (arrays) as input and compute
```yml
tests:
- text: dotProduct must be a function
testString: assert.equal(typeof dotProduct, 'function', 'dotProduct must be a function');
testString: assert.equal(typeof dotProduct, 'function');
- text: dotProduct() must return null
testString: assert.equal(dotProduct(), null, 'dotProduct() must return null');
testString: assert.equal(dotProduct(), null);
- text: dotProduct([[1], [1]]) must return 1.
testString: assert.equal(dotProduct([1], [1]), 1, 'dotProduct([[1], [1]]) must return 1.');
testString: assert.equal(dotProduct([1], [1]), 1);
- text: dotProduct([[1], [1, 2]]) must return null.
testString: assert.equal(dotProduct([1], [1, 2]), null, 'dotProduct([[1], [1, 2]]) must return null.');
testString: assert.equal(dotProduct([1], [1, 2]), null);
- text: dotProduct([1, 3, -5], [4, -2, -1]) must return 3.
testString: assert.equal(dotProduct([1, 3, -5], [4, -2, -1]), 3, 'dotProduct([1, 3, -5], [4, -2, -1]) must return 3.');
testString: assert.equal(dotProduct([1, 3, -5], [4, -2, -1]), 3);
- text: <code>dotProduct(...nVectors)</code> should return 156000
testString: assert.equal(dotProduct([ 0, 1, 2, 3, 4 ], [ 0, 2, 4, 6, 8 ], [ 0, 3, 6, 9, 12 ], [ 0, 4, 8, 12, 16 ], [ 0, 5, 10, 15, 20 ]), 156000, '<code>dotProduct(...nVectors)</code> should return 156000');
testString: assert.equal(dotProduct([ 0, 1, 2, 3, 4 ], [ 0, 2, 4, 6, 8 ], [ 0, 3, 6, 9, 12 ], [ 0, 4, 8, 12, 16 ], [ 0, 5, 10, 15, 20 ]), 156000);
```

View File

@ -28,17 +28,17 @@ than a simple minimum length algorithm.
```yml
tests:
- text: wrap must be a function.
testString: assert.equal(typeof wrap, 'function', 'wrap must be a function.');
testString: assert.equal(typeof wrap, 'function');
- text: wrap must return a string.
testString: assert.equal(typeof wrap('abc', 10), 'string', 'wrap must return a string.');
testString: assert.equal(typeof wrap('abc', 10), 'string');
- text: wrap(80) must return 4 lines.
testString: assert(wrapped80.split('\n').length === 4, 'wrap(80) must return 4 lines.');
testString: assert(wrapped80.split('\n').length === 4);
- text: Your <code>wrap</code> function should return our expected text
testString: assert.equal(wrapped80.split('\n')[0], firstRow80, 'Your <code>wrap</code> function should return our expected text');
testString: assert.equal(wrapped80.split('\n')[0], firstRow80);
- text: wrap(42) must return 7 lines.
testString: assert(wrapped42.split('\n').length === 7, 'wrap(42) must return 7 lines.');
testString: assert(wrapped42.split('\n').length === 7);
- text: Your <code>wrap</code> function should return our expected text
testString: assert.equal(wrapped42.split('\n')[0], firstRow42, 'Your <code>wrap</code> function should return our expected text');
testString: assert.equal(wrapped42.split('\n')[0], firstRow42);
```

View File

@ -27,17 +27,17 @@ Define the stateless Y combinator function and use it to compute <a href="https:
```yml
tests:
- text: Y must return a function
testString: assert.equal(typeof Y(f => n => n), 'function', 'Y must return a function');
testString: assert.equal(typeof Y(f => n => n), 'function');
- text: factorial(1) must return 1.
testString: assert.equal(factorial(1), 1, 'factorial(1) must return 1.');
testString: assert.equal(factorial(1), 1);
- text: factorial(2) must return 2.
testString: assert.equal(factorial(2), 2, 'factorial(2) must return 2.');
testString: assert.equal(factorial(2), 2);
- text: factorial(3) must return 6.
testString: assert.equal(factorial(3), 6, 'factorial(3) must return 6.');
testString: assert.equal(factorial(3), 6);
- text: factorial(4) must return 24.
testString: assert.equal(factorial(4), 24, 'factorial(4) must return 24.');
testString: assert.equal(factorial(4), 24);
- text: factorial(10) must return 3628800.
testString: assert.equal(factorial(10), 3628800, 'factorial(10) must return 3628800.');
testString: assert.equal(factorial(10), 3628800);
```

View File

@ -21,9 +21,9 @@ Write a function that generates and returns an array of the first <code>n</code>
```yml
tests:
- text: zeckendorf must be function
testString: assert.equal(typeof zeckendorf, 'function', 'zeckendorf must be function');
testString: assert.equal(typeof zeckendorf, 'function');
- text: Your <code>zeckendorf</code> function should return the correct answer
testString: assert.deepEqual(answer, solution20, 'Your <code>zeckendorf</code> function should return the correct answer');
testString: assert.deepEqual(answer, solution20);
```

View File

@ -101,13 +101,13 @@ Write a routine to perform Zhang-Suen thinning on the provided image matrix.
```yml
tests:
- text: <code>thinImage</code> must be a function
testString: assert.equal(typeof thinImage, 'function', '<code>thinImage</code> must be a function');
testString: assert.equal(typeof thinImage, 'function');
- text: <code>thinImage</code> must return an array
testString: assert(Array.isArray(result), '<code>thinImage</code> must return an array');
testString: assert(Array.isArray(result));
- text: <code>thinImage</code> must return an array of strings
testString: assert.equal(typeof result[0], 'string', '<code>thinImage</code> must return an array of strings');
testString: assert.equal(typeof result[0], 'string');
- text: <code>thinImage</code> must return an array of strings
testString: assert.deepEqual(result, expected, '<code>thinImage</code> must return an array of strings');
testString: assert.deepEqual(result, expected);
```