fix(i18n): chinese test suite (#38220)

* fix: Chinese test suite

Add localeTiltes, descriptions, and adjust test text and testStrings to get the automated test suite working.

* fix: ran script, updated testStrings and solutions
This commit is contained in:
Kristofer Koishigawa
2020-02-18 01:40:55 +09:00
committed by Mrugesh Mohapatra
parent 6a7a7e6d7d
commit b3213fc892
1264 changed files with 5635 additions and 4331 deletions

View File

@@ -19,11 +19,11 @@ localeTitle: 100门
```yml
tests:
- text: <code>getFinalOpenedDoors</code>是一个函数。
testString: 'assert(typeof getFinalOpenedDoors === "function", "<code>getFinalOpenedDoors</code> is a function.");'
testString: assert(typeof getFinalOpenedDoors === 'function');
- text: <code>getFinalOpenedDoors</code>应该返回一个数组。
testString: 'assert(Array.isArray(getFinalOpenedDoors(100)), "<code>getFinalOpenedDoors</code> should return an array.");'
testString: assert(Array.isArray(getFinalOpenedDoors(100)));
- text: <code>getFinalOpenedDoors</code>没有产生正确的结果。
testString: 'assert.deepEqual(getFinalOpenedDoors(100), solution, "<code>getFinalOpenedDoors</code> did not produce the correct results.");'
testString: assert.deepEqual(getFinalOpenedDoors(100), solution);
```

View File

@@ -19,15 +19,15 @@ localeTitle: 24场比赛
```yml
tests:
- text: <code>solve24</code>是一个函数。
testString: 'assert(typeof solve24 === "function", "<code>solve24</code> is a function.");'
testString: assert(typeof solve24 === 'function');
- text: <code>solve24(&quot;4878&quot;)</code>应返回<code>(7-8/8)*4</code>或<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(&quot;1234&quot;)</code>应返回<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(&quot;6789&quot;)</code>应返回<code>(6*8)/(9-7)</code>或<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(&quot;1127&quot;)</code>应该返回<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

@@ -25,19 +25,19 @@ localeTitle: 90亿上帝的名字整数
```yml
tests:
- text: <code>numberOfNames</code>是一个函数。
testString: 'assert(typeof numberOfNames === "function", "<code>numberOfNames</code> is a function.");'
testString: assert(typeof numberOfNames === 'function');
- text: <code>numberOfNames(5)</code>应该等于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>应该等于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>应该等于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>应该等于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>应该等于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>应该等于2552338241。
testString: 'assert.equal(numberOfNames(123), 2552338241, "<code>numberOfNames(123)</code> should equal 2552338241.");'
testString: assert.equal(numberOfNames(123), 2552338241);
```

View File

@@ -19,21 +19,21 @@ localeTitle: ABC问题
```yml
tests:
- text: <code>canMakeWord</code>是一个功能。
testString: 'assert(typeof canMakeWord === "function", "<code>canMakeWord</code> is a function.");'
testString: assert(typeof canMakeWord === 'function');
- text: <code>canMakeWord</code>应该返回一个布尔值。
testString: 'assert(typeof canMakeWord("hi") === "boolean", "<code>canMakeWord</code> should return a boolean.");'
testString: assert(typeof canMakeWord('hi') === 'boolean');
- text: <code>canMakeWord(&quot;bark&quot;)</code>应该返回true。
testString: 'assert(canMakeWord(words[0]), "<code>canMakeWord("bark")</code> should return true.");'
testString: assert(canMakeWord(words[0]));
- text: <code>canMakeWord(&quot;BooK&quot;)</code>应该返回false。
testString: 'assert(!canMakeWord(words[1]), "<code>canMakeWord("BooK")</code> should return false.");'
testString: assert(!canMakeWord(words[1]));
- text: <code>canMakeWord(&quot;TReAT&quot;)</code>应该返回true。
testString: 'assert(canMakeWord(words[2]), "<code>canMakeWord("TReAT")</code> should return true.");'
testString: assert(canMakeWord(words[2]));
- text: <code>canMakeWord(&quot;COMMON&quot;)</code>应返回false。
testString: 'assert(!canMakeWord(words[3]), "<code>canMakeWord("COMMON")</code> should return false.");'
testString: assert(!canMakeWord(words[3]));
- text: <code>canMakeWord(&quot;squAD&quot;)</code>应该返回true。
testString: 'assert(canMakeWord(words[4]), "<code>canMakeWord("squAD")</code> should return true.");'
testString: assert(canMakeWord(words[4]));
- text: <code>canMakeWord(&quot;conFUSE&quot;)</code>应该返回true。
testString: 'assert(canMakeWord(words[5]), "<code>canMakeWord("conFUSE")</code> should return true.");'
testString: assert(canMakeWord(words[5]));
```

View File

@@ -19,13 +19,13 @@ localeTitle: 丰富,不足和完善的数字分类
```yml
tests:
- text: <code>getDPA</code>是一个功能。
testString: 'assert(typeof getDPA === "function", "<code>getDPA</code> is a function.");'
testString: assert(typeof getDPA === 'function');
- text: <code>getDPA</code>应该返回一个数组。
testString: 'assert(Array.isArray(getDPA(100)), "<code>getDPA</code> should return an array.");'
testString: assert(Array.isArray(getDPA(100)));
- text: <code>getDPA</code>返回值的长度应为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>应该等于[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

@@ -19,13 +19,13 @@ localeTitle: 蓄能器工厂
```yml
tests:
- text: <code>accumulator</code>是一个功能。
testString: 'assert(typeof accumulator === "function", "<code>accumulator</code> is a function.");'
testString: assert(typeof accumulator === 'function');
- text: <code>accumulator(0)</code>应该返回一个函数。
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>应该返回一个数字。
testString: 'assert(typeof accumulator(0)(2) === "number", "<code>accumulator(0)(2)</code> should return a number.");'
testString: assert(typeof accumulator(0)(2) === 'number');
- text: '传递值3-4,1.5和5应返回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

@@ -19,15 +19,15 @@ localeTitle: 阿克曼功能
```yml
tests:
- text: <code>ack</code>是一个功能。
testString: 'assert(typeof ack === "function", "<code>ack</code> is a function.");'
testString: assert(typeof ack === 'function');
- text: '<code>ack(0, 0)</code>应该返回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>应该返回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>应该返回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>应该返回61。'
testString: 'assert(ack(3, 3) === 61, "<code>ack(3, 3)</code> should return 61.");'
testString: assert(ack(3, 3) === 61);
```

View File

@@ -29,13 +29,13 @@ localeTitle: 对齐列
```yml
tests:
- text: <code>formatText</code>是一个函数。
testString: 'assert(typeof formatText === "function", "<code>formatText</code> is a function.");'
testString: assert(typeof formatText === 'function');
- text: 具有上述输入和“右”对齐的<code>formatText</code>应产生以下内容:
testString: 'assert.strictEqual(formatText(testInput, "right"), rightAligned, "<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>应产生以下内容:
testString: 'assert.strictEqual(formatText(testInput, "left"), leftAligned, "<code>formatText</code> with the above input and "left" justification should produce the following: ");'
testString: 'assert.strictEqual(formatText(testInput, ''left''), leftAligned);'
- text: 具有上述输入和“居中”对齐的<code>formatText</code>应产生以下内容:
testString: 'assert.strictEqual(formatText(testInput, "center"), centerAligned, "<code>formatText</code> with the above input and "center" justification should produce the following: ");'
testString: 'assert.strictEqual(formatText(testInput, ''center''), centerAligned);'
```

View File

@@ -19,13 +19,13 @@ localeTitle: 友好的对
```yml
tests:
- text: <code>amicablePairsUpTo</code>是一个函数。
testString: 'assert(typeof amicablePairsUpTo === "function", "<code>amicablePairsUpTo</code> is a function.");'
testString: assert(typeof amicablePairsUpTo === 'function');
- text: '<code>[[220,284]]</code> <code>amicablePairsUpTo(300)</code>应返回<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>[[220,284],[1184,1210],[2620,2924]]</code> <code>amicablePairsUpTo(3000)</code>应返回<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>[[220,284],[1184,1210],[2620,2924],[5020,5564],[6232,6368],[10744,10856],[12285,14595],[17296,18416]]</code> <code>amicablePairsUpTo(20000)</code>应返回<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

@@ -19,11 +19,11 @@ localeTitle: 平均值模式
```yml
tests:
- text: <code>mode</code>是一种功能。
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>应该相等<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>应该等于<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

@@ -27,9 +27,9 @@ localeTitle: 平均值 - 毕达哥拉斯指的是
```yml
tests:
- text: <code>pythagoreanMeans</code>是一种功能。
testString: 'assert(typeof pythagoreanMeans === "function", "<code>pythagoreanMeans</code> is a function.");'
testString: assert(typeof pythagoreanMeans === 'function');
- text: '<code>pythagoreanMeans([1, 2, ..., 10])</code>应该等于上面相同的输出。'
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

@@ -19,9 +19,9 @@ localeTitle: 平均值 - 均方根
```yml
tests:
- text: <code>rms</code>是一个功能。
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>应等于<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

@@ -19,9 +19,9 @@ localeTitle: 巴贝奇问题
```yml
tests:
- text: <code>babbage</code>是一种功能。
testString: 'assert(typeof babbage === "function", "<code>babbage</code> is a function.");'
testString: assert(typeof babbage === 'function');
- text: '<code>babbage(99736, 269696)</code>不应该返回99736答案较小。'
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

@@ -19,43 +19,43 @@ localeTitle: 平衡括号
```yml
tests:
- text: <code>isBalanced</code>是一个函数。
testString: 'assert(typeof isBalanced === "function", "<code>isBalanced</code> is a function.");'
- text: '<code>isBalanced(&quot;[]&quot;)</code>应该返回true。'
testString: 'assert(isBalanced(testCases[0]), "<code>isBalanced("[]")</code> should return true.");'
- text: '<code>isBalanced(&quot;]][[[][][][]][&quot;)</code>应该返回false。'
testString: 'assert(!isBalanced(testCases[1]), "<code>isBalanced("]][[[][][][]][")</code> should return false.");'
- text: '<code>isBalanced(&quot;[][[[[][][[[]]]]]]&quot;)</code>应该返回true。'
testString: 'assert(isBalanced(testCases[2]), "<code>isBalanced("[][[[[][][[[]]]]]]")</code> should return true.");'
- text: '<code>isBalanced(&quot;][&quot;)</code>应该返回true。'
testString: 'assert(!isBalanced(testCases[3]), "<code>isBalanced("][")</code> should return true.");'
- text: '<code>isBalanced(&quot;[[[]]]][[]&quot;)</code>应该返回true。'
testString: 'assert(!isBalanced(testCases[4]), "<code>isBalanced("[[[]]]][[]")</code> should return true.");'
- text: '<code>isBalanced(&quot;][[]&quot;)</code>应该返回true。'
testString: 'assert(!isBalanced(testCases[5]), "<code>isBalanced("][[]")</code> should return true.");'
- text: '<code>isBalanced(&quot;][[][]][[[]]&quot;)</code>应该返回true。'
testString: 'assert(!isBalanced(testCases[6]), "<code>isBalanced("][[][]][[[]]")</code> should return true.");'
- text: '<code>isBalanced(&quot;[[][]]][&quot;)</code>应该返回true。'
testString: 'assert(!isBalanced(testCases[7]), "<code>isBalanced("[[][]]][")</code> should return true.");'
- text: '<code>isBalanced(&quot;[[[]]][[]]]][][[&quot;)</code>应该返回true。'
testString: 'assert(!isBalanced(testCases[8]), "<code>isBalanced("[[[]]][[]]]][][[")</code> should return true.");'
- text: '<code>isBalanced(&quot;[]][[]]][[[[][]]&quot;)</code>应该返回true。'
testString: 'assert(!isBalanced(testCases[9]), "<code>isBalanced("[]][[]]][[[[][]]")</code> should return true.");'
- text: '<code>isBalanced(&quot;][]][[][&quot;)</code>应该返回true。'
testString: 'assert(!isBalanced(testCases[10]), "<code>isBalanced("][]][[][")</code> should return true.");'
- text: '<code>isBalanced(&quot;[[]][[][]]&quot;)</code>应该返回true。'
testString: 'assert(isBalanced(testCases[11]), "<code>isBalanced("[[]][[][]]")</code> should return true.");'
- text: '<code>isBalanced(&quot;[[]]&quot;)</code>应该返回true。'
testString: 'assert(isBalanced(testCases[12]), "<code>isBalanced("[[]]")</code> should return true.");'
- text: '<code>isBalanced(&quot;]][]][[]][[[&quot;)</code>应该返回true。'
testString: 'assert(!isBalanced(testCases[13]), "<code>isBalanced("]][]][[]][[[")</code> should return true.");'
- text: '<code>isBalanced(&quot;][]][][[&quot;)</code>应该返回true。'
testString: 'assert(!isBalanced(testCases[14]), "<code>isBalanced("][]][][[")</code> should return true.");'
- text: '<code>isBalanced(&quot;][][&quot;)</code>应该返回true。'
testString: 'assert(!isBalanced(testCases[15]), "<code>isBalanced("][][")</code> should return true.");'
- text: '<code>isBalanced(&quot;[[]]][][][[]][&quot;)</code>应该返回true。'
testString: 'assert(!isBalanced(testCases[16]), "<code>isBalanced("[[]]][][][[]][")</code> should return true.");'
testString: assert(typeof isBalanced === 'function');
- text: <code>isBalanced(&quot;[]&quot;)</code>应该返回true。
testString: assert(isBalanced(testCases[0]));
- text: <code>isBalanced(&quot;]][[[][][][]][&quot;)</code>应该返回false。
testString: assert(!isBalanced(testCases[1]));
- text: <code>isBalanced(&quot;[][[[[][][[[]]]]]]&quot;)</code>应该返回true。
testString: assert(isBalanced(testCases[2]));
- text: <code>isBalanced(&quot;][&quot;)</code>应该返回true。
testString: assert(!isBalanced(testCases[3]));
- text: <code>isBalanced(&quot;[[[]]]][[]&quot;)</code>应该返回true。
testString: assert(!isBalanced(testCases[4]));
- text: <code>isBalanced(&quot;][[]&quot;)</code>应该返回true。
testString: assert(!isBalanced(testCases[5]));
- text: <code>isBalanced(&quot;][[][]][[[]]&quot;)</code>应该返回true。
testString: assert(!isBalanced(testCases[6]));
- text: <code>isBalanced(&quot;[[][]]][&quot;)</code>应该返回true。
testString: assert(!isBalanced(testCases[7]));
- text: <code>isBalanced(&quot;[[[]]][[]]]][][[&quot;)</code>应该返回true。
testString: assert(!isBalanced(testCases[8]));
- text: <code>isBalanced(&quot;[]][[]]][[[[][]]&quot;)</code>应该返回true。
testString: assert(!isBalanced(testCases[9]));
- text: <code>isBalanced(&quot;][]][[][&quot;)</code>应该返回true。
testString: assert(!isBalanced(testCases[10]));
- text: <code>isBalanced(&quot;[[]][[][]]&quot;)</code>应该返回true。
testString: assert(isBalanced(testCases[11]));
- text: <code>isBalanced(&quot;[[]]&quot;)</code>应该返回true。
testString: assert(isBalanced(testCases[12]));
- text: <code>isBalanced(&quot;]][]][[]][[[&quot;)</code>应该返回true。
testString: assert(!isBalanced(testCases[13]));
- text: <code>isBalanced(&quot;][]][][[&quot;)</code>应该返回true。
testString: assert(!isBalanced(testCases[14]));
- text: <code>isBalanced(&quot;][][&quot;)</code>应该返回true。
testString: assert(!isBalanced(testCases[15]));
- text: <code>isBalanced(&quot;[[]]][][][[]][&quot;)</code>应该返回true。
testString: assert(!isBalanced(testCases[16]));
- text: <code>isBalanced(&quot;&quot;)</code>应该返回true。
testString: 'assert(isBalanced(testCases[17]), "<code>isBalanced("")</code> should return true.");'
testString: assert(isBalanced(testCases[17]));
```

View File

@@ -25,17 +25,17 @@ localeTitle: 给定半径的圆圈通过两个点
```yml
tests:
- text: <code>getCircles</code>是一个函数。
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>应该返回<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>应该返回<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>应返回<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>应返回<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>应返回<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

@@ -66,15 +66,15 @@ localeTitle: 最近对的问题
```yml
tests:
- text: <code>getClosestPair</code>是一个函数。
testString: 'assert(typeof getClosestPair === "function", "<code>getClosestPair</code> is a function.");'
testString: assert(typeof getClosestPair === 'function');
- text: 距离应如下。
testString: 'assert.equal(getClosestPair(points1).distance, answer1.distance, "Distance should be the following.");'
testString: assert.equal(getClosestPair(points1).distance, answer1.distance);
- text: 要点应如下。
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: 距离应如下。
testString: 'assert.equal(getClosestPair(points2).distance, answer2.distance, "Distance should be the following.");'
testString: assert.equal(getClosestPair(points2).distance, answer2.distance);
- text: 要点应如下。
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

@@ -29,11 +29,11 @@ localeTitle: 组合
```yml
tests:
- text: <code>combinations</code>是一种功能。
testString: 'assert(typeof combinations === "function", "<code>combinations</code> is a function.");'
testString: assert(typeof combinations === 'function');
- text: '<code>combinations(3, 5)</code>应返回<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>应返回<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

@@ -19,17 +19,17 @@ localeTitle: 逗号狡猾
```yml
tests:
- text: <code>quibble</code>是一种功能。
testString: 'assert(typeof quibble === "function", "<code>quibble</code> is a function.");'
- text: '<code>quibble([&quot;ABC&quot;])</code>应该返回一个字符串。'
testString: 'assert(typeof quibble(["ABC"]) === "string", "<code>quibble(["ABC"])</code> should return a string.");'
- text: '<code>quibble([])</code>应返回“{}”。'
testString: 'assert.equal(quibble(testCases[0]), results[0], "<code>quibble([])</code> should return "{}".");'
- text: '<code>quibble([&quot;ABC&quot;])</code>应该返回“{ABC}”。'
testString: 'assert.equal(quibble(testCases[1]), results[1], "<code>quibble(["ABC"])</code> should return "{ABC}".");'
- text: '<code>quibble([&quot;ABC&quot;, &quot;DEF&quot;])</code>应返回“{ABC和DEF}”。'
testString: 'assert.equal(quibble(testCases[2]), results[2], "<code>quibble(["ABC", "DEF"])</code> should return "{ABC and DEF}".");'
- text: '<code>quibble([&quot;ABC&quot;, &quot;DEF&quot;, &quot;G&quot;, &quot;H&quot;])</code>应返回“{ABCDEFG和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(typeof quibble === 'function');
- text: <code>quibble(["ABC"])</code>应该返回一个字符串。
testString: assert(typeof quibble(["ABC"]) === 'string');
- text: <code>quibble([])</code>应返回“{}”。
testString: assert.equal(quibble(testCases[0]), results[0]);
- text: <code>quibble(["ABC"])</code>应该返回“{ABC}”。
testString: assert.equal(quibble(testCases[1]), results[1]);
- text: <code>quibble(["ABC", "DEF"])</code>应返回“{ABC和DEF}”。
testString: assert.equal(quibble(testCases[2]), results[2]);
- text: <code>quibble(["ABC", "DEF", "G", "H"])</code>应返回“{ABCDEFG和H}”。
testString: assert.equal(quibble(testCases[3]), results[3]);
```

View File

@@ -19,29 +19,29 @@ localeTitle: 比较字符串列表
```yml
tests:
- text: <code>allEqual</code>是一个函数。
testString: 'assert(typeof allEqual === "function", "<code>allEqual</code> is a function.");'
testString: assert(typeof allEqual === 'function');
- text: <code>azSorted</code>是一个函数。
testString: 'assert(typeof azSorted === "function", "<code>azSorted</code> is a function.");'
- text: '<code>allEqual([&quot;AA&quot;, &quot;AA&quot;, &quot;AA&quot;, &quot;AA&quot;])</code>返回true。'
testString: 'assert(allEqual(testCases[0]), "<code>allEqual(["AA", "AA", "AA", "AA"])</code> returns true.");'
- text: '<code>azSorted([&quot;AA&quot;, &quot;AA&quot;, &quot;AA&quot;, &quot;AA&quot;])</code>返回false。'
testString: 'assert(!azSorted(testCases[0]), "<code>azSorted(["AA", "AA", "AA", "AA"])</code> returns false.");'
- text: '<code>allEqual([&quot;AA&quot;, &quot;ACB&quot;, &quot;BB&quot;, &quot;CC&quot;])</code>返回false。'
testString: 'assert(!allEqual(testCases[1]), "<code>allEqual(["AA", "ACB", "BB", "CC"])</code> returns false.");'
- text: '<code>azSorted([&quot;AA&quot;, &quot;ACB&quot;, &quot;BB&quot;, &quot;CC&quot;])</code>返回true。'
testString: 'assert(azSorted(testCases[1]), "<code>azSorted(["AA", "ACB", "BB", "CC"])</code> returns true.");'
- text: '<code>allEqual([])</code>返回true。'
testString: 'assert(allEqual(testCases[2]), "<code>allEqual([])</code> returns true.");'
- text: '<code>azSorted([])</code>返回true。'
testString: 'assert(azSorted(testCases[2]), "<code>azSorted([])</code> returns true.");'
- text: '<code>allEqual([&quot;AA&quot;])</code>返回true。'
testString: 'assert(allEqual(testCases[3]), "<code>allEqual(["AA"])</code> returns true.");'
- text: '<code>azSorted([&quot;AA&quot;])</code>返回true。'
testString: 'assert(azSorted(testCases[3]), "<code>azSorted(["AA"])</code> returns true.");'
- text: '<code>allEqual([&quot;BB&quot;, &quot;AA&quot;])</code>返回false。'
testString: 'assert(!allEqual(testCases[4]), "<code>allEqual(["BB", "AA"])</code> returns false.");'
- text: '<code>azSorted([&quot;BB&quot;, &quot;AA&quot;])</code>返回false。'
testString: 'assert(!azSorted(testCases[4]), "<code>azSorted(["BB", "AA"])</code> returns false.");'
testString: assert(typeof azSorted === 'function');
- text: <code>allEqual(["AA", "AA", "AA", "AA"])</code>返回true。
testString: assert(allEqual(testCases[0]));
- text: <code>azSorted(["AA", "AA", "AA", "AA"])</code>返回false。
testString: assert(!azSorted(testCases[0]));
- text: <code>allEqual(["AA", "ACB", "BB", "CC"])</code>返回false。
testString: assert(!allEqual(testCases[1]));
- text: <code>azSorted(["AA", "ACB", "BB", "CC"])</code>返回true。
testString: assert(azSorted(testCases[1]));
- text: <code>allEqual([])</code>返回true。
testString: assert(allEqual(testCases[2]));
- text: <code>azSorted([])</code>返回true。
testString: assert(azSorted(testCases[2]));
- text: <code>allEqual(["AA"])</code>返回true。
testString: assert(allEqual(testCases[3]));
- text: <code>azSorted(["AA"])</code>返回true。
testString: assert(azSorted(testCases[3]));
- text: <code>allEqual(["BB", "AA"])</code>返回false。
testString: assert(!allEqual(testCases[4]));
- text: <code>azSorted(["BB", "AA"])</code>返回false。
testString: assert(!azSorted(testCases[4]));
```

View File

@@ -19,13 +19,13 @@ localeTitle: 将秒转换为复合持续时间
```yml
tests:
- text: <code>convertSeconds</code>是一个函数。
testString: 'assert(typeof convertSeconds === "function", "<code>convertSeconds</code> is a function.");'
testString: assert(typeof convertSeconds === 'function');
- text: '<code>convertSeconds(7259)</code>应该返回<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>应返回<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>应该返回<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

@@ -19,13 +19,13 @@ localeTitle: 计算子字符串的出现次数
```yml
tests:
- text: <code>countSubstring</code>是一个函数。
testString: 'assert(typeof countSubstring === "function", "<code>countSubstring</code> is a function.");'
- text: '<code>countSubstring(&quot;the three truths&quot;, &quot;th&quot;)</code>应该返回<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>.");'
- text: '<code>countSubstring(&quot;ababababab&quot;, &quot;abab&quot;)</code>应返回<code>2</code> 。'
testString: 'assert.equal(countSubstring(testCases[1], searchString[1]), results[1], "<code>countSubstring("ababababab", "abab")</code> should return <code>2</code>.");'
- text: '<code>countSubstring(&quot;abaabba*bbaba*bbab&quot;, &quot;a*b&quot;)</code>应返回<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(typeof countSubstring === 'function');
- text: <code>countSubstring("the three truths", "th")</code>应该返回<code>3</code> 。
testString: assert.equal(countSubstring(testCases[0], searchString[0]), results[0]);
- text: <code>countSubstring("ababababab", "abab")</code>应返回<code>2</code> 。
testString: assert.equal(countSubstring(testCases[1], searchString[1]), results[1]);
- text: <code>countSubstring("abaabba*bbaba*bbab", "a*b")</code>应返回<code>2</code> 。
testString: assert.equal(countSubstring(testCases[2], searchString[2]), results[2]);
```

View File

@@ -19,9 +19,9 @@ localeTitle: 计算硬币
```yml
tests:
- text: <code>countCoins</code>是一个函数。
testString: 'assert(typeof countCoins === "function", "<code>countCoins</code> is a function.");'
testString: assert(typeof countCoins === 'function');
- text: <code>countCoints()</code>应该返回242。
testString: 'assert.equal(countCoins(), 242, "<code>countCoints()</code> should return 242.");'
testString: assert.equal(countCoins(), 242);
```

View File

@@ -19,11 +19,11 @@ localeTitle: 克莱默的统治
```yml
tests:
- text: <code>cramersRule</code>是一个函数。
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>应返回<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>应返回<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

@@ -19,13 +19,13 @@ localeTitle: 日期格式
```yml
tests:
- text: <code>getDateFormats</code>是一个函数。
testString: 'assert(typeof getDateFormats === "function", "<code>getDateFormats</code> is a function.");'
testString: assert(typeof getDateFormats === 'function');
- text: 应该返回一个对象。
testString: 'assert(typeof getDateFormats() === "object", "Should return an object.");'
testString: assert(typeof getDateFormats() === 'object');
- text: 应该返回一个包含2个元素的数组。
testString: 'assert(getDateFormats().length === 2, "Should returned an array with 2 elements.");'
testString: assert(getDateFormats().length === 2);
- text: 应以正​​确的格式返回正确的日期
testString: 'assert.deepEqual(getDateFormats(), dates, equalsMessage);'
testString: assert.deepEqual(getDateFormats(), dates, equalsMessage);
```

View File

@@ -19,19 +19,19 @@ localeTitle: 日期操纵
```yml
tests:
- text: <code>add12Hours</code>是一个功能。
testString: 'assert(typeof add12Hours === "function", "<code>add12Hours</code> is a function.");'
testString: assert(typeof add12Hours === 'function');
- text: <code>add12Hours(dateString)</code>应该返回一个字符串。
testString: 'assert(typeof add12Hours(tests[0]) === "string", "<code>add12Hours(dateString)</code> should return a string.");'
- text: '<code>add12Hours(&quot;&quot; + tests[0] + &quot;&quot;)</code>应该返回<code>&quot;&quot; + answers[0] + &quot;&quot;</code>'
testString: 'assert(add12Hours(tests[0]) === answers[0], "<code>add12Hours("" + tests[0] + "")</code> should return <code>"" + answers[0] + ""</code>");'
- text: '汉德尔应该改变一天。 <code>add12Hours(&quot;&quot; + tests[1] + &quot;&quot;)</code>应返回<code>&quot;&quot; + answers[1] + &quot;&quot;</code>'
testString: 'assert(add12Hours(tests[1]) === answers[1], "Should handel day change. <code>add12Hours("" + tests[1] + "")</code> should return <code>"" + answers[1] + ""</code>");'
- text: '汉德尔月份应该在闰年中发生变化。 <code>add12Hours(&quot;&quot; + tests[2] + &quot;&quot;)</code>应返回<code>&quot;&quot; + answers[2] + &quot;&quot;</code>'
testString: 'assert(add12Hours(tests[2]) === answers[2], "Should handel month change in a leap years. <code>add12Hours("" + tests[2] + "")</code> should return <code>"" + answers[2] + ""</code>");'
- text: '应该在一个共同的年份改变汉德尔月份。 <code>add12Hours(&quot;&quot; + tests[3] + &quot;&quot;)</code>应该返回<code>&quot;&quot; + answers[3] + &quot;&quot;</code>'
testString: 'assert(add12Hours(tests[3]) === answers[3], "Should handel month change in a common years. <code>add12Hours("" + tests[3] + "")</code> should return <code>"" + answers[3] + ""</code>");'
- text: '汉德尔应该改变一年。 <code>add12Hours(&quot;&quot; + tests[4] + &quot;&quot;)</code>应该返回<code>&quot;&quot; + answers[4] + &quot;&quot;</code>'
testString: 'assert(add12Hours(tests[4]) === answers[4], "Should handel year change. <code>add12Hours("" + tests[4] + "")</code> should return <code>"" + answers[4] + ""</code>");'
testString: assert(typeof add12Hours('January 17 2017 11:43am EST') === 'string');
- text: <code>add12Hours(&quot;&quot; + tests[0] + &quot;&quot;)</code>应该返回<code>&quot;&quot; + answers[0] + &quot;&quot;</code>
testString: assert(add12Hours('January 17 2017 11:43am EST') === 'January 17 2017 11:43pm EST');
- text: 汉德尔应该改变一天。 <code>add12Hours(&quot;&quot; + tests[1] + &quot;&quot;)</code>应返回<code>&quot;&quot; + answers[1] + &quot;&quot;</code>
testString: assert(add12Hours('March 7 2009 7:30pm EST') === 'March 8 2009 7:30am EST');
- text: 汉德尔月份应该在闰年中发生变化。 <code>add12Hours(&quot;&quot; + tests[2] + &quot;&quot;)</code>应返回<code>&quot;&quot; + answers[2] + &quot;&quot;</code>
testString: assert(add12Hours('February 29 2004 9:15pm EST') === 'March 1 2004 9:15am EST');
- text: 应该在一个共同的年份改变汉德尔月份。 <code>add12Hours(&quot;&quot; + tests[3] + &quot;&quot;)</code>应该返回<code>&quot;&quot; + answers[3] + &quot;&quot;</code>
testString: assert(add12Hours('February 28 1999 3:15pm EST') === 'March 1 1999 3:15am EST');
- text: 汉德尔应该改变一年。 <code>add12Hours(&quot;&quot; + tests[4] + &quot;&quot;)</code>应该返回<code>&quot;&quot; + answers[4] + &quot;&quot;</code>
testString: assert(add12Hours('December 31 2020 1:45pm EST') === 'January 1 2021 1:45am EST');
```

View File

@@ -19,13 +19,13 @@ localeTitle: 一周中的天
```yml
tests:
- text: <code>findXmasSunday</code>是一个函数。
testString: 'assert(typeof findXmasSunday === "function", "<code>findXmasSunday</code> is a function.");'
testString: assert(typeof findXmasSunday === 'function');
- text: '<code>findChristmasSunday(2000, 2100)</code>应该返回一个数组。'
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>应该回归[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>应该返回[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

@@ -41,15 +41,15 @@ localeTitle: FreeCell的交易卡
```yml
tests:
- text: <code>dealFreeCell</code>是一个功能。
testString: 'assert(typeof dealFreeCell === "function", "<code>dealFreeCell</code> is a function.");'
testString: assert(typeof dealFreeCell === 'function');
- text: <code>dealFreeCell(seed)</code>应该返回一个对象。
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>应该返回一个长度为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>应该返回一个与示例“Game1”相同的数组
testString: 'assert.deepEqual(dealFreeCell(1), game1, "<code>dealFreeCell(1)</code> should return an array identical to example "Game #1"");'
testString: "assert.deepEqual(dealFreeCell(1), game1);"
- text: <code>dealFreeCell(617)</code>应该返回一个与示例“Game617”相同的数组
testString: 'assert.deepEqual(dealFreeCell(617), game617, "<code>dealFreeCell(617)</code> should return an array identical to example "Game #617"");'
testString: "assert.deepEqual(dealFreeCell(617), game617);"
```

View File

@@ -19,15 +19,15 @@ localeTitle: deepcopy的
```yml
tests:
- text: <code>deepcopy</code>应该是一个功能。
testString: 'assert(typeof deepcopy === "function", "<code>deepcopy</code> should be a function.");'
- text: '<code>deepcopy({test: &quot;test&quot;})</code>应返回一个对象。'
testString: 'assert(typeof deepcopy(obj1) === "object", "<code>deepcopy({test: "test"})</code> should return an object.");'
testString: assert(typeof deepcopy === 'function');
- text: '<code>deepcopy({test: "test"})</code>应返回一个对象。'
testString: 'assert(typeof deepcopy(obj1) === ''object'');'
- text: 不应该返回提供的相同对象。
testString: 'assert(deepcopy(obj2) != obj2, "Should not return the same object that was provided.");'
testString: assert(deepcopy(obj2) != obj2);
- text: 传递包含数组的对象时,应返回该对象的深层副本。
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: 传递包含另一个对象的对象时,应返回该对象的深层副本。
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

@@ -19,33 +19,33 @@ localeTitle: 定义原始数据类型
```yml
tests:
- text: <code>Num</code>应该是一个功能。
testString: 'assert(typeof Num === "function", "<code>Num</code> should be a function.");'
testString: assert(typeof Num === 'function');
- text: <code>new Num(4)</code>应返回一个对象。
testString: 'assert(typeof (new Num(4)) === "object", "<code>new Num(4)</code> should return an object.");'
testString: assert(typeof (new Num(4)) === 'object');
- text: '<code>new Num(\&#39;test\&#39;)</code>应抛出一个带有消息“非数字”的TypeError。'
testString: 'assert(throws(() => new Num("test"), TypeError, "Not a Number"), "<code>new Num(\"test\")</code> should throw a TypeError with message \"Not a Number\".");'
testString: assert.throws(() => new Num('test'), TypeError);
- text: <code>new Num(0)</code>应该抛出一个带有消息“超出范围”的TypeError。
testString: 'assert(throws(() => new Num(0), TypeError, "Out of range"), "<code>new Num(0)</code> should throw a TypeError with message \"Out of range\".");'
testString: assert.throws(() => new Num(0), TypeError);
- text: <code>new Num(-5)</code>应该抛出一个带有消息“超出范围”的TypeError。
testString: 'assert(throws(() => new Num(-5), TypeError, "Out of range"), "<code>new Num(-5)</code> should throw a TypeError with message \"Out of range\".");'
testString: assert.throws(() => new Num(-5), TypeError);
- text: <code>new Num(10)</code>应抛出一个带有消息“超出范围”的TypeError。
testString: 'assert(throws(() => new Num(11), TypeError, "Out of range"), "<code>new Num(10)</code> should throw a TypeError with message \"Out of range\".");'
testString: assert.throws(() => new Num(11), TypeError);
- text: <code>new Num(20)</code>应抛出一个带有消息“超出范围”的TypeError。
testString: 'assert(throws(() => new Num(20), TypeError, "Out of range"), "<code>new Num(20)</code> should throw a TypeError with message \"Out of range\".");'
testString: assert.throws(() => new Num(20), TypeError);
- text: <code>new Num(3) + new Num(4)</code>应该等于7。
testString: 'assert.equal(new Num(3) + new Num(4), 7, "<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>应该等于-1。
testString: 'assert.equal(new Num(3) - new Num(4), -1, "<code>new Num(3) - new Num(4)</code> should equal -1.");'
testString: assert.equal(new Num(3) - new Num(4), -1);
- text: <code>new Num(3) * new Num(4)</code>应该等于12。
testString: 'assert.equal(new Num(3) * new Num(4), 12, "<code>new Num(3) * new Num(4)</code> should equal 12.");'
testString: assert.equal(new Num(3) * new Num(4), 12);
- text: <code>new Num(3) / new Num(4)</code>应该等于0.75。
testString: 'assert.equal(new Num(3) / new Num(4), 0.75, "<code>new Num(3) / new Num(4)</code> should equal 0.75.");'
testString: assert.equal(new Num(3) / new Num(4), 0.75);
- text: <code>new Num(3) &lt; new Num(4)</code>应该是真的。
testString: 'assert(new Num(3) < new Num(4), "<code>new Num(3) < new Num(4)</code> should be true.");'
testString: assert(new Num(3) < new Num(4));
- text: <code>new Num(3) &gt; new Num(4)</code>应该是假的。
testString: 'assert(!(new Num(3) > new Num(4)), "<code>new Num(3) > new Num(4)</code> should be false.");'
testString: assert(!(new Num(3) > new Num(4)));
- text: '<code>(new Num(5)).toString()</code>应返回\&#39;5 \&#39;'
testString: 'assert.equal((new Num(5)).toString(), "5", "<code>(new Num(5)).toString()</code> should return \"5\"");'
testString: assert.equal((new Num(5)).toString(), '5');
```

View File

@@ -19,13 +19,13 @@ localeTitle: 部门编号
```yml
tests:
- text: <code>combinations</code>应该是一个功能。
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>应该返回一个数组。'
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>应返回长度为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>应返回所有有效组合。'
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

@@ -19,21 +19,21 @@ localeTitle: Discordian日期
```yml
tests:
- text: <code>discordianDate</code>是一个函数。
testString: 'assert(typeof discordianDate === "function", "<code>discordianDate</code> is a function.");'
- text: '<code>discordianDate(new Date(2010, 6, 22))</code> <code>&quot;Pungenday, the 57th day of Confusion in the YOLD 3176&quot;</code> <code>discordianDate(new Date(2010, 6, 22))</code>应该返回<code>&quot;Pungenday, the 57th day of Confusion in the YOLD 3176&quot;</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>.");'
- text: '<code>discordianDate(new Date(2012, 1, 28))</code>应该返回<code>&quot;Prickle-Prickle, the 59th day of Chaos in the YOLD 3178&quot;</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>.");'
- text: '<code>discordianDate(new Date(2012, 1, 29))</code> <code>&quot;Setting Orange, the 60th day of Chaos in the YOLD 3178. Celebrate St. Tib\&quot;s Day!&quot;</code> <code>discordianDate(new Date(2012, 1, 29))</code>应该返回<code>&quot;Setting Orange, the 60th day of Chaos in the YOLD 3178. Celebrate St. Tib\&quot;s Day!&quot;</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>.");'
- text: '<code>discordianDate(new Date(2012, 2, 1))</code>应该返回<code>&quot;Setting Orange, the 60th day of Chaos in the YOLD 3178&quot;</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>.");'
- text: '<code>discordianDate(new Date(2010, 0, 5))</code> <code>&quot;Setting Orange, the 5th day of Chaos in the YOLD 3176. Celebrate Mungday!&quot;</code> <code>discordianDate(new Date(2010, 0, 5))</code>应该返回<code>&quot;Setting Orange, the 5th day of Chaos in the YOLD 3176. Celebrate Mungday!&quot;</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>.");'
- text: '<code>discordianDate(new Date(2011, 4, 3))</code>应该返回<code>&quot;Pungenday, the 50th day of Discord in the YOLD 3177. Celebrate Discoflux!&quot;</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>.");'
- text: '<code>discordianDate(new Date(2015, 9, 19))</code> <code>&quot;Boomtime, the 73rd day of Bureaucracy in the YOLD 3181&quot;</code> <code>discordianDate(new Date(2015, 9, 19))</code>应该返回<code>&quot;Boomtime, the 73rd day of Bureaucracy in the YOLD 3181&quot;</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(typeof discordianDate === 'function');
- text: <code>discordianDate(new Date(2010, 6, 22))</code> <code>"Pungenday, the 57th day of Confusion in the YOLD 3176"</code> <code>discordianDate(new Date(2010, 6, 22))</code>应该返回<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>应该返回<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> <code>"Setting Orange, the 60th day of Chaos in the YOLD 3178. Celebrate St. Tib's Day!"</code> <code>discordianDate(new Date(2012, 1, 29))</code>应该返回<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>应该返回<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> <code>"Setting Orange, the 5th day of Chaos in the YOLD 3176. Celebrate Mungday!"</code> <code>discordianDate(new Date(2010, 0, 5))</code>应该返回<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>应该返回<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> <code>"Boomtime, the 73rd day of Bureaucracy in the YOLD 3181"</code> <code>discordianDate(new Date(2015, 9, 19))</code>应该返回<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

@@ -19,21 +19,21 @@ localeTitle: 元素操作
```yml
tests:
- text: <code>operation</code>是一种功能。
testString: 'assert(typeof operation === "function", "<code>operation</code> is a function.");'
- text: '<code>operation(&quot;m_add&quot;,[[1,2],[3,4]],[[1,2],[3,4]])</code>应返回<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>.");'
- text: '<code>operation(&quot;s_add&quot;,[[1,2],[3,4]],[[1,2],[3,4]])</code>应返回<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>.");'
- text: '<code>operation(&quot;m_sub&quot;,[[1,2],[3,4]],[[1,2],[3,4]])</code>应返回<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>.");'
- text: '<code>operation(&quot;m_mult&quot;,[[1,2],[3,4]],[[1,2],[3,4]])</code>应该返回<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>.");'
- text: '<code>operation(&quot;m_div&quot;,[[1,2],[3,4]],[[1,2],[3,4]])</code>应返回<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>.");'
- text: '<code>operation(&quot;m_exp&quot;,[[1,2],[3,4]],[[1,2],[3,4]])</code>应返回<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>.");'
- text: '<code>operation(&quot;m_add&quot;,[[1,2,3,4],[5,6,7,8]],[[9,10,11,12],[13,14,15,16]])</code>应该返回<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(typeof operation === 'function');
- text: <code>operation("m_add",[[1,2],[3,4]],[[1,2],[3,4]])</code>应返回<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>应返回<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>应返回<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>应该返回<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>应返回<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>应返回<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>应该返回<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

@@ -19,15 +19,15 @@ localeTitle: Emirp奖金
```yml
tests:
- text: <code>emirps</code>是一个功能。
testString: 'assert(typeof emirps === "function", "<code>emirps</code> is a function.");'
testString: assert(typeof emirps === 'function');
- text: '<code>emirps(20,true)</code>应该返回<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>应该返回<code>948349</code>
testString: 'assert.deepEqual(emirps(10000), 948349, "<code>emirps(10000)</code> should return <code>948349</code>");'
testString: assert.deepEqual(emirps(1000), 70529);
- text: '<code>emirps([7700,8000],true)</code>应该返回<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>应该返回<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

@@ -19,19 +19,19 @@ localeTitle: 熵
```yml
tests:
- text: <code>entropy</code>是一种功能。
testString: 'assert(typeof entropy === "function", "<code>entropy</code> is a function.");'
- text: <code>entropy(&quot;0&quot;)</code>应该返回<code>0</code>
testString: 'assert.equal(entropy("0"), 0, "<code>entropy("0")</code> should return <code>0</code>");'
- text: <code>entropy(&quot;01&quot;)</code>应该返回<code>1</code>
testString: 'assert.equal(entropy("01"), 1, "<code>entropy("01")</code> should return <code>1</code>");'
- text: <code>entropy(&quot;0123&quot;)</code>应该返回<code>2</code>
testString: 'assert.equal(entropy("0123"), 2, "<code>entropy("0123")</code> should return <code>2</code>");'
- text: <code>entropy(&quot;01234567&quot;)</code>应该返回<code>3</code>
testString: 'assert.equal(entropy("01234567"), 3, "<code>entropy("01234567")</code> should return <code>3</code>");'
- text: <code>entropy(&quot;0123456789abcdef&quot;)</code>应返回<code>4</code>
testString: 'assert.equal(entropy("0123456789abcdef"), 4, "<code>entropy("0123456789abcdef")</code> should return <code>4</code>");'
- text: <code>entropy(&quot;1223334444&quot;)</code>应返回<code>1.8464393446710154</code>
testString: 'assert.equal(entropy("1223334444"), 1.8464393446710154, "<code>entropy("1223334444")</code> should return <code>1.8464393446710154</code>");'
testString: assert(typeof entropy === 'function');
- text: <code>entropy("0")</code>应该返回<code>0</code>
testString: assert.equal(entropy('0'), 0);
- text: <code>entropy("01")</code>应该返回<code>1</code>
testString: assert.equal(entropy('01'), 1);
- text: <code>entropy("0123")</code>应该返回<code>2</code>
testString: assert.equal(entropy('0123'), 2);
- text: <code>entropy("01234567")</code>应该返回<code>3</code>
testString: assert.equal(entropy('01234567'), 3);
- text: <code>entropy("0123456789abcdef")</code>应返回<code>4</code>
testString: assert.equal(entropy('0123456789abcdef'), 4);
- text: <code>entropy("1223334444")</code>应返回<code>1.8464393446710154</code>
testString: assert.equal(entropy('1223334444'), 1.8464393446710154);
```

View File

@@ -19,19 +19,19 @@ localeTitle: 均衡指数
```yml
tests:
- text: <code>equilibrium</code>是一种功能。
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> <code>[3,6]</code> <code>equilibrium([-7, 1, 5, 2, -4, 3, 0])</code>应该返回<code>[3,6]</code> 。'
testString: 'assert.deepEqual(equilibrium(tests[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>应该返回<code>[]</code> 。'
testString: 'assert.deepEqual(equilibrium(tests[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>应该返回<code>[1]</code> 。'
testString: 'assert.deepEqual(equilibrium(tests[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>应该返回<code>[0,1,2,3,4,5,6]</code> 。'
testString: 'assert.deepEqual(equilibrium(tests[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>应该返回<code>[0]</code> 。'
testString: 'assert.deepEqual(equilibrium(tests[4]), ans[4], "<code>equilibrium([1])</code> should return <code>[0]</code>.");'
testString: assert.deepEqual(equilibrium(equilibriumTests[4]), ans[4]);
- text: '<code>equilibrium([])</code>应该返回<code>[]</code> 。'
testString: 'assert.deepEqual(equilibrium(tests[5]), ans[5], "<code>equilibrium([])</code> should return <code>[]</code>.");'
testString: assert.deepEqual(equilibrium(equilibriumTests[5]), ans[5]);
```

View File

@@ -19,17 +19,17 @@ localeTitle: 埃塞俄比亚的乘法
```yml
tests:
- text: <code>eth_mult</code>是一个功能。
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>应该返回<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>应该返回<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>应该返回<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>应该返回<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>应该返回<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

@@ -19,15 +19,15 @@ localeTitle: 欧拉方法
```yml
tests:
- text: <code>eulersMethod</code>是一个函数。
testString: 'assert(typeof eulersMethod === "function", "<code>eulersMethod</code> is a function.");'
testString: assert(typeof eulersMethod === 'function');
- text: '<code>eulersMethod(0, 100, 100, 10)</code>应该返回一个数字。'
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>应返回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>应返回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>应返回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

@@ -19,17 +19,17 @@ localeTitle: 评估二项式系数
```yml
tests:
- text: <code>binom</code>是一个功能。
testString: 'assert(typeof binom === "function", "<code>binom</code> is a function.");'
testString: assert(typeof binom === 'function');
- text: '<code>binom(5,3)</code>应该返回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>应该返回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>应该返回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>应该返回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>应该返回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

@@ -7,62 +7,62 @@ localeTitle: 执行马尔可夫算法
---
## Description
<section id="description">任务: <p><a href="https://en.wikipedia.org/wiki/Markov algorithm" title="wp马尔可夫算法">马尔可夫算法</a>创建解释器。 </p><p>规则具有以下语法: </p><p><ruleset> :: = <comment> | <rule> <newline> +* </newline></rule></comment></ruleset></p><p><comment> :: ={ <any character=""> } </any></comment></p><p><rule> :: = <pattern><whitespace> - &gt; <whitespace> [。] <replacement></replacement></whitespace></whitespace></pattern></rule></p><p><whitespace> :: = <tab> | <space> [ <whitespace> ] </whitespace></space></tab></whitespace></p><p>每行有一条规则。 </p><p>如果有的话<b></b> (期间)出席之前<replacement> ,那么这是一个终止规则,在这种情况下,解释器必须停止执行。 </replacement></p><p>规则集由一系列规则和可选注释组成。 </p><p> <big><big>规则集</big></big> </p><p>对条目使用以下测试: </p>规则集1 <pre>此规则文件是从Wikipedia中提取的
http://en.wikipedia.org/wiki/Markov_AlgorithmA - &gt; apple
B - &gt;
S - &gt;
T - &gt;
商店 - &gt;我的兄弟
一个从未使用过的 - &gt;。终止规则
</pre><p>示例文本: </p><p> <code>I bought a B of As from T S.</code> </p> <p>应该生成输出: </p><p> <code>I bought a bag of apples from my brother.</code> </p>规则集2 <p>终止规则的测试</p><pre>从维基百科的规则略有修改 - &gt;苹果
B - &gt;
S - &gt; .shop
T - &gt;
商店 - &gt;我的兄弟
一个从未使用过的 - &gt;。终止规则</pre><p>示例文本: </p><p> <code>I bought a B of As from T S.</code> </p> <p>应该生成: </p><p> <code>I bought a bag of apples from T shop.</code> </p>规则集3 <p>如果没有转义特殊的正则表达式字符,这将测试正确的替换顺序并可能捕获简单的基于正则表达式的替换例程。 </p><pre> BNF语法测试规则A - &gt; apple
WWWW - &gt;
行李 - &gt; - &gt;。*
B - &gt;
- &gt;。* - &gt;
W - &gt; WW
S - &gt; .shop
T - &gt;
商店 - &gt;我的兄弟
一个从未使用过的 - &gt;。终止规则
<section id="description">任务: <p><a href="https://en.wikipedia.org/wiki/Markov algorithm" title="wp马尔可夫算法">马尔可夫算法</a>创建解释器。 </p><p>规则具有以下语法: </p><p><ruleset> :: = <comment> | <rule> <newline> +* </newline></rule></comment></ruleset></p><p><comment> :: ={ <any character=""> } </any></comment></p><p><rule> :: = <pattern><whitespace> - > <whitespace> [。] <replacement></replacement></whitespace></whitespace></pattern></rule></p><p><whitespace> :: = <tab> | <space> [ <whitespace> ] </whitespace></space></tab></whitespace></p><p>每行有一条规则。 </p><p>如果有的话<b></b> (期间)出席之前<replacement> ,那么这是一个终止规则,在这种情况下,解释器必须停止执行。 </replacement></p><p>规则集由一系列规则和可选注释组成。 </p><p> <big><big>规则集</big></big> </p><p>对条目使用以下测试: </p>规则集1 <pre>此规则文件是从Wikipedia中提取的
http://en.wikipedia.org/wiki/Markov_AlgorithmA - > apple
B - >
S - >
T - >
商店 - >我的兄弟
一个从未使用过的 - >。终止规则
</pre><p>示例文本: </p><p> <code>I bought a B of As from T S.</code> </p> <p>应该生成输出: </p><p> <code>I bought a bag of apples from my brother.</code> </p>规则集2 <p>终止规则的测试</p><pre>从维基百科的规则略有修改 - >苹果
B - >
S - > .shop
T - >
商店 - >我的兄弟
一个从未使用过的 - >。终止规则</pre><p>示例文本: </p><p> <code>I bought a B of As from T S.</code> </p> <p>应该生成: </p><p> <code>I bought a bag of apples from T shop.</code> </p>规则集3 <p>如果没有转义特殊的正则表达式字符,这将测试正确的替换顺序并可能捕获简单的基于正则表达式的替换例程。 </p><pre> BNF语法测试规则A - > apple
WWWW - >
行李 - > - >。*
B - >
- >。* - >
W - > WW
S - > .shop
T - >
商店 - >我的兄弟
一个从未使用过的 - >。终止规则
</pre><p>示例文本: </p><p> <code>I bought a B of As W my Bgage from T S.</code> </p> <p>应该生成: </p><p> <code>I bought a bag of apples with my money from T shop.</code> </p>规则集4 <p>这将测试规则扫描的正确顺序,并可能捕获以错误顺序扫描的替换例程。它实现了一般的一元乘法引擎。 (请注意,在此实现中,输入表达式必须放在下划线中。) </p><pre> ##一元乘法引擎,用于测试马尔可夫算法实现
## Donal Fellows。
一元加法引擎_ + 1 - &gt; _1 +
1 + 1 - &gt; 11+
一元加法引擎_ + 1 - > _1 +
1 + 1 - > 11+
通过将乘法的分裂转换为普通的
addition1 - &gt;1
- &gt;+
_ - &gt; _
通过复制左侧右侧乘以1 * 1 - &gt; x@ y进行一元乘法
1x - &gt; xX
X - &gt; 1,1
X1 - &gt; 1X
_x - &gt; _X
x - &gt;X
y1 - &gt; 1y
y_ - &gt; _
apply1 @ 1 - &gt; x@ y的下一阶段
1 @ _ - &gt; @_
@ _ - &gt;_
++ - &gt; +
添加终止清除_1 - &gt; 1
1 + _ - &gt; 1
_ + _ - &gt;
addition1 - >1
- >+
_ - > _
通过复制左侧右侧乘以1 * 1 - > x@ y进行一元乘法
1x - > xX
X - > 1,1
X1 - > 1X
_x - > _X
x - >X
y1 - > 1y
y_ - > _
apply1 @ 1 - > x@ y的下一阶段
1 @ _ - > @_
@ _ - >_
++ - > +
添加终止清除_1 - > 1
1 + _ - > 1
_ + _ - >
</pre><p>示例文本: </p><p> <code>_1111*11111_</code> </p> <p>应该生成输出: </p><p> <code>11111111111111111111</code> </p>规则集5 <p>一台简单的<a href="http://en.wikipedia.org/wiki/Turing_machine" title="链接http//en.wikipedia.org/wiki/Turing_machine">图灵机</a> </p><p>实施三态<a href="http://en.wikipedia.org/wiki/Busy_beaver" title="链接http//en.wikipedia.org/wiki/Busy_beaver">繁忙的海狸</a></p><p>磁带由0和1组成状态为ABC和H对于Halt并且通过在头部所在的字符之前写入状态字母来指示磁头位置。 </p><p>必须在输入中给出机器操作的初始磁带的所有部分。 </p><p>除了证明Markov算法是Turing-complete之外它还让我抓住了C ++实现中的一个错误,这个错误没有被前四个规则集捕获。 </p><pre>图灵机:三态繁忙的海狸
#sta A符号0 =&gt;写1向右移动新状态BA0 - &gt; 1B
状态A符号1 =&gt;写1向左移动新状态C0A1 - &gt; C01
1A1 - &gt; C11
状态B符号0 =&gt;写1向左移动新状态A0B0 - &gt; A01
1B0 - &gt; A11
状态B符号1 =&gt;写1向右移动新状态BB1 - &gt; 1B
状态C符号0 =&gt;写1向左移动新状态B0C0 - &gt; B01
1C0 - &gt; B11
状态C符号1 =&gt;写1向左移动停止0C1 - &gt; H01
1C1 - &gt; H11
#sta A符号0 =>写1向右移动新状态BA0 - > 1B
状态A符号1 =>写1向左移动新状态C0A1 - > C01
1A1 - > C11
状态B符号0 =>写1向左移动新状态A0B0 - > A01
1B0 - > A11
状态B符号1 =>写1向右移动新状态BB1 - > 1B
状态C符号0 =>写1向左移动新状态B0C0 - > B01
1C0 - > B11
状态C符号1 =>写1向左移动停止0C1 - > H01
1C1 - > H11
</pre><p>这个规则集应该转向</p><p> <code>000000A000000</code> </p> <p></p><p> <code>00011H1111000</code> </p> </section>
## Instructions
@@ -75,17 +75,17 @@ _ + _ - &gt;
```yml
tests:
- text: <code>markov</code>是一个功能。
testString: 'assert(typeof markov === "function", "<code>markov</code> is a function.");'
- text: '<code>markov([&quot;A -&gt; apple&quot;,&quot;B -&gt; bag&quot;,&quot;S -&gt; shop&quot;,&quot;T -&gt; the&quot;,&quot;the shop -&gt; my brother&quot;,&quot;a never used -&gt; .terminating rule&quot;],&quot;I bought a B of As from T S.&quot;)</code>应该回复“我从我兄弟那里买了一袋苹果”。'
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.".");'
- text: '<code>markov([&quot;A -&gt; apple&quot;,&quot;B -&gt; bag&quot;,&quot;S -&gt; .shop&quot;,&quot;T -&gt; the&quot;,&quot;the shop -&gt; my brother&quot;,&quot;a never used -&gt; .terminating rule&quot;],&quot;I bought a B of As from T S.&quot;)</code>应该回来“我从T商店买了一袋苹果。”'
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.".");'
- text: '<code>markov([&quot;A -&gt; apple&quot;,&quot;WWWW -&gt; with&quot;,&quot;Bgage -&gt; -&gt;.*&quot;,&quot;B -&gt; bag&quot;,&quot;-&gt;.* -&gt; money&quot;,&quot;W -&gt; WW&quot;,&quot;S -&gt; .shop&quot;,&quot;T -&gt; the&quot;,&quot;the shop -&gt; my brother&quot;,&quot;a never used -&gt; .terminating rule&quot;],&quot;I bought a B of As W my Bgage from T S.&quot;)</code>应该返回”我从T商店用我的钱买了一袋苹果。“'
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.".");'
- text: '<code>markov([&quot;_+1 -&gt; _1+&quot;,&quot;1+1 -&gt; 11+&quot;,&quot;1! -&gt; !1&quot;,&quot;,! -&gt; !+&quot;,&quot;_! -&gt; _&quot;,&quot;1*1 -&gt; x,@y&quot;,&quot;1x -&gt; xX&quot;,&quot;X, -&gt; 1,1&quot;,&quot;X1 -&gt; 1X&quot;,&quot;_x -&gt; _X&quot;,&quot;,x -&gt; ,X&quot;,&quot;y1 -&gt; 1y&quot;,&quot;y_ -&gt; _&quot;,&quot;1@1 -&gt; x,@y&quot;,&quot;1@_ -&gt; @_&quot;,&quot;,@_ -&gt; !_&quot;,&quot;++ -&gt; +&quot;,&quot;_1 -&gt; 1&quot;,&quot;1+_ -&gt; 1&quot;,&quot;_+_ -&gt; &quot;],&quot;_1111*11111_&quot;)</code>应返回”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".");'
- text: '<code>markov([&quot;A0 -&gt; 1B&quot;,&quot;0A1 -&gt; C01&quot;,&quot;1A1 -&gt; C11&quot;,&quot;0B0 -&gt; A01&quot;,&quot;1B0 -&gt; A11&quot;,&quot;B1 -&gt; 1B&quot;,&quot;0C0 -&gt; B01&quot;,&quot;1C0 -&gt; B11&quot;,&quot;0C1 -&gt; H01&quot;,&quot;1C1 -&gt; H11&quot;],&quot;&quot;)</code>应返回”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(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>应该回复“我从我兄弟那里买了一袋苹果”。
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>应该回来“我从T商店买了一袋苹果。”
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>应该返回”我从T商店用我的钱买了一袋苹果。“
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>应返回”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>应返回”00011H1111000“。
testString: assert.deepEqual(markov(rules[4],tests[4]),outputs[4]);
```

View File

@@ -19,15 +19,15 @@ localeTitle: 执行大脑****
```yml
tests:
- text: <code>brain(bye)</code>应该重新调整一个字符串
testString: 'assert(typeof brain(bye) === "string", "<code>brain(bye)</code> should return a string");'
- text: '<code>brain("++++++[>++++++++++<-]>+++++.")</code should return "A"'
testString: 'assert.equal(brain("++++++[>++++++++++<-]>+++++."),"A", "<code>brain("++++++[>++++++++++<-]>+++++.")</code should return "A"");'
- text: '<code>brain(bye)</code>应该回归<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>应该回归<code>Hello World!\\n</code> &#39;'
testString: 'assert.equal(brain(hello), "Hello World!\n", "<code>brain(hello)</code> should return <code>Hello World!\\n</code>");'
- text: '<code>brain(fib)</code>应该返回<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(typeof brain(bye) === 'string');
- text: <code>brain("++++++[>++++++++++<-]>+++++.")</code should return "A"
testString: assert.equal(brain("++++++[>++++++++++<-]>+++++."),"A");
- text: <code>brain(bye)</code>应该回归<code>Goodbye, World!\\r\\n</code>
testString: assert.equal(brain(bye), 'Goodbye, World!\r\n');
- text: <code>brain(hello)</code>应该回归<code>Hello World!\\n</code>
testString: assert.equal(brain(hello), "Hello World!\n");
- text: <code>brain(fib)</code>应该返回<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

@@ -19,15 +19,15 @@ localeTitle: 可扩展的素发生器
```yml
tests:
- text: <code>primeGenerator</code>是一个函数。
testString: 'assert(typeof primeGenerator === "function", "<code>primeGenerator</code> is a function.");'
testString: assert(typeof primeGenerator === 'function');
- text: <code>primeGenerator</code>是一个函数。
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>是一个函数。
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>是一个函数。
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>是一个函数。
testString: 'assert.equal(primeGenerator(10000, false), 104729, "<code>primeGenerator</code> is a function.");'
testString: assert.equal(primeGenerator(10000, false), 104729);
```

View File

@@ -19,15 +19,15 @@ localeTitle: 阶乘
```yml
tests:
- text: <code>factorial</code>是一种功能。
testString: 'assert(typeof factorial === "function", "<code>factorial</code> is a function.");'
testString: assert(typeof factorial === 'function');
- text: <code>factorial(2)</code>应该返回一个数字。
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>应该返回6.“)
testString: 'assert.equal(factorial(3),results[0],"<code>factorial(3)</code> should return 6.");'
testString: assert.equal(factorial(3), 6);
- text: <code>factorial(3)</code>应返回120.“)
testString: 'assert.equal(factorial(5),results[1],"<code>factorial(3)</code> should return 120.");'
testString: assert.equal(factorial(5), 120);
- text: '<code>factorial(3)</code>应返回3,628,800。“'
testString: 'assert.equal(factorial(10),results[2],"<code>factorial(3)</code> should return 3,628,800.");'
testString: assert.equal(factorial(10), 3628800);
```

View File

@@ -19,15 +19,15 @@ localeTitle: 梅森数的因素
```yml
tests:
- text: <code>check_mersenne</code>是一个函数。
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>应该返回一个字符串。
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>应该返回“M3 = 2 ^ 3-1是素数”。
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>应返回“M23 = 2 ^ 23-1与因子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>应返回“M929 = 2 ^ 929-1与因子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

@@ -19,13 +19,13 @@ localeTitle: 整数因子
```yml
tests:
- text: <code>factors</code>是一种功能。
testString: 'assert(typeof factors === "function", "<code>factors</code> is a function.");'
testString: assert(typeof factors === 'function');
- text: '<code>factors(45)</code>应该返回<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>应该返回<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>应该返回<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

@@ -19,15 +19,15 @@ localeTitle: Farey序列
```yml
tests:
- text: <code>farey</code>是一种功能。
testString: 'assert(typeof farey === "function", "<code>farey</code> is a function.");'
testString: assert(typeof farey === 'function');
- text: <code>farey(3)</code>应该返回一个数组
testString: 'assert(Array.isArray(farey(3)), "<code>farey(3)</code> should return an array");'
- text: '<code>farey(3)</code>应该返回<code>[&quot;1/3&quot;,&quot;1/2&quot;,&quot;2/3&quot;]</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>");'
- text: '<code>farey(4)</code>应该返回<code>[&quot;1/4&quot;,&quot;1/3&quot;,&quot;1/2&quot;,&quot;2/4&quot;,&quot;2/3&quot;,&quot;3/4&quot;]</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>");'
- text: '<code>farey(5)</code>应返回<code>[&quot;1/5&quot;,&quot;1/4&quot;,&quot;1/3&quot;,&quot;2/5&quot;,&quot;1/2&quot;,&quot;2/4&quot;,&quot;3/5&quot;,&quot;2/3&quot;,&quot;3/4&quot;,&quot;4/5&quot;]</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(Array.isArray(farey(3)));
- text: <code>farey(3)</code>应该返回<code>["1/3","1/2","2/3"]</code>
testString: assert.deepEqual(farey(3), ["1/3","1/2","2/3"]);
- text: <code>farey(4)</code>应该返回<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>应返回<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

@@ -3,7 +3,7 @@ title: Fibonacci n-step number sequences
id: 598eef80ba501f1268170e1e
challengeType: 5
videoUrl: ''
localeTitle: ''
localeTitle: 斐波那契n步数序列
---
## Description
@@ -19,21 +19,21 @@ localeTitle: ''
```yml
tests:
- text: <code>fib_luc</code>是一个功能。
testString: 'assert(typeof fib_luc === "function", "<code>fib_luc</code> is a function.");'
- text: '<code>fib_luc(2,10,&quot;f&quot;)</code>应返回<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>.");'
- text: '<code>fib_luc(3,15,&quot;f&quot;)</code>应返回<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>.");'
- text: '<code>fib_luc(4,15,&quot;f&quot;)</code>应返回<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>.");'
- text: '<code>fib_luc(2,10,&quot;l&quot;)</code>应返回<code>[ 2, 1, 3, 4, 7, 11, 18, 29, 47, 76]</code> <code>fib_luc(2,10,&quot;l&quot;)</code> <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>.");'
- text: '<code>fib_luc(3,15,&quot;l&quot;)</code>应返回<code>[ 2, 1, 3, 6, 10, 19, 35, 64, 118, 217, 399, 734, 1350, 2483, 4567 ]</code> <code>fib_luc(3,15,&quot;l&quot;)</code> <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>.");'
- text: '<code>fib_luc(4,15,&quot;l&quot;)</code>应该返回<code>[ 2, 1, 3, 6, 12, 22, 43, 83, 160, 308, 594, 1145, 2207, 4254, 8200 ]</code> <code>fib_luc(4,15,&quot;l&quot;)</code> <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>.");'
- text: '<code>fib_luc(5,15,&quot;l&quot;)</code>应该返回<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(typeof fib_luc === 'function');
- text: <code>fib_luc(2,10,"f")</code>应返回<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>应返回<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>应返回<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>应返回<code>[ 2, 1, 3, 4, 7, 11, 18, 29, 47, 76]</code> <code>fib_luc(2,10,"l")</code> <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>应返回<code>[ 2, 1, 3, 6, 10, 19, 35, 64, 118, 217, 399, 734, 1350, 2483, 4567 ]</code> <code>fib_luc(3,15,"l")</code> <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>应该返回<code>[ 2, 1, 3, 6, 12, 22, 43, 83, 160, 308, 594, 1145, 2207, 4254, 8200 ]</code> <code>fib_luc(4,15,"l")</code> <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>应该返回<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

@@ -19,15 +19,15 @@ localeTitle: 斐波那契序列
```yml
tests:
- text: <code>fibonacci</code>是一种功能。
testString: 'assert(typeof fibonacci === "function", "<code>fibonacci</code> is a function.");'
testString: assert(typeof fibonacci === 'function');
- text: <code>fibonacci(2)</code>应该返回一个数字。
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>应该返回1.“)
testString: 'assert.equal(fibonacci(3),1,"<code>fibonacci(3)</code> should return 1.");'
testString: assert.equal(fibonacci(3),1);
- text: <code>fibonacci(5)</code>应该返回3.“)
testString: 'assert.equal(fibonacci(5),3,"<code>fibonacci(5)</code> should return 3.");'
testString: assert.equal(fibonacci(5),3);
- text: <code>fibonacci(10)</code>应该返回34.“)
testString: 'assert.equal(fibonacci(10),34,"<code>fibonacci(10)</code> should return 34.");'
testString: assert.equal(fibonacci(10),34);
```

View File

@@ -19,11 +19,11 @@ localeTitle: 斐波那契字
```yml
tests:
- text: <code>fibWord</code>是一个功能。
testString: 'assert(typeof fibWord === "function", "<code>fibWord</code> is a function.");'
testString: assert(typeof fibWord === 'function');
- text: <code>fibWord(5)</code>应该返回一个数组。
testString: 'assert(Array.isArray(fibWord(5)),"<code>fibWord(5)</code> should return an array.");'
testString: assert(Array.isArray(fibWord(5)));
- text: '<code>fibWord(5)</code>应该返回<code>&#39;+JSON.stringify(ans)+&#39;</code> 。'
testString: 'assert.deepEqual(fibWord(5),ans,"<code>fibWord(5)</code> should return <code>"+JSON.stringify(ans)+"</code>.");'
testString: assert.deepEqual(fibWord(5),ans);
```

View File

@@ -19,19 +19,19 @@ localeTitle: Fractran
```yml
tests:
- text: <code>fractran</code>应该是一个功能。
testString: 'assert(typeof fractran=="function","<code>fractran</code> should be a function.");'
testString: assert(typeof fractran=='function');
- text: '<code>fractran(&quot;&quot;+tests[0]+&quot;&quot;)</code>应该返回一个数组。'
testString: 'assert(Array.isArray(fractran(tests[0])),"<code>fractran(""+tests[0]+"")</code> should return an array.");'
testString: assert(Array.isArray(fractran('3/2, 1/3')));
- text: '<code>fractran(&quot;&quot;+tests[0]+&quot;&quot;)</code>应返回<code>&quot;+JSON.stringify(results[0])+&quot;</code> 。'
testString: 'assert.deepEqual(fractran(tests[0]),results[0],"<code>fractran(""+tests[0]+"")</code> should return <code>"+JSON.stringify(results[0])+"</code>.");'
testString: assert.deepEqual(fractran('3/2, 1/3'), [ 2, 3, 1 ]);
- text: '<code>fractran(&quot;&quot;+tests[1]+&quot;&quot;)</code>应返回<code>&quot;+JSON.stringify(results[1])+&quot;</code> 。'
testString: 'assert.deepEqual(fractran(tests[1]),results[1],"<code>fractran(""+tests[1]+"")</code> should return <code>"+JSON.stringify(results[1])+"</code>.");'
testString: assert.deepEqual(fractran('3/2, 5/3, 1/5'), [ 2, 3, 5, 1 ]);
- text: '<code>fractran(&quot;&quot;+tests[2]+&quot;&quot;)</code>应返回<code>&quot;+JSON.stringify(results[2])+&quot;</code> 。'
testString: 'assert.deepEqual(fractran(tests[2]),results[2],"<code>fractran(""+tests[2]+"")</code> should return <code>"+JSON.stringify(results[2])+"</code>.");'
testString: assert.deepEqual(fractran('3/2, 6/3'), [ 2, 3, 6, 9, 18, 27, 54, 81, 162, 243 ]);
- text: '<code>fractran(&quot;&quot;+tests[3]+&quot;&quot;)</code>应返回<code>&quot;+JSON.stringify(results[3])+&quot;</code> 。'
testString: 'assert.deepEqual(fractran(tests[3]),results[3],"<code>fractran(""+tests[3]+"")</code> should return <code>"+JSON.stringify(results[3])+"</code>.");'
testString: assert.deepEqual(fractran('2/7, 7/2'), [ 2, 7, 2, 7, 2, 7, 2, 7, 2, 7 ]);
- text: '<code>fractran(&quot;&quot;+tests[4]+&quot;&quot;)</code>应返回<code>&quot;+JSON.stringify(results[4])+&quot;</code> 。'
testString: 'assert.deepEqual(fractran(tests[4]),results[4],"<code>fractran(""+tests[4]+"")</code> should return <code>"+JSON.stringify(results[4])+"</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

@@ -19,19 +19,19 @@ localeTitle: 伽玛功能
```yml
tests:
- text: <code>gamma</code>应该是一个功能。
testString: 'assert(typeof gamma=="function","<code>gamma</code> should be a function.")'
testString: assert(typeof gamma=='function')
- text: '<code>gamma(&quot;+tests[0]+&quot;)</code>应该返回一个数字。'
testString: 'assert(typeof gamma(tests[0])=="number","<code>gamma("+tests[0]+")</code> should return a number.")'
testString: assert(typeof gamma(.1)=='number')
- text: '<code>gamma(&quot;+tests[0]+&quot;)</code>应该返回<code>&quot;+results[0]+&quot;</code> 。'
testString: 'assert.equal(gamma(tests[0]),results[0],"<code>gamma("+tests[0]+")</code> should return <code>"+results[0]+"</code>.")'
testString: assert.equal(round(gamma(.1)), round(9.513507698668736))
- text: '<code>gamma(&quot;+tests[1]+&quot;)</code>应该返回<code>&quot;+results[1]+&quot;</code> 。'
testString: 'assert.equal(gamma(tests[1]),results[1],"<code>gamma("+tests[1]+")</code> should return <code>"+results[1]+"</code>.")'
testString: assert.equal(round(gamma(.2)), round(4.590843711998803))
- text: '<code>gamma(&quot;+tests[2]+&quot;)</code>应该返回<code>&quot;+results[2]+&quot;</code> 。'
testString: 'assert.equal(gamma(tests[2]),results[2],"<code>gamma("+tests[2]+")</code> should return <code>"+results[2]+"</code>.")'
testString: assert.equal(round(gamma(.3)), round(2.9915689876875904))
- text: '<code>gamma(&quot;+tests[3]+&quot;)</code>应该返回<code>&quot;+results[3]+&quot;</code> 。'
testString: 'assert.equal(gamma(tests[3]),results[3],"<code>gamma("+tests[3]+")</code> should return <code>"+results[3]+"</code>.")'
testString: assert.equal(round(gamma(.4)), round(2.218159543757687))
- text: '<code>gamma(&quot;+tests[4]+&quot;)</code>应返回<code>&quot;+results[4]+&quot;</code> 。'
testString: 'assert.equal(gamma(tests[4]),results[4],"<code>gamma("+tests[4]+")</code> should return <code>"+results[4]+"</code>.")'
testString: assert.equal(round(gamma(.5)), round(1.7724538509055159))
```

View File

@@ -19,19 +19,19 @@ localeTitle: 高斯消除
```yml
tests:
- text: <code>gaussianElimination</code>应该是一个函数。
testString: 'assert(typeof gaussianElimination=="function","<code>gaussianElimination</code> should be a function.");'
testString: assert(typeof gaussianElimination=='function');
- text: '<code>gaussianElimination(&quot;+JSON.stringify(tests[0][0])+&quot;,&quot;+JSON.stringify(tests[0][1])+&quot;)</code>应该返回一个数组。'
testString: 'assert(Array.isArray(gaussianElimination(tests[0][0],tests[0][1])),"<code>gaussianElimination("+JSON.stringify(tests[0][0])+","+JSON.stringify(tests[0][1])+")</code> should return an array.");'
testString: assert(Array.isArray(gaussianElimination([[1,1],[1,-1]], [5,1])));
- text: '<code>gaussianElimination(&quot;+JSON.stringify(tests[0][0])+&quot;,&quot;+JSON.stringify(tests[0][1])+&quot;)</code>应返回<code>&quot;+JSON.stringify(results[0])+&quot;</code> 。'
testString: 'assert.deepEqual(gaussianElimination(tests[0][0],tests[0][1]),results[0],"<code>gaussianElimination("+JSON.stringify(tests[0][0])+","+JSON.stringify(tests[0][1])+")</code> should return <code>"+JSON.stringify(results[0])+"</code>.");'
testString: assert.deepEqual(gaussianElimination([[1,1],[1,-1]], [5,1]), [ 3, 2 ]);
- text: '<code>gaussianElimination(&quot;+JSON.stringify(tests[1][0])+&quot;,&quot;+JSON.stringify(tests[1][1])+&quot;)</code>应返回<code>&quot;+JSON.stringify(results[1])+&quot;</code> 。'
testString: 'assert.deepEqual(gaussianElimination(tests[1][0],tests[1][1]),results[1],"<code>gaussianElimination("+JSON.stringify(tests[1][0])+","+JSON.stringify(tests[1][1])+")</code> should return <code>"+JSON.stringify(results[1])+"</code>.");'
testString: assert.deepEqual(gaussianElimination([[2,3],[2,1]] , [8,4]), [ 1, 2 ]);
- text: '<code>gaussianElimination(&quot;+JSON.stringify(tests[2][0])+&quot;,&quot;+JSON.stringify(tests[2][1])+&quot;)</code>应返回<code>&quot;+JSON.stringify(results[2])+&quot;</code> 。'
testString: 'assert.deepEqual(gaussianElimination(tests[2][0],tests[2][1]),results[2],"<code>gaussianElimination("+JSON.stringify(tests[2][0])+","+JSON.stringify(tests[2][1])+")</code> should return <code>"+JSON.stringify(results[2])+"</code>.");'
testString: assert.deepEqual(gaussianElimination([[1,3],[5,-2]], [14,19]), [ 5, 3 ]);
- text: '<code>gaussianElimination(&quot;+JSON.stringify(tests[3][0])+&quot;,&quot;+JSON.stringify(tests[3][1])+&quot;)</code>应返回<code>&quot;+JSON.stringify(results[3])+&quot;</code> 。'
testString: 'assert.deepEqual(gaussianElimination(tests[3][0],tests[3][1]),results[3],"<code>gaussianElimination("+JSON.stringify(tests[3][0])+","+JSON.stringify(tests[3][1])+")</code> should return <code>"+JSON.stringify(results[3])+"</code>.");'
testString: assert.deepEqual(gaussianElimination([[1,1],[5,-1]] , [10,14]), [ 4, 6 ]);
- text: '<code>gaussianElimination(&quot;+JSON.stringify(tests[4][0])+&quot;,&quot;+JSON.stringify(tests[4][1])+&quot;)</code>应返回<code>&quot;+JSON.stringify(results[4])+&quot;</code> 。'
testString: 'assert.deepEqual(gaussianElimination(tests[4][0],tests[4][1]),results[4],"<code>gaussianElimination("+JSON.stringify(tests[4][0])+","+JSON.stringify(tests[4][1])+")</code> should return <code>"+JSON.stringify(results[4])+"</code>.");'
testString: assert.deepEqual(gaussianElimination([[1,2,3],[4,5,6],[7,8,8]] , [6,15,23]), [ 1, 1, 1 ]);
```

View File

@@ -7,7 +7,7 @@ localeTitle: 一般的FizzBuzz
---
## Description
<section id="description">编写<a href="http://rosettacode.org/wiki/FizzBuzz">FizzBuzz</a>的通用版本适用于任何因子列表及其单词。这基本上是一种“fizzbuzz”实现其中游戏规则被提供给用户。创建一个实现此功能的函数。该函数应该有两个参数。第一个是带有FizzBuzz规则的数组。例如 <code>[ [3,&quot;Fizz&quot;] , [5,&quot;Buzz&quot;] ]</code> 。此indcates该<code>Fizz</code> 如果数量是3的倍数并应被打印<code>Buzz</code>如果是5的倍数。如果它是两则字符串应该在阵列中指定的顺序被连结的倍数。在这种情况下如果数字是3和5的倍数则为<code>FizzBuzz</code> 。第二个参数是函数应返回如上所述的字符串的数字。 </section>
<section id="description">编写<a href="http://rosettacode.org/wiki/FizzBuzz">FizzBuzz</a>的通用版本适用于任何因子列表及其单词。这基本上是一种“fizzbuzz”实现其中游戏规则被提供给用户。创建一个实现此功能的函数。该函数应该有两个参数。第一个是带有FizzBuzz规则的数组。例如 <code>[ [3,"Fizz"] , [5,"Buzz"] ]</code> 。此indcates该<code>Fizz</code> 如果数量是3的倍数并应被打印<code>Buzz</code>如果是5的倍数。如果它是两则字符串应该在阵列中指定的顺序被连结的倍数。在这种情况下如果数字是3和5的倍数则为<code>FizzBuzz</code> 。第二个参数是函数应返回如上所述的字符串的数字。 </section>
## Instructions
<section id="instructions">
@@ -19,23 +19,23 @@ localeTitle: 一般的FizzBuzz
```yml
tests:
- text: <code>genFizzBuzz</code>应该是一个功能。
testString: 'assert(typeof genFizzBuzz=="function","<code>genFizzBuzz</code> should be a function.");'
- text: '<code>genFizzBuzz(&quot;+JSON.stringify(tests[0][0])+&quot;,&quot;+tests[0][1]+&quot;)</code>应该返回一个类型。'
testString: 'assert(typeof genFizzBuzz(tests[0][0],tests[0][1])=="string","<code>genFizzBuzz("+JSON.stringify(tests[0][0])+","+tests[0][1]+")</code> should return a type.");'
- text: '<code>genFizzBuzz(&quot;+JSON.stringify(tests[0][0])+&quot;,&quot;+tests[0][1]+&quot;)</code>应返回<code>&quot;&quot;+results[0]+&quot;&quot;</code> 。'
testString: 'assert.equal(genFizzBuzz(tests[0][0],tests[0][1]),results[0],"<code>genFizzBuzz("+JSON.stringify(tests[0][0])+","+tests[0][1]+")</code> should return <code>""+results[0]+""</code>.");'
- text: '<code>genFizzBuzz(&quot;+JSON.stringify(tests[1][0])+&quot;,&quot;+tests[1][1]+&quot;)</code>应返回<code>&quot;&quot;+results[1]+&quot;&quot;</code> 。'
testString: 'assert.equal(genFizzBuzz(tests[1][0],tests[1][1]),results[1],"<code>genFizzBuzz("+JSON.stringify(tests[1][0])+","+tests[1][1]+")</code> should return <code>""+results[1]+""</code>.");'
- text: '<code>genFizzBuzz(&quot;+JSON.stringify(tests[2][0])+&quot;,&quot;+tests[2][1]+&quot;)</code>应返回<code>&quot;&quot;+results[2]+&quot;&quot;</code> 。'
testString: 'assert.equal(genFizzBuzz(tests[2][0],tests[2][1]),results[2],"<code>genFizzBuzz("+JSON.stringify(tests[2][0])+","+tests[2][1]+")</code> should return <code>""+results[2]+""</code>.");'
- text: '<code>genFizzBuzz(&quot;+JSON.stringify(tests[3][0])+&quot;,&quot;+tests[3][1]+&quot;)</code>应返回<code>&quot;&quot;+results[3]+&quot;&quot;</code> 。'
testString: 'assert.equal(genFizzBuzz(tests[3][0],tests[3][1]),results[3],"<code>genFizzBuzz("+JSON.stringify(tests[3][0])+","+tests[3][1]+")</code> should return <code>""+results[3]+""</code>.");'
- text: '<code>genFizzBuzz(&quot;+JSON.stringify(tests[4][0])+&quot;,&quot;+tests[4][1]+&quot;)</code>应该返回<code>&quot;&quot;+results[4]+&quot;&quot;</code> 。'
testString: 'assert.equal(genFizzBuzz(tests[4][0],tests[4][1]),results[4],"<code>genFizzBuzz("+JSON.stringify(tests[4][0])+","+tests[4][1]+")</code> should return <code>""+results[4]+""</code>.");'
- text: '<code>genFizzBuzz(&quot;+JSON.stringify(tests[5][0])+&quot;,&quot;+tests[5][1]+&quot;)</code>应返回<code>&quot;&quot;+results[5]+&quot;&quot;</code> 。'
testString: 'assert.equal(genFizzBuzz(tests[5][0],tests[5][1]),results[5],"<code>genFizzBuzz("+JSON.stringify(tests[5][0])+","+tests[5][1]+")</code> should return <code>""+results[5]+""</code>.");'
- text: '<code>genFizzBuzz(&quot;+JSON.stringify(tests[6][0])+&quot;,&quot;+tests[6][1]+&quot;)</code>应该返回<code>&quot;&quot;+results[6]+&quot;&quot;</code> 。'
testString: 'assert.equal(genFizzBuzz(tests[6][0],tests[6][1]),results[6],"<code>genFizzBuzz("+JSON.stringify(tests[6][0])+","+tests[6][1]+")</code> should return <code>""+results[6]+""</code>.");'
testString: assert(typeof genFizzBuzz=='function');
- text: <code>genFizzBuzz("+JSON.stringify(tests[0][0])+","+tests[0][1]+")</code>应该返回一个类型。
testString: assert(typeof genFizzBuzz([[3, "Fizz"],[5, "Buzz"]], 6)=='string');
- text: <code>genFizzBuzz("+JSON.stringify(tests[0][0])+","+tests[0][1]+")</code>应返回<code>""+results[0]+""</code> 。
testString: assert.equal(genFizzBuzz([[3, "Fizz"],[5, "Buzz"]], 6), "Fizz");
- text: <code>genFizzBuzz("+JSON.stringify(tests[1][0])+","+tests[1][1]+")</code>应返回<code>""+results[1]+""</code> 。
testString: assert.equal(genFizzBuzz([[3, "Fizz"],[5, "Buzz"]], 10), "Buzz");
- text: <code>genFizzBuzz("+JSON.stringify(tests[2][0])+","+tests[2][1]+")</code>应返回<code>""+results[2]+""</code> 。
testString: assert.equal(genFizzBuzz([[3, "Buzz"],[5, "Fizz"]], 12), "Buzz");
- text: <code>genFizzBuzz("+JSON.stringify(tests[3][0])+","+tests[3][1]+")</code>应返回<code>""+results[3]+""</code> 。
testString: assert.equal(genFizzBuzz([[3, "Buzz"],[5, "Fizz"]], 13), '13');
- text: <code>genFizzBuzz("+JSON.stringify(tests[4][0])+","+tests[4][1]+")</code>应该返回<code>""+results[4]+""</code> 。
testString: assert.equal(genFizzBuzz([[3, "Buzz"],[5, "Fizz"]], 15), "BuzzFizz");
- text: <code>genFizzBuzz("+JSON.stringify(tests[5][0])+","+tests[5][1]+")</code>应返回<code>""+results[5]+""</code> 。
testString: assert.equal(genFizzBuzz([[3, "Fizz"],[5, "Buzz"]], 15), "FizzBuzz");
- text: <code>genFizzBuzz("+JSON.stringify(tests[6][0])+","+tests[6][1]+")</code>应该返回<code>""+results[6]+""</code> 。
testString: assert.equal(genFizzBuzz([[3, "Fizz"],[5, "Buzz"],[7, "Baxx"]], 105), "FizzBuzzBaxx");
```

View File

@@ -19,19 +19,19 @@ localeTitle: 生成小写ASCII字母表
```yml
tests:
- text: <code>lascii</code>应该是一个功能。
testString: 'assert(typeof lascii=="function","<code>lascii</code> should be a function.");'
- text: '<code>lascii(&quot;a&quot;,&quot;d&quot;)</code>应该返回一个数组。'
testString: 'assert(Array.isArray(lascii("a","d")),"<code>lascii("a","d")</code> should return an array.");'
- text: '“ <code>lascii(&quot;a&quot;,&quot;d&quot;)</code>应该返回<code>[ &quot;a&quot;, &quot;b&quot;, &quot;c&quot;, &quot;d&quot; ]</code> 。”'
testString: 'assert.deepEqual(lascii("a","d"),results[0],"<code>lascii("a","d")</code> should return <code>[ "a", "b", "c", "d" ]</code>.");'
- text: '“ <code>lascii(&quot;c&quot;,&quot;i&quot;)</code>应该返回<code>[ &quot;c&quot;, &quot;d&quot;, &quot;e&quot;, &quot;f&quot;, &quot;g&quot;, &quot;h&quot;, &quot;i&quot; ]</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>.");'
- text: '“ <code>lascii(&quot;m&quot;,&quot;q&quot;)</code>应该返回<code>[ &quot;m&quot;, &quot;n&quot;, &quot;o&quot;, &quot;p&quot;, &quot;q&quot; ]</code> 。”'
testString: 'assert.deepEqual(lascii("m","q"),results[2],"<code>lascii("m","q")</code> should return <code>[ "m", "n", "o", "p", "q" ]</code>.");'
- text: '“ <code>lascii(&quot;k&quot;,&quot;n&quot;)</code>应返回<code>[ &quot;k&quot;, &quot;l&quot;, &quot;m&quot;, &quot;n&quot; ]</code> 。”)'
testString: 'assert.deepEqual(lascii("k","n"),results[3],"<code>lascii("k","n")</code> should return <code>[ "k", "l", "m", "n" ]</code>.");'
- text: '“ <code>lascii(&quot;t&quot;,&quot;z&quot;)</code>应该返回<code>[ &quot;t&quot;, &quot;u&quot;, &quot;v&quot;, &quot;w&quot;, &quot;x&quot;, &quot;y&quot;, &quot;z&quot; ]</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(typeof lascii=='function');
- text: <code>lascii("a","d")</code>应该返回一个数组。
testString: assert(Array.isArray(lascii('a','d')));
- text: <code>lascii("a","d")</code>应该返回<code>[ "a", "b", "c", "d" ]</code> 。
testString: assert.deepEqual(lascii("a","d"),results[0]);
- text: <code>lascii("c","i")</code>应该返回<code>[ "c", "d", "e", "f", "g", "h", "i" ]</code> 。
testString: assert.deepEqual(lascii("c","i"),results[1]);
- text: <code>lascii("m","q")</code>应该返回<code>[ "m", "n", "o", "p", "q" ]</code> 。
testString: assert.deepEqual(lascii("m","q"),results[2]);
- text: <code>lascii("k","n")</code>应返回<code>[ "k", "l", "m", "n" ]</code> 。
testString: assert.deepEqual(lascii("k","n"),results[3]);
- text: <code>lascii("t","z")</code>应该返回<code>[ "t", "u", "v", "w", "x", "y", "z" ]</code> 。
testString: assert.deepEqual(lascii("t","z"),results[4]);
```

View File

@@ -19,21 +19,21 @@ localeTitle: 格雷码
```yml
tests:
- text: <code>gray</code>应该是一个功能。
testString: 'assert(typeof gray=="function","<code>gray</code> should be a function.");'
testString: assert(typeof gray=='function');
- text: '<code>gray(true,177)</code>应该返回一个数字。'
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>应该返回<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>应该返回<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>应该返回<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>应该返回<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>应该返回<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>应该返回<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

@@ -19,21 +19,21 @@ localeTitle: 最大公约数
```yml
tests:
- text: <code>gcd</code>应该是一个功能。
testString: 'assert(typeof gcd=="function","<code>gcd</code> should be a function.");'
testString: assert(typeof gcd=='function');
- text: '<code>gcd(24,36)</code>应该返回一个数字。'
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>应该返回<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>应该返回<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>应该返回<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>应该返回<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>应该返回<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>应该返回<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

@@ -19,21 +19,21 @@ localeTitle: 最重要的后续总和
```yml
tests:
- text: <code>maximumSubsequence</code>应该是一个函数。
testString: 'assert(typeof maximumSubsequence=="function","<code>maximumSubsequence</code> should be a function.");'
testString: assert(typeof maximumSubsequence=='function');
- text: '<code>maximumSubsequence(&quot;+JSON.stringify(tests[0])+&quot;)</code>应该返回一个数组。'
testString: 'assert(Array.isArray(maximumSubsequence(tests[0])),"<code>maximumSubsequence("+JSON.stringify(tests[0])+")</code> should return an array.");'
testString: assert(Array.isArray(maximumSubsequence([ 1, 2,-1, 3, 10, -10 ])));
- text: '<code>maximumSubsequence(&quot;+JSON.stringify(tests[0])+&quot;)</code>应返回<code>&quot;+JSON.stringify(results[0])+&quot;</code> 。'
testString: 'assert.deepEqual(maximumSubsequence(tests[0]),results[0],"<code>maximumSubsequence("+JSON.stringify(tests[0])+")</code> should return <code>"+JSON.stringify(results[0])+"</code>.");'
testString: assert.deepEqual(maximumSubsequence([1,2,-1,3,10,-10]), [ 1, 2, -1, 3, 10 ]);
- text: '<code>maximumSubsequence(&quot;+JSON.stringify(tests[1])+&quot;)</code>应返回<code>&quot;+JSON.stringify(results[1])+&quot;</code> 。'
testString: 'assert.deepEqual(maximumSubsequence(tests[1]),results[1],"<code>maximumSubsequence("+JSON.stringify(tests[1])+")</code> should return <code>"+JSON.stringify(results[1])+"</code>.");'
testString: assert.deepEqual(maximumSubsequence([0, 8, 10, -2, -4, -1, -5, -3]), [ 0, 8, 10 ]);
- text: '<code>maximumSubsequence(&quot;+JSON.stringify(tests[2])+&quot;)</code>应返回<code>&quot;+JSON.stringify(results[2])+&quot;</code> 。'
testString: 'assert.deepEqual(maximumSubsequence(tests[2]),results[2],"<code>maximumSubsequence("+JSON.stringify(tests[2])+")</code> should return <code>"+JSON.stringify(results[2])+"</code>.");'
testString: assert.deepEqual(maximumSubsequence([ 9, 9, -10, 1 ]), [ 9, 9 ]);
- text: '<code>maximumSubsequence(&quot;+JSON.stringify(tests[3])+&quot;)</code>应返回<code>&quot;+JSON.stringify(results[3])+&quot;</code> 。'
testString: 'assert.deepEqual(maximumSubsequence(tests[3]),results[3],"<code>maximumSubsequence("+JSON.stringify(tests[3])+")</code> should return <code>"+JSON.stringify(results[3])+"</code>.");'
testString: assert.deepEqual(maximumSubsequence([ 7, 1, -5, -3, -8, 1 ]), [ 7, 1 ]);
- text: '<code>maximumSubsequence(&quot;+JSON.stringify(tests[4])+&quot;)</code>应返回<code>&quot;+JSON.stringify(results[4])+&quot;</code> 。'
testString: 'assert.deepEqual(maximumSubsequence(tests[4]),results[4],"<code>maximumSubsequence("+JSON.stringify(tests[4])+")</code> should return <code>"+JSON.stringify(results[4])+"</code>.");'
testString: assert.deepEqual(maximumSubsequence([ -3, 6, -1, 4, -4, -6 ]), [ 6, -1, 4 ]);
- text: '<code>maximumSubsequence(&quot;+JSON.stringify(tests[5])+&quot;)</code>应返回<code>&quot;+JSON.stringify(results[5])+&quot;</code> 。'
testString: 'assert.deepEqual(maximumSubsequence(tests[5]),results[5],"<code>maximumSubsequence("+JSON.stringify(tests[5])+")</code> should return <code>"+JSON.stringify(results[5])+"</code>.");'
testString: assert.deepEqual(maximumSubsequence([ -1, -2, 3, 5, 6, -2, -1, 4, -4, 2, -1 ]), [ 3, 5, 6, -2, -1, 4 ]);
```

View File

@@ -19,9 +19,9 @@ localeTitle: 冰雹序列
```yml
tests:
- text: <code>hailstoneSequence</code>是一个函数。
testString: 'assert(typeof hailstoneSequence === "function", "<code>hailstoneSequence</code> is a function.");'
testString: assert(typeof hailstoneSequence === 'function');
- text: '<code>[[27,82,41,124,8,4,2,1], [351, 77031]]</code> <code>hailstoneSequence()</code>应返回<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

@@ -19,31 +19,31 @@ localeTitle: 快乐的数字
```yml
tests:
- text: <code>happy</code>是一种功能。
testString: 'assert(typeof happy === "function", "<code>happy</code> is a function.");'
testString: assert(typeof happy === 'function');
- text: <code>happy(1)</code>应该返回一个布尔值。
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>应该回归真实。
testString: 'assert(happy(1), "<code>happy(1)</code> should return true.");'
testString: assert(happy(1));
- text: <code>happy(2)</code>应该返回虚假。
testString: 'assert(!happy(2), "<code>happy(2)</code> should return false.");'
testString: assert(!happy(2));
- text: <code>happy(7)</code>应该回归真实。
testString: 'assert(happy(7), "<code>happy(7)</code> should return true.");'
testString: assert(happy(7));
- text: <code>happy(10)</code>应该回归真实。
testString: 'assert(happy(10), "<code>happy(10)</code> should return true.");'
testString: assert(happy(10));
- text: <code>happy(13)</code>应该回归真实。
testString: 'assert(happy(13), "<code>happy(13)</code> should return true.");'
testString: assert(happy(13));
- text: <code>happy(19)</code>应该回归真实。
testString: 'assert(happy(19), "<code>happy(19)</code> should return true.");'
testString: assert(happy(19));
- text: <code>happy(23)</code>应该回归真实。
testString: 'assert(happy(23), "<code>happy(23)</code> should return true.");'
testString: assert(happy(23));
- text: <code>happy(28)</code>应该回归真实。
testString: 'assert(happy(28), "<code>happy(28)</code> should return true.");'
testString: assert(happy(28));
- text: <code>happy(31)</code>应该回归真实。
testString: 'assert(happy(31), "<code>happy(31)</code> should return true.");'
testString: assert(happy(31));
- text: <code>happy(32)</code>应该回归真实:
testString: 'assert(happy(32), "<code>happy(32)</code> should return true:.");'
testString: assert(happy(32));
- text: <code>happy(33)</code>应该返回虚假。
testString: 'assert(!happy(33), "<code>happy(33)</code> should return false.");'
testString: assert(!happy(33));
```

View File

@@ -19,9 +19,9 @@ localeTitle: Harshad或Niven系列
```yml
tests:
- text: <code>isHarshadOrNiven</code>是一个函数。
testString: 'assert(typeof isHarshadOrNiven === "function", "<code>isHarshadOrNiven</code> is a function.");'
- text: '<code>isHarshadOrNiven()</code>应该返回<code>{&quot;firstTwenty&quot;: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 18, 20, 21, 24, 27, 30, 36, 40, 42],&quot;firstOver1000&quot;: 1002}</code>'
testString: 'assert.deepEqual(isHarshadOrNiven(), res, "<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(typeof isHarshadOrNiven === 'function');
- text: '<code>isHarshadOrNiven()</code>应该返回<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

@@ -19,19 +19,19 @@ localeTitle: 来自两个数组的哈希
```yml
tests:
- text: <code>arrToObj</code>是一个功能。
testString: 'assert(typeof arrToObj === "function", "<code>arrToObj</code> is a function.");'
- text: '<code>arrToObj([1, 2, 3, 4, 5], [&quot;a&quot;, &quot;b&quot;, &quot;c&quot;, &quot;d&quot;, &quot;e&quot;])</code>应返回<code>{ 1: &quot;a&quot;, 2: &quot;b&quot;, 3: &quot;c&quot;, 4: &quot;d&quot;, 5: &quot;e&quot; }</code>'
testString: 'assert.deepEqual(arrToObj(...testCases[0]), res[0], "<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>");'
- text: '<code>arrToObj([1, 2, 3, 4, 5], [&quot;a&quot;, &quot;b&quot;, &quot;c&quot;, &quot;d&quot;])</code>应返回<code>{ 1: &quot;a&quot;, 2: &quot;b&quot;, 3: &quot;c&quot;, 4: &quot;d&quot;, 5: undefined }</code>'
testString: 'assert.deepEqual(arrToObj(...testCases[1]), res[1], "<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>");'
- text: '<code>arrToObj([1, 2, 3], [&quot;a&quot;, &quot;b&quot;, &quot;c&quot;, &quot;d&quot;, &quot;e&quot;])</code>应返回<code>{ 1: &quot;a&quot;, 2: &quot;b&quot;, 3: &quot;c&quot; }</code>'
testString: 'assert.deepEqual(arrToObj(...testCases[2]), res[2], "<code>arrToObj([1, 2, 3], ["a", "b", "c", "d", "e"])</code> should return <code>{ 1: "a", 2: "b", 3: "c" }</code>");'
- text: '<code>arrToObj([&quot;a&quot;, &quot;b&quot;, &quot;c&quot;, &quot;d&quot;, &quot;e&quot;], [1, 2, 3, 4, 5])</code>应返回<code>{ &quot;a&quot;: 1, &quot;b&quot;: 2, &quot;c&quot;: 3 , &quot;d&quot;: 4, &quot;e&quot;: 5 }</code>'
testString: 'assert.deepEqual(arrToObj(...testCases[3]), res[3], "<code>arrToObj(["a", "b", "c", "d", "e"], [1, 2, 3, 4, 5])</code> should return <code>{ "a": 1, "b": 2, "c": 3 , "d": 4, "e": 5 }</code>");'
- text: '<code>arrToObj([&quot;a&quot;, &quot;b&quot;, &quot;c&quot;, &quot;d&quot;, &quot;e&quot;], [1, 2, 3, 4])</code>应返回<code>{ &quot;a&quot;: 1, &quot;b&quot;: 2, &quot;c&quot;: 3 , &quot;d&quot;: 4, &quot;e&quot;: undefined }</code>'
testString: 'assert.deepEqual(arrToObj(...testCases[4]), res[4], "<code>arrToObj(["a", "b", "c", "d", "e"], [1, 2, 3, 4])</code> should return <code>{ "a": 1, "b": 2, "c": 3 , "d": 4, "e": undefined }</code>");'
- text: '<code>arrToObj([&quot;a&quot;, &quot;b&quot;, &quot;c&quot;], [1, 2, 3, 4, 5])</code>应返回<code>{ &quot;a&quot;: 1, &quot;b&quot;: 2, &quot;c&quot;: 3 }</code>'
testString: 'assert.deepEqual(arrToObj(...testCases[5]), res[5], "<code>arrToObj(["a", "b", "c"], [1, 2, 3, 4, 5])</code> should return <code>{ "a": 1, "b": 2, "c": 3 }</code>");'
testString: assert(typeof arrToObj === 'function');
- text: '<code>arrToObj([1, 2, 3, 4, 5], ["a", "b", "c", "d", "e"])</code>应返回<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>应返回<code>{ 1: "a", 2: "b", 3: "c", 4: "d", 5: undefined }</code>'
testString: assert.deepEqual(arrToObj(...testCases[1]), res[1]);
- text: '<code>arrToObj([1, 2, 3], ["a", "b", "c", "d", "e"])</code>应返回<code>{ 1: "a", 2: "b", 3: "c" }</code>'
testString: assert.deepEqual(arrToObj(...testCases[2]), res[2]);
- text: '<code>arrToObj(["a", "b", "c", "d", "e"], [1, 2, 3, 4, 5])</code>应返回<code>{ "a": 1, "b": 2, "c": 3 , "d": 4, "e": 5 }</code>'
testString: assert.deepEqual(arrToObj(...testCases[3]), res[3]);
- text: '<code>arrToObj(["a", "b", "c", "d", "e"], [1, 2, 3, 4])</code>应返回<code>{ "a": 1, "b": 2, "c": 3 , "d": 4, "e": undefined }</code>'
testString: assert.deepEqual(arrToObj(...testCases[4]), res[4]);
- text: '<code>arrToObj(["a", "b", "c"], [1, 2, 3, 4, 5])</code>应返回<code>{ "a": 1, "b": 2, "c": 3 }</code>'
testString: assert.deepEqual(arrToObj(...testCases[5]), res[5]);
```

View File

@@ -19,7 +19,7 @@ localeTitle: 哈希加入
对于aj <sub>A</sub> 项下多图M <sub>B中的</sub>每一行b
设c =第a行和第b行的串联
将行c放在表C中<p></p>
</pre>测试用例<p>输入</p><table><tbody><tr><td style="padding: 4px; margin: 5px;"><table style="border:none; border-collapse:collapse;"><tbody><tr><td style="border:none"> <i>A =</i> </td><td style="border:none"><table><tbody><tr><th style="padding: 4px; margin: 5px;">年龄</th><th style="padding: 4px; margin: 5px;">名称</th></tr><tr><td style="padding: 4px; margin: 5px;"> 27 </td><td style="padding: 4px; margin: 5px;">约拿</td></tr><tr><td style="padding: 4px; margin: 5px;"> 18 </td><td style="padding: 4px; margin: 5px;">艾伦</td></tr><tr><td style="padding: 4px; margin: 5px;"> 28 </td><td style="padding: 4px; margin: 5px;">荣耀</td></tr><tr><td style="padding: 4px; margin: 5px;"> 18 </td><td style="padding: 4px; margin: 5px;">大力水手</td></tr><tr><td style="padding: 4px; margin: 5px;"> 28 </td><td style="padding: 4px; margin: 5px;">艾伦</td></tr></tbody></table></td><td style="border:none; padding-left:1.5em;" rowspan="2"></td><td style="border:none"> <i>B =</i> </td><td style="border:none"><table><tbody><tr><th style="padding: 4px; margin: 5px;">字符</th><th style="padding: 4px; margin: 5px;">复仇者</th></tr><tr><td style="padding: 4px; margin: 5px;">约拿</td><td style="padding: 4px; margin: 5px;">鲸鱼</td></tr><tr><td style="padding: 4px; margin: 5px;">约拿</td><td style="padding: 4px; margin: 5px;">蜘蛛</td></tr><tr><td style="padding: 4px; margin: 5px;">艾伦</td><td style="padding: 4px; margin: 5px;"></td></tr><tr><td style="padding: 4px; margin: 5px;">艾伦</td><td style="padding: 4px; margin: 5px;">植物大战僵尸</td></tr><tr><td style="padding: 4px; margin: 5px;">荣耀</td><td style="padding: 4px; margin: 5px;">巴菲</td></tr></tbody></table></td></tr><tr><td style="border:none"> <i>j <sub>A</sub> =</i> </td><td style="border:none"> <i><code>Name</code> 即第1栏</i> </td><td style="border:none"> <i>j <sub>B</sub> =</i> </td><td style="border:none"> <i><code>Character</code> 即第0列</i> </td></tr></tbody></table></td><td style="padding: 4px; margin: 5px;"></td></tr></tbody></table><p>产量</p><table><tbody><tr><th style="padding: 4px; margin: 5px;"> A.Age </th><th style="padding: 4px; margin: 5px;">一个名字</th><th style="padding: 4px; margin: 5px;"> B.Character </th><th style="padding: 4px; margin: 5px;"> B.Nemesis </th></tr><tr><td style="padding: 4px; margin: 5px;"> 27 </td><td style="padding: 4px; margin: 5px;">约拿</td><td style="padding: 4px; margin: 5px;">约拿</td><td style="padding: 4px; margin: 5px;">鲸鱼</td></tr><tr><td style="padding: 4px; margin: 5px;"> 27 </td><td style="padding: 4px; margin: 5px;">约拿</td><td style="padding: 4px; margin: 5px;">约拿</td><td style="padding: 4px; margin: 5px;">蜘蛛</td></tr><tr><td style="padding: 4px; margin: 5px;"> 18 </td><td style="padding: 4px; margin: 5px;">艾伦</td><td style="padding: 4px; margin: 5px;">艾伦</td><td style="padding: 4px; margin: 5px;"></td></tr><tr><td style="padding: 4px; margin: 5px;"> 18 </td><td style="padding: 4px; margin: 5px;">艾伦</td><td style="padding: 4px; margin: 5px;">艾伦</td><td style="padding: 4px; margin: 5px;">植物大战僵尸</td></tr><tr><td style="padding: 4px; margin: 5px;"> 28 </td><td style="padding: 4px; margin: 5px;">荣耀</td><td style="padding: 4px; margin: 5px;">荣耀</td><td style="padding: 4px; margin: 5px;">巴菲</td></tr><tr><td style="padding: 4px; margin: 5px;"> 28 </td><td style="padding: 4px; margin: 5px;">艾伦</td><td style="padding: 4px; margin: 5px;">艾伦</td><td style="padding: 4px; margin: 5px;"></td></tr><tr><td style="padding: 4px; margin: 5px;"> 28 </td><td style="padding: 4px; margin: 5px;">艾伦</td><td style="padding: 4px; margin: 5px;">艾伦</td><td style="padding: 4px; margin: 5px;">植物大战僵尸</td></tr></tbody></table><p></p><p></p><p>输出表中行的顺序并不重要。 </p><p>如果你使用数字索引数组来表示表行(而不是按名称引用列),你可以用<code style="white-space:nowrap">[[27, &quot;Jonah&quot;], [&quot;Jonah&quot;, &quot;Whales&quot;]]</code>的形式表示输出行。 。 </p><hr></section>
</pre>测试用例<p>输入</p><table><tbody><tr><td style="padding: 4px; margin: 5px;"><table style="border:none; border-collapse:collapse;"><tbody><tr><td style="border:none"> <i>A =</i> </td><td style="border:none"><table><tbody><tr><th style="padding: 4px; margin: 5px;">年龄</th><th style="padding: 4px; margin: 5px;">名称</th></tr><tr><td style="padding: 4px; margin: 5px;"> 27 </td><td style="padding: 4px; margin: 5px;">约拿</td></tr><tr><td style="padding: 4px; margin: 5px;"> 18 </td><td style="padding: 4px; margin: 5px;">艾伦</td></tr><tr><td style="padding: 4px; margin: 5px;"> 28 </td><td style="padding: 4px; margin: 5px;">荣耀</td></tr><tr><td style="padding: 4px; margin: 5px;"> 18 </td><td style="padding: 4px; margin: 5px;">大力水手</td></tr><tr><td style="padding: 4px; margin: 5px;"> 28 </td><td style="padding: 4px; margin: 5px;">艾伦</td></tr></tbody></table></td><td style="border:none; padding-left:1.5em;" rowspan="2"></td><td style="border:none"> <i>B =</i> </td><td style="border:none"><table><tbody><tr><th style="padding: 4px; margin: 5px;">字符</th><th style="padding: 4px; margin: 5px;">复仇者</th></tr><tr><td style="padding: 4px; margin: 5px;">约拿</td><td style="padding: 4px; margin: 5px;">鲸鱼</td></tr><tr><td style="padding: 4px; margin: 5px;">约拿</td><td style="padding: 4px; margin: 5px;">蜘蛛</td></tr><tr><td style="padding: 4px; margin: 5px;">艾伦</td><td style="padding: 4px; margin: 5px;"></td></tr><tr><td style="padding: 4px; margin: 5px;">艾伦</td><td style="padding: 4px; margin: 5px;">植物大战僵尸</td></tr><tr><td style="padding: 4px; margin: 5px;">荣耀</td><td style="padding: 4px; margin: 5px;">巴菲</td></tr></tbody></table></td></tr><tr><td style="border:none"> <i>j <sub>A</sub> =</i> </td><td style="border:none"> <i><code>Name</code> 即第1栏</i> </td><td style="border:none"> <i>j <sub>B</sub> =</i> </td><td style="border:none"> <i><code>Character</code> 即第0列</i> </td></tr></tbody></table></td><td style="padding: 4px; margin: 5px;"></td></tr></tbody></table><p>产量</p><table><tbody><tr><th style="padding: 4px; margin: 5px;"> A.Age </th><th style="padding: 4px; margin: 5px;">一个名字</th><th style="padding: 4px; margin: 5px;"> B.Character </th><th style="padding: 4px; margin: 5px;"> B.Nemesis </th></tr><tr><td style="padding: 4px; margin: 5px;"> 27 </td><td style="padding: 4px; margin: 5px;">约拿</td><td style="padding: 4px; margin: 5px;">约拿</td><td style="padding: 4px; margin: 5px;">鲸鱼</td></tr><tr><td style="padding: 4px; margin: 5px;"> 27 </td><td style="padding: 4px; margin: 5px;">约拿</td><td style="padding: 4px; margin: 5px;">约拿</td><td style="padding: 4px; margin: 5px;">蜘蛛</td></tr><tr><td style="padding: 4px; margin: 5px;"> 18 </td><td style="padding: 4px; margin: 5px;">艾伦</td><td style="padding: 4px; margin: 5px;">艾伦</td><td style="padding: 4px; margin: 5px;"></td></tr><tr><td style="padding: 4px; margin: 5px;"> 18 </td><td style="padding: 4px; margin: 5px;">艾伦</td><td style="padding: 4px; margin: 5px;">艾伦</td><td style="padding: 4px; margin: 5px;">植物大战僵尸</td></tr><tr><td style="padding: 4px; margin: 5px;"> 28 </td><td style="padding: 4px; margin: 5px;">荣耀</td><td style="padding: 4px; margin: 5px;">荣耀</td><td style="padding: 4px; margin: 5px;">巴菲</td></tr><tr><td style="padding: 4px; margin: 5px;"> 28 </td><td style="padding: 4px; margin: 5px;">艾伦</td><td style="padding: 4px; margin: 5px;">艾伦</td><td style="padding: 4px; margin: 5px;"></td></tr><tr><td style="padding: 4px; margin: 5px;"> 28 </td><td style="padding: 4px; margin: 5px;">艾伦</td><td style="padding: 4px; margin: 5px;">艾伦</td><td style="padding: 4px; margin: 5px;">植物大战僵尸</td></tr></tbody></table><p></p><p></p><p>输出表中行的顺序并不重要。 </p><p>如果你使用数字索引数组来表示表行(而不是按名称引用列),你可以用<code style="white-space:nowrap">[[27, "Jonah"], ["Jonah", "Whales"]]</code>的形式表示输出行。 。 </p><hr></section>
## Instructions
<section id="instructions">
@@ -31,9 +31,9 @@ localeTitle: 哈希加入
```yml
tests:
- text: <code>hashJoin</code>是一个函数。
testString: 'assert(typeof hashJoin === "function", "<code>hashJoin</code> is a function.");'
- text: '<code>hashJoin([{ age: 27, name: &quot;Jonah&quot; }, { age: 18, name: &quot;Alan&quot; }, { age: 28, name: &quot;Glory&quot; }, { age: 18, name: &quot;Popeye&quot; }, { age: 28, name: &quot;Alan&quot; }], [{ character: &quot;Jonah&quot;, nemesis: &quot;Whales&quot; }, { character: &quot;Jonah&quot;, nemesis: &quot;Spiders&quot; }, { character: &quot;Alan&quot;, nemesis: &quot;Ghosts&quot; }, { character:&quot;Alan&quot;, nemesis: &quot;Zombies&quot; }, { character: &quot;Glory&quot;, nemesis: &quot;Buffy&quot; }, { character: &quot;Bob&quot;, nemesis: &quot;foo&quot; }])</code>应该返回<code>[{&quot;A_age&quot;: 27,&quot;A_name&quot;: &quot;Jonah&quot;, &quot;B_character&quot;: &quot;Jonah&quot;, &quot;B_nemesis&quot;: &quot;Whales&quot;}, {&quot;A_age&quot;: 27,&quot;A_name&quot;: &quot;Jonah&quot;, &quot;B_character&quot;: &quot;Jonah&quot;, &quot;B_nemesis&quot;: &quot;Spiders&quot;}, {&quot;A_age&quot;: 18,&quot;A_name&quot;: &quot;Alan&quot;, &quot;B_character&quot;: &quot;Alan&quot;, &quot;B_nemesis&quot;: &quot;Ghosts&quot;}, {&quot;A_age&quot;: 18,&quot;A_name&quot;: &quot;Alan&quot;, &quot;B_character&quot;: &quot;Alan&quot;, &quot;B_nemesis&quot;: &quot;Zombies&quot;}, {&quot;A_age&quot;: 28,&quot;A_name&quot;: &quot;Glory&quot;, &quot;B_character&quot;: &quot;Glory&quot;, &quot;B_nemesis&quot;: &quot;Buffy&quot;}, {&quot;A_age&quot;: 28,&quot;A_name&quot;: &quot;Alan&quot;, &quot;B_character&quot;: &quot;Alan&quot;, &quot;B_nemesis&quot;: &quot;Ghosts&quot;}, {&quot;A_age&quot;: 28,&quot;A_name&quot;: &quot;Alan&quot;, &quot;B_character&quot;: &quot;Alan&quot;, &quot;B_nemesis&quot;: &quot;Zombies&quot;}]</code>'
testString: 'assert.deepEqual(hashJoin(hash1, hash2), res, "<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(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>应该返回<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

@@ -19,15 +19,15 @@ localeTitle: 苍鹭三角形
```yml
tests:
- text: <code>heronianTriangle</code>是一个函数。
testString: 'assert(typeof heronianTriangle === "function", "<code>heronianTriangle</code> is a function.");'
testString: assert(typeof heronianTriangle === 'function');
- text: '<code>heronianTriangle()</code>应返回<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> <code>heronianTriangle()</code> <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> <code>heronianTriangle()</code> <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> <code>heronianTriangle()</code> <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> <code>heronianTriangle()</code> <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>应返回<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> <code>heronianTriangle()</code> <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> <code>heronianTriangle()</code> <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> <code>heronianTriangle()</code> <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> <code>heronianTriangle()</code> <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>应返回<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> <code>heronianTriangle()</code> <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> <code>heronianTriangle()</code> <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> <code>heronianTriangle()</code> <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> <code>heronianTriangle()</code> <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>应返回<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> <code>heronianTriangle()</code> <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> <code>heronianTriangle()</code> <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> <code>heronianTriangle()</code> <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> <code>heronianTriangle()</code> <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

@@ -19,29 +19,29 @@ localeTitle: Hofstadter图 - 图序列
```yml
tests:
- text: <code>ffr</code>是一个功能。
testString: 'assert(typeof ffr === "function", "<code>ffr</code> is a function.");'
testString: assert(typeof ffr === 'function');
- text: <code>ffs</code>是一个函数。
testString: 'assert(typeof ffs === "function", "<code>ffs</code> is a function.");'
testString: assert(typeof ffs === 'function');
- text: <code>ffr</code>应该返回整数。
testString: 'assert(Number.isInteger(ffr(1)), "<code>ffr</code> should return integer.");'
testString: assert(Number.isInteger(ffr(1)));
- text: <code>ffs</code>应该返回整数。
testString: 'assert(Number.isInteger(ffs(1)), "<code>ffs</code> should return integer.");'
testString: assert(Number.isInteger(ffs(1)));
- text: <code>ffr()</code>应该返回<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>应返回<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>应返回<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>应返回<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>应该返回<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>应该返回<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>应该返回<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>应该返回<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

@@ -19,17 +19,17 @@ localeTitle: Hofstadter Q序列
```yml
tests:
- text: <code>hofstadterQ</code>是一个函数。
testString: 'assert(typeof hofstadterQ === "function", "<code>hofstadterQ</code> is a function.");'
testString: assert(typeof hofstadterQ === 'function');
- text: <code>hofstadterQ()</code>应该返回<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>应该返回<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>应该返回<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>应该返回<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>应该返回<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

@@ -19,21 +19,21 @@ localeTitle: 我在E之前除了C之后
```yml
tests:
- text: <code>IBeforeExceptC</code>应该是一个函数。
testString: 'assert(typeof IBeforeExceptC=="function","<code>IBeforeExceptC</code> should be a function.");'
- text: <code>IBeforeExceptC(&quot;receive&quot;)</code>应该返回一个布尔值。
testString: 'assert(typeof IBeforeExceptC("receive")=="boolean","<code>IBeforeExceptC("receive")</code> should return a boolean.");'
- text: <code>IBeforeExceptC(&quot;receive&quot;)</code>应该返回<code>true</code> 。
testString: 'assert.equal(IBeforeExceptC("receive"),true,"<code>IBeforeExceptC("receive")</code> should return <code>true</code>.");'
- text: <code>IBeforeExceptC(&quot;science&quot;)</code>应该返回<code>false</code> 。
testString: 'assert.equal(IBeforeExceptC("science"),false,"<code>IBeforeExceptC("science")</code> should return <code>false</code>.");'
- text: <code>IBeforeExceptC(&quot;imperceivable&quot;)</code>应该返回<code>true</code> 。
testString: 'assert.equal(IBeforeExceptC("imperceivable"),true,"<code>IBeforeExceptC("imperceivable")</code> should return <code>true</code>.");'
- text: <code>IBeforeExceptC(&quot;inconceivable&quot;)</code>应该返回<code>true</code> 。
testString: 'assert.equal(IBeforeExceptC("inconceivable"),true,"<code>IBeforeExceptC("inconceivable")</code> should return <code>true</code>.");'
- text: <code>IBeforeExceptC(&quot;insufficient&quot;)</code>应返回<code>false</code> 。
testString: 'assert.equal(IBeforeExceptC("insufficient"),false,"<code>IBeforeExceptC("insufficient")</code> should return <code>false</code>.");'
- text: <code>IBeforeExceptC(&quot;omniscient&quot;)</code>应该返回<code>false</code> 。
testString: 'assert.equal(IBeforeExceptC("omniscient"),false,"<code>IBeforeExceptC("omniscient")</code> should return <code>false</code>.");'
testString: assert(typeof IBeforeExceptC=='function');
- text: <code>IBeforeExceptC("receive")</code>应该返回一个布尔值。
testString: assert(typeof IBeforeExceptC("receive")=='boolean');
- text: <code>IBeforeExceptC("receive")</code>应该返回<code>true</code> 。
testString: assert.equal(IBeforeExceptC("receive"),true);
- text: <code>IBeforeExceptC("science")</code>应该返回<code>false</code> 。
testString: assert.equal(IBeforeExceptC("science"),false);
- text: <code>IBeforeExceptC("imperceivable")</code>应该返回<code>true</code> 。
testString: assert.equal(IBeforeExceptC("imperceivable"),true);
- text: <code>IBeforeExceptC("inconceivable")</code>应该返回<code>true</code> 。
testString: assert.equal(IBeforeExceptC("inconceivable"),true);
- text: <code>IBeforeExceptC("insufficient")</code>应返回<code>false</code> 。
testString: assert.equal(IBeforeExceptC("insufficient"),false);
- text: <code>IBeforeExceptC("omniscient")</code>应该返回<code>false</code> 。
testString: assert.equal(IBeforeExceptC("omniscient"),false);
```

View File

@@ -19,19 +19,19 @@ localeTitle: 他们
```yml
tests:
- text: <code>isValid</code>应该是一个函数。
testString: 'assert(typeof isValid=="function","<code>isValid</code> should be a function.");'
- text: '<code>isValid(&quot;&quot;+tests[0]+&quot;&quot;)</code>应该返回一个布尔值。'
testString: 'assert(typeof isValid(tests[0])=="boolean","<code>isValid(""+tests[0]+"")</code> should return a boolean.");'
- text: '<code>isValid(&quot;&quot;+tests[0]+&quot;&quot;)</code>应该返回<code>true</code> 。'
testString: 'assert.equal(isValid(tests[0]),true,"<code>isValid(""+tests[0]+"")</code> should return <code>true</code>.");'
- text: '<code>isValid(&quot;&quot;+tests[1]+&quot;&quot;)</code>应返回<code>false</code> 。'
testString: 'assert.equal(isValid(tests[1]),false,"<code>isValid(""+tests[1]+"")</code> should return <code>false</code>.");'
- text: '<code>isValid(&quot;&quot;+tests[2]+&quot;&quot;)</code>应返回<code>false</code> 。'
testString: 'assert.equal(isValid(tests[2]),false,"<code>isValid(""+tests[2]+"")</code> should return <code>false</code>.");'
- text: '<code>isValid(&quot;&quot;+tests[3]+&quot;&quot;)</code>应该返回<code>false</code> 。'
testString: 'assert.equal(isValid(tests[3]),false,"<code>isValid(""+tests[3]+"")</code> should return <code>false</code>.");'
- text: '<code>isValid(&quot;&quot;+tests[4]+&quot;&quot;)</code>应该返回<code>true</code> 。'
testString: 'assert.equal(isValid(tests[4]),true,"<code>isValid(""+tests[4]+"")</code> should return <code>true</code>.");'
testString: assert(typeof isValid=='function');
- text: <code>isValid(""+tests[0]+"")</code>应该返回一个布尔值。
testString: assert(typeof isValid('GB82 WEST 1234 5698 7654 32')=='boolean');
- text: <code>isValid(""+tests[0]+"")</code>应该返回<code>true</code> 。
testString: assert.equal(isValid('GB82 WEST 1234 5698 7654 32'),true);
- text: <code>isValid(""+tests[1]+"")</code>应返回<code>false</code> 。
testString: assert.equal(isValid('GB82 WEST 1.34 5698 7654 32'),false);
- text: <code>isValid(""+tests[2]+"")</code>应返回<code>false</code> 。
testString: assert.equal(isValid('GB82 WEST 1234 5698 7654 325'),false);
- text: <code>isValid(""+tests[3]+"")</code>应该返回<code>false</code> 。
testString: assert.equal(isValid('GB82 TEST 1234 5698 7654 32'),false);
- text: <code>isValid(""+tests[4]+"")</code>应该返回<code>true</code> 。
testString: assert.equal(isValid('SA03 8000 0000 6080 1016 7519'),true);
```

View File

@@ -19,17 +19,17 @@ localeTitle: 身份矩阵
```yml
tests:
- text: <code>idMatrix</code>应该是一个功能。
testString: 'assert(typeof idMatrix=="function","<code>idMatrix</code> should be a function.");'
testString: assert(typeof idMatrix=='function');
- text: <code>idMatrix(1)</code>应该返回一个数组。
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>应返回<code>&quot;+JSON.stringify(results[0])+&quot;</code> 。'
testString: 'assert.deepEqual(idMatrix(1),results[0],"<code>idMatrix(1)</code> should return <code>"+JSON.stringify(results[0])+"</code>.");'
testString: assert.deepEqual(idMatrix(1),results[0]);
- text: '<code>idMatrix(2)</code>应返回<code>&quot;+JSON.stringify(results[1])+&quot;</code> 。'
testString: 'assert.deepEqual(idMatrix(2),results[1],"<code>idMatrix(2)</code> should return <code>"+JSON.stringify(results[1])+"</code>.");'
testString: assert.deepEqual(idMatrix(2),results[1]);
- text: '<code>idMatrix(3)</code>应返回<code>&quot;+JSON.stringify(results[2])+&quot;</code> 。'
testString: 'assert.deepEqual(idMatrix(3),results[2],"<code>idMatrix(3)</code> should return <code>"+JSON.stringify(results[2])+"</code>.");'
testString: assert.deepEqual(idMatrix(3),results[2]);
- text: '<code>idMatrix(4)</code>应返回<code>&quot;+JSON.stringify(results[3])+&quot;</code> 。'
testString: 'assert.deepEqual(idMatrix(4),results[3],"<code>idMatrix(4)</code> should return <code>"+JSON.stringify(results[3])+"</code>.");'
testString: assert.deepEqual(idMatrix(4),results[3]);
```

View File

@@ -20,21 +20,21 @@ localeTitle: 迭代的数字平方
```yml
tests:
- text: <code>iteratedSquare</code>应该是一个函数。
testString: 'assert(typeof iteratedSquare=="function","<code>iteratedSquare</code> should be a function.");'
testString: assert(typeof iteratedSquare=='function');
- text: <code>iteratedSquare(4)</code>应该返回一个数字。
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>应该返回<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>应该返回<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>应该返回<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>应该返回<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>应该返回<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>应该返回<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

@@ -19,19 +19,19 @@ localeTitle: Jaro距离
```yml
tests:
- text: <code>jaro</code>应该是一个功能。
testString: 'assert(typeof jaro=="function","<code>jaro</code> should be a function.");'
- text: '<code>jaro(&quot;&quot;+tests[0][0]+&quot;&quot;,&quot;&quot;+tests[0][1]+&quot;&quot;)</code>应返回一个数字。'
testString: 'assert(typeof jaro(tests[0][0],tests[0][1])=="number","<code>jaro()</code> should return a number.");'
- text: '<code>jaro(&quot;&quot;+tests[0][0]+&quot;&quot;,&quot;&quot;+tests[0][1]+&quot;&quot;)</code>应该返回<code>&quot;+results[0]+&quot;</code> 。'
testString: 'assert.equal(jaro(tests[0][0],tests[0][1]),results[0],"<code>jaro(""+tests[0][0]+"",""+tests[0][1]+"")</code> should return <code>"+results[0]+"</code>.");'
- text: '<code>jaro(&quot;&quot;+tests[1][0]+&quot;&quot;,&quot;&quot;+tests[1][1]+&quot;&quot;)</code>应返回<code>&quot;+results[1]+&quot;</code> 。'
testString: 'assert.equal(jaro(tests[1][0],tests[1][1]),results[1],"<code>jaro(""+tests[1][0]+"",""+tests[1][1]+"")</code> should return <code>"+results[1]+"</code>.");'
- text: '<code>jaro(&quot;&quot;+tests[2][0]+&quot;&quot;,&quot;&quot;+tests[2][1]+&quot;&quot;)</code>应返回<code>&quot;+results[2]+&quot;</code> 。'
testString: 'assert.equal(jaro(tests[2][0],tests[2][1]),results[2],"<code>jaro(""+tests[2][0]+"",""+tests[2][1]+"")</code> should return <code>"+results[2]+"</code>.");'
- text: '<code>jaro(&quot;&quot;+tests[3][0]+&quot;&quot;,&quot;&quot;+tests[3][1]+&quot;&quot;)</code>应返回<code>&quot;+results[3]+&quot;</code> 。'
testString: 'assert.equal(jaro(tests[3][0],tests[3][1]),results[3],"<code>jaro(""+tests[3][0]+"",""+tests[3][1]+"")</code> should return <code>"+results[3]+"</code>.");'
- text: '<code>jaro(&quot;&quot;+tests[4][0]+&quot;&quot;,&quot;&quot;+tests[4][1]+&quot;&quot;)</code>应该返回<code>&quot;+results[4]+&quot;</code> 。'
testString: 'assert.equal(jaro(tests[4][0],tests[4][1]),results[4],"<code>jaro(""+tests[4][0]+"",""+tests[4][1]+"")</code> should return <code>"+results[4]+"</code>.");'
testString: assert(typeof jaro=='function');
- text: <code>jaro(""+tests[0][0]+"",""+tests[0][1]+"")</code>应返回一个数字。
testString: assert(typeof jaro('MARTHA', 'MARHTA')=='number');
- text: <code>jaro(""+tests[0][0]+"",""+tests[0][1]+"")</code>应该返回<code>"+results[0]+"</code> 。
testString: assert.equal(jaro('MARTHA', 'MARHTA'), 0.9444444444444445);
- text: <code>jaro(""+tests[1][0]+"",""+tests[1][1]+"")</code>应返回<code>"+results[1]+"</code> 。
testString: assert.equal(jaro('DIXON', 'DICKSONX'), 0.7666666666666666);
- text: <code>jaro(""+tests[2][0]+"",""+tests[2][1]+"")</code>应返回<code>"+results[2]+"</code> 。
testString: assert.equal(jaro('JELLYFISH', 'SMELLYFISH'), 0.8962962962962964);
- text: <code>jaro(""+tests[3][0]+"",""+tests[3][1]+"")</code>应返回<code>"+results[3]+"</code> 。
testString: assert.equal(jaro('HELLOS', 'CHELLO'), 0.888888888888889);
- text: <code>jaro(""+tests[4][0]+"",""+tests[4][1]+"")</code>应该返回<code>"+results[4]+"</code> 。
testString: assert.equal(jaro('ABCD', 'BCDA'), 0.8333333333333334);
```

View File

@@ -19,21 +19,21 @@ localeTitle: JortSort
```yml
tests:
- text: <code>jortsort</code>应该是一个功能。
testString: 'assert(typeof jortsort=="function","<code>jortsort</code> should be a function.");'
testString: assert(typeof jortsort=='function');
- text: '<code>jortsort(&quot;+JSON.stringify(tests[0])+&quot;)</code>应该返回一个布尔值。'
testString: 'assert(typeof jortsort(tests[0].slice())=="boolean","<code>jortsort("+JSON.stringify(tests[0])+")</code> should return a boolean.");'
testString: assert(typeof jortsort([1,2,3,4,5])=='boolean');
- text: '<code>jortsort(&quot;+JSON.stringify(tests[0])+&quot;)</code>应该返回<code>true</code> 。'
testString: 'assert.equal(jortsort(tests[0].slice()),true,"<code>jortsort("+JSON.stringify(tests[0])+")</code> should return <code>true</code>.");'
testString: assert.equal(jortsort([1,2,3,4,5]),true);
- text: '<code>jortsort(&quot;+JSON.stringify(tests[1])+&quot;)</code>应该返回<code>false</code> 。'
testString: 'assert.equal(jortsort(tests[1].slice()),false,"<code>jortsort("+JSON.stringify(tests[1])+")</code> should return <code>false</code>.");'
testString: assert.equal(jortsort([1,2,13,4,5]),false);
- text: '<code>jortsort(&quot;+JSON.stringify(tests[2])+&quot;)</code>应该返回<code>false</code> 。'
testString: 'assert.equal(jortsort(tests[2].slice()),false,"<code>jortsort("+JSON.stringify(tests[2])+")</code> should return <code>false</code>.");'
testString: assert.equal(jortsort([12,4,51,2,4]),false);
- text: '<code>jortsort(&quot;+JSON.stringify(tests[3])+&quot;)</code>应该返回<code>true</code> 。'
testString: 'assert.equal(jortsort(tests[3].slice()),true,"<code>jortsort("+JSON.stringify(tests[3])+")</code> should return <code>true</code>.");'
testString: assert.equal(jortsort([1,2]),true);
- text: '<code>jortsort(&quot;+JSON.stringify(tests[4])+&quot;)</code>应该返回<code>false</code> 。'
testString: 'assert.equal(jortsort(tests[4].slice()),false,"<code>jortsort("+JSON.stringify(tests[4])+")</code> should return <code>false</code>.");'
testString: assert.equal(jortsort([5,4,3,2,1]),false);
- text: '<code>jortsort(&quot;+JSON.stringify(tests[5])+&quot;)</code>应该返回<code>true</code> 。'
testString: 'assert.equal(jortsort(tests[5].slice()),true,"<code>jortsort("+JSON.stringify(tests[5])+")</code> should return <code>true</code>.");'
testString: assert.equal(jortsort([1,1,1,1,1]),true);
```

View File

@@ -19,19 +19,19 @@ localeTitle: 约瑟夫斯问题
```yml
tests:
- text: <code>josephus</code>应该是一个功能。
testString: 'assert(typeof josephus=="function","<code>josephus</code> should be a function.");'
testString: assert(typeof josephus=='function');
- text: '<code>josephus(30,3)</code>应该返回一个数字。'
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>应该回<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>应该返回<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>应该返回<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>应该回归<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>应该返回<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

@@ -21,11 +21,11 @@ localeTitle: S-表达式
```yml
tests:
- text: <code>parseSexpr</code>是一个函数。
testString: 'assert(typeof parseSexpr === "function", "<code>parseSexpr</code> is a function.");'
- text: '<code>parseSexpr(&quot;(data1 data2 data3)&quot;)</code>应返回[“data1”“data2”“data3”]“)'
testString: 'assert.deepEqual(parseSexpr(simpleSExpr), simpleSolution, "<code>parseSexpr("(data1 data2 data3)")</code> should return ["data1", "data2", "data3"]");'
- text: '<code>parseSexpr(&#39;(data1 data2 data3)&#39;)</code>应该返回一个包含3个元素的数组“'
testString: 'assert.deepEqual(parseSexpr(basicSExpr), basicSolution, "<code>parseSexpr("(data1 data2 data3)")</code> should return an array with 3 elements");'
testString: assert(typeof parseSexpr === 'function');
- text: <code>parseSexpr("(data1 data2 data3)")</code>应返回[“data1”“data2”“data3”]“)
testString: assert.deepEqual(parseSexpr(simpleSExpr), simpleSolution);
- text: <code>parseSexpr("(data1 data2 data3)")</code>应该返回一个包含3个元素的数组“'
testString: assert.deepEqual(parseSexpr(basicSExpr), basicSolution);
```

View File

@@ -19,13 +19,13 @@ localeTitle: 水手,椰子和猴子问题
```yml
tests:
- text: <code>splitCoconuts</code>是一个函数。
testString: 'assert(typeof splitCoconuts === "function", "<code>splitCoconuts</code> is a function.");'
testString: assert(typeof splitCoconuts === 'function');
- text: <code>splitCoconuts(5)</code>应该返回3121。
testString: 'assert(splitCoconuts(5) === 3121, "<code>splitCoconuts(5)</code> should return 3121.");'
testString: assert(splitCoconuts(5) === 3121);
- text: <code>splitCoconuts(6)</code>应返回233275。
testString: 'assert(splitCoconuts(6) === 233275, "<code>splitCoconuts(6)</code> should return 233275.");'
testString: assert(splitCoconuts(6) === 233275);
- text: <code>splitCoconuts(7)</code>应该返回823537。
testString: 'assert(splitCoconuts(7) === 823537, "<code>splitCoconuts(7)</code> should return 823537.");'
testString: assert(splitCoconuts(7) === 823537);
```

View File

@@ -19,15 +19,15 @@ localeTitle: SEDOLs
```yml
tests:
- text: <code>sedol</code>是一个功能。
testString: 'assert(typeof sedol === "function", "<code>sedol</code> is a function.");'
- text: '<code>sedol(&#39;a&#39;)</code>应该返回null。“)'
testString: 'assert(sedol("a") === null, "<code>sedol("a")</code> should return null.");'
- text: '<code>sedol(&#39;710889&#39;)</code>应返回&#39;7108899&#39;。“)'
testString: 'assert(sedol("710889") === "7108899", "<code>sedol("710889")</code> should return "7108899".");'
- text: '<code>sedol(&#39;BOATER&#39;)</code>应该返回null。“)'
testString: 'assert(sedol("BOATER") === null, "<code>sedol("BOATER")</code> should return null.");'
- text: '<code>sedol(&#39;228276&#39;)</code>应该返回&#39;2282765&#39;。“)'
testString: 'assert(sedol("228276") === "2282765", "<code>sedol("228276")</code> should return "2282765".");'
testString: assert(typeof sedol === 'function');
- text: <code>sedol('a')</code>应该返回null。
testString: assert(sedol('a') === null);
- text: <code>sedol('710889')</code>应返回'7108899'
testString: assert(sedol('710889') === '7108899');
- text: <code>sedol('BOATER')</code>应该返回null。
testString: assert(sedol('BOATER') === null);
- text: <code>sedol('228276')</code>应该返回'228276'
testString: assert(sedol('228276') === '2282765');
```

View File

@@ -19,17 +19,17 @@ localeTitle: 出租车号码
```yml
tests:
- text: <code>taxicabNumbers</code>是一个功能。
testString: 'assert(typeof taxicabNumbers === "function", "<code>taxicabNumbers </code> is a function.");'
testString: assert(typeof taxicabNumbers === 'function');
- text: <code>taxicabNumbers</code>应该返回一个数组。
testString: 'assert(typeof taxicabNumbers(2) === "object", "<code>taxicabNumbers </code> should return an array.");'
testString: assert(typeof taxicabNumbers(2) === 'object');
- text: <code>taxicabNumbers</code>应返回一组数字。
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>必须返回[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: 'taxicabNumbers25应该返回[1729,4104,13832,20683,32832,39312,40033,46683,64232,65728,110656,110808,134379,149389,165464,171288,195841,216027,216125,262656,314696,320264 327763,373464,402597]'
testString: 'assert.deepEqual(taxicabNumbers(25), res25, "taxicabNumbers(25) 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: 'taxicabNumbers39由20 - 29得到的数字应为[314496,320264,327763,373464,402597,439101,443889,513000,513856]。'
testString: 'assert.deepEqual(taxicabNumbers(39).slice(20, 29), res39From20To29, "taxicabNumbers(39) 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

@@ -20,13 +20,13 @@ localeTitle: 使用转义标记字符串
```yml
tests:
- text: <code>tokenize</code>是一个函数。
testString: 'assert(typeof tokenize === "function", "<code>tokenize</code> is a function.");'
testString: assert(typeof tokenize === 'function');
- text: <code>tokenize</code>应该返回一个数组。
testString: 'assert(typeof tokenize("a", "b", "c") === "object", "<code>tokenize</code> should return an array.");'
- text: '<code>tokenize(&quot;one^|uno||three^^^^|four^^^|^cuatro|&quot;, &quot;|&quot;, &quot;^&quot;)</code>应返回[“one | uno”“”“three ^^” ,“四个^ | cuatro”“”]“)'
testString: 'assert.deepEqual(tokenize(testStr1, "|", "^"), res1, "<code>tokenize("one^|uno||three^^^^|four^^^|^cuatro|", "|", "^") </code> should return ["one|uno", "", "three^^", "four^|cuatro", ""]");'
- text: '<code>tokenize(&quot;a@&amp;bcd&amp;ef&amp;&amp;@@hi&quot;, &quot;&amp;&quot;, &quot;@&quot;)</code>应返回<code>[&quot;a&amp;bcd&quot;, &quot;ef&quot;, &quot;&quot;, &quot;@hi&quot;]</code>'
testString: 'assert.deepEqual(tokenize(testStr2, "&", "@"), res2, "<code>tokenize("a@&bcd&ef&&@@hi", "&", "@")</code> should return <code>["a&bcd", "ef", "", "@hi"]</code>");'
testString: assert(typeof tokenize('a', 'b', 'c') === 'object');
- text: <code>tokenize("one^|uno||three^^^^|four^^^|^cuatro|", "|", "^")</code>应返回[“one | uno”“”“three ^^” ,“四个^ | cuatro”“”]“)
testString: assert.deepEqual(tokenize(testStr1, '|', '^'), res1);
- text: '<code>tokenize("a@&amp;bcd&amp;ef&amp;&amp;@@hi", "&amp;", "@")</code>应返回<code>["a&amp;bcd", "ef", "", "@hi"]</code>'
testString: assert.deepEqual(tokenize(testStr2, '&', '@'), res2);
```

View File

@@ -41,19 +41,19 @@ localeTitle: 每组排名最高
```yml
tests:
- text: <code>topRankPerGroup</code>是一个函数。
testString: 'assert(typeof topRankPerGroup === "function", "<code>topRankPerGroup</code> is a function.");'
testString: assert(typeof topRankPerGroup === 'function');
- text: <code>topRankPerGroup</code>在负n值上返回undefined。
testString: 'assert(typeof topRankPerGroup(-1, []) === "undefined", "<code>topRankPerGroup</code> returns undefined on negative n values.");'
testString: assert(typeof topRankPerGroup(-1, []) === 'undefined');
- text: 第一部门必须是D050
testString: 'assert.equal(res1[0][0].dept, "D050", "First department must be D050");'
testString: assert.equal(res1[0][0].dept, 'D050');
- text: 第一部门必须是D050
testString: 'assert.equal(res1[0][1].salary, 21900, "First department must be D050");'
testString: assert.equal(res1[0][1].salary, 21900);
- text: 最后一个部门必须是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>必须仅返回每组的排名最高的结果。'
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>必须仅返回每组的排名最高的结果。'
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

@@ -34,15 +34,15 @@ std_cell_lib ieee std_cell_lib
```yml
tests:
- text: <code>topologicalSort</code>是一个函数。
testString: 'assert(typeof topologicalSort === "function", "<code>topologicalSort</code> is a function.");'
testString: assert(typeof topologicalSort === 'function');
- text: <code>topologicalSort</code>必须返回正确的库顺序..
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>必须返回正确的库顺序..
testString: 'assert.deepEqual(topologicalSort(libsVHDL), solutionVHDL, "<code>topologicalSort</code> must return correct library order..");'
testString: assert.deepEqual(topologicalSort(libsVHDL), solutionVHDL);
- text: <code>topologicalSort</code>必须返回正确的库顺序..
testString: 'assert.deepEqual(topologicalSort(libsCustom), solutionCustom, "<code>topologicalSort</code> must return correct library order..");'
testString: assert.deepEqual(topologicalSort(libsCustom), solutionCustom);
- text: <code>topologicalSort</code>必须忽略不可共享的依赖项。
testString: 'assert.deepEqual(topologicalSort(libsUnorderable), solutionUnorderable, "<code>topologicalSort</code> must ignore unorderable dependencies..");'
testString: assert.deepEqual(topologicalSort(libsUnorderable), solutionUnorderable);
```

View File

@@ -19,15 +19,15 @@ localeTitle: 河内的塔
```yml
tests:
- text: <code>towerOfHanoi</code>是一个功能。
testString: 'assert(typeof towerOfHanoi === "function", "<code>towerOfHanoi</code> is a function.");'
- text: ''
testString: 'assert(res3.length === 7, "<code>towerOfHanoi(3, ...)</code> should return 7 moves.");'
- text: '<code>towerOfHanoi(3, &quot;A&quot;, &quot;B&quot;, &quot;C&quot;)</code>应返回[[“A”“B”][“A”“C”][“B”“C”][ “A” “B”][ “C” “A”][ “C” “B”][ “A” “B”]]“)。'
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"]].");'
- text: '<code>towerOfHanoi(5, &quot;X&quot;, &quot;Y&quot;, &quot;Z&quot;)</code>第10 <code>towerOfHanoi(5, &quot;X&quot;, &quot;Y&quot;, &quot;Z&quot;)</code>应为Y - &gt; X.'
testString: 'assert.deepEqual(res5[9], ["Y", "X"], "<code>towerOfHanoi(5, "X", "Y", "Z")</code> 10th move should be Y -> X.");'
- text: '<code>towerOfHanoi(7, &quot;A&quot;, &quot;B&quot;, &quot;C&quot;)</code>前十个动作是[[“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, "<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(typeof towerOfHanoi === 'function');
- text: <code>towerOfHanoi(3, ...)</code> 应该返回7招。
testString: assert(res3.length === 7);
- text: <code>towerOfHanoi(3, "A", "B", "C")</code>应返回[[“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>第10 <code>towerOfHanoi(5, "X", "Y", "Z")</code>应为Y - &gt; X.
testString: assert.deepEqual(res5[9], ['Y', 'X']);
- text: <code>towerOfHanoi(7, "A", "B", "C")</code>前十个动作是[[“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

@@ -19,11 +19,11 @@ localeTitle: 矢量交叉产品
```yml
tests:
- text: dotProduct必须是一个函数
testString: 'assert.equal(typeof crossProduct, "function", "dotProduct must be a function");'
testString: assert.equal(typeof crossProduct, 'function');
- text: dotProduct必须返回null
testString: 'assert.equal(crossProduct(), null, "dotProduct() must return null");'
testString: assert.equal(crossProduct(), null);
- text: 'crossProduct[1,2,3][4,5,6])必须返回[-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

@@ -19,17 +19,17 @@ localeTitle: 矢量点积
```yml
tests:
- text: dotProduct必须是一个函数
testString: 'assert.equal(typeof dotProduct, "function", "dotProduct must be a function");'
testString: assert.equal(typeof dotProduct, 'function');
- text: dotProduct必须返回null
testString: 'assert.equal(dotProduct(), null, "dotProduct() must return null");'
testString: assert.equal(dotProduct(), null);
- text: 'dotProduct[[1][1]]必须返回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]]必须返回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]必须返回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>应该返回<code>dotProduct(...nVectors)</code>
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

@@ -26,18 +26,18 @@ localeTitle: 自动换行
```yml
tests:
- text: ''
testString: 'assert.equal(typeof wrap, "function", "wrap must be a function.");'
- text: ''
testString: 'assert.equal(typeof wrap("abc", 10), "string", "wrap must return a string.");'
- text: <code>wrap</code>是一个功能。
testString: assert.equal(typeof wrap, 'function');
- text: <code>wrap("abc", 10)</code>必须返回一个字符串。
testString: assert.equal(typeof wrap('abc', 10), 'string');
- text: wrap80必须返回4行。
testString: 'assert(wrapped80.split("\n").length === 4, "wrap(80) must return 4 lines.");'
testString: assert(wrapped80.split('\n').length === 4);
- text: 你的<code>wrap</code>函数应该返回我们期望的文本
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: wrap42必须返回7行。
testString: 'assert(wrapped42.split("\n").length === 7, "wrap(42) must return 7 lines.");'
testString: assert(wrapped42.split('\n').length === 7);
- text: 你的<code>wrap</code>函数应该返回我们期望的文本
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

@@ -19,17 +19,17 @@ localeTitle: 和组合
```yml
tests:
- text: Y必须返回一个函数
testString: 'assert.equal(typeof Y(f => n => n), "function", "Y must return a function");'
testString: assert.equal(typeof Y(f => n => n), 'function');
- text: factorial1必须返回1。
testString: 'assert.equal(factorial(1), 1, "factorial(1) must return 1.");'
testString: assert.equal(factorial(1), 1);
- text: factorial2必须返回2。
testString: 'assert.equal(factorial(2), 2, "factorial(2) must return 2.");'
testString: assert.equal(factorial(2), 2);
- text: factorial3必须返回6。
testString: 'assert.equal(factorial(3), 6, "factorial(3) must return 6.");'
testString: assert.equal(factorial(3), 6);
- text: factorial4必须返回24。
testString: 'assert.equal(factorial(4), 24, "factorial(4) must return 24.");'
testString: assert.equal(factorial(4), 24);
- text: factorial10必须返回3628800。
testString: 'assert.equal(factorial(10), 3628800, "factorial(10) must return 3628800.");'
testString: assert.equal(factorial(10), 3628800);
```

View File

@@ -19,9 +19,9 @@ localeTitle: 勾选村号码表示
```yml
tests:
- text: zeckendorf必须是功能
testString: 'assert.equal(typeof zeckendorf, "function", "zeckendorf must be function");'
testString: assert.equal(typeof zeckendorf, 'function');
- text: 你的<code>zeckendorf</code>函数应该返回正确的答案
testString: 'assert.deepEqual(answer, solution20, "Your <code>zeckendorf</code> function should return the correct answer");'
testString: assert.deepEqual(answer, solution20);
```

View File

@@ -69,13 +69,13 @@ localeTitle: 张素细化算法
```yml
tests:
- text: <code>thinImage</code>必须是一个函数
testString: 'assert.equal(typeof thinImage, "function", "<code>thinImage</code> must be a function");'
testString: assert.equal(typeof thinImage, 'function');
- text: <code>thinImage</code>必须返回一个数组
testString: 'assert(Array.isArray(result), "<code>thinImage</code> must return an array");'
testString: assert(Array.isArray(result));
- text: <code>thinImage</code>必须返回一个字符串数组
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>必须返回一个字符串数组
testString: 'assert.deepEqual(result, expected, "<code>thinImage</code> must return an array of strings");'
testString: assert.deepEqual(result, expected);
```

View File

@@ -24,17 +24,17 @@ localeTitle: 之字形矩阵
```yml
tests:
- text: ZigZagMatrix必须是一个功能
testString: 'assert.equal(typeof ZigZagMatrix, "function", "ZigZagMatrix must be a function");'
testString: assert.equal(typeof ZigZagMatrix, 'function');
- text: ZigZagMatrix应该返回数组
testString: 'assert.equal(typeof ZigZagMatrix(1), "object", "ZigZagMatrix should return array");'
testString: assert.equal(typeof ZigZagMatrix(1), 'object');
- text: ZigZagMatrix应该返回一个nestes数组的数组
testString: 'assert.equal(typeof ZigZagMatrix(1)[0], "object", "ZigZagMatrix should return an array of nestes arrays");'
testString: assert.equal(typeof ZigZagMatrix(1)[0], 'object');
- text: 'ZigZagMatrix1应返回[[0]]'
testString: 'assert.deepEqual(ZigZagMatrix(1), zm1, "ZigZagMatrix(1) should return [[0]]");'
testString: assert.deepEqual(ZigZagMatrix(1), zm1);
- text: 'ZigZagMatrix2应返回[[0,1][2,3]]'
testString: 'assert.deepEqual(ZigZagMatrix(2), zm2, "ZigZagMatrix(2) should return [[0, 1], [2, 3]]");'
testString: assert.deepEqual(ZigZagMatrix(2), zm2);
- text: ZigZagMatrix5必须返回指定的矩阵
testString: 'assert.deepEqual(ZigZagMatrix(5), zm5, "ZigZagMatrix(5) must return specified matrix");'
testString: assert.deepEqual(ZigZagMatrix(5), zm5);
```