fix(curriculum): quotes in tests (#18828)
* fix(curriculum): tests quotes * fix(curriculum): fill seed-teardown * fix(curriculum): fix tests and remove unneeded seed-teardown
This commit is contained in:
committed by
mrugesh mohapatra
parent
96eb124163
commit
79d9012432
@@ -73,15 +73,15 @@ C.f.:
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>topologicalSort</code> is a function.
|
||||
testString: 'assert(typeof topologicalSort === "function", "<code>topologicalSort</code> is a function.");'
|
||||
testString: assert(typeof topologicalSort === 'function', '<code>topologicalSort</code> is a function.');
|
||||
- text: <code>topologicalSort</code> must return correct library order..
|
||||
testString: 'assert.deepEqual(topologicalSort(libsSimple), ["bbb", "aaa"], "<code>topologicalSort</code> must return correct library order..");'
|
||||
testString: assert.deepEqual(topologicalSort(libsSimple), ['bbb', 'aaa'], '<code>topologicalSort</code> must return correct library order..');
|
||||
- text: <code>topologicalSort</code> must return correct library order..
|
||||
testString: 'assert.deepEqual(topologicalSort(libsVHDL), solutionVHDL, "<code>topologicalSort</code> must return correct library order..");'
|
||||
testString: assert.deepEqual(topologicalSort(libsVHDL), solutionVHDL, '<code>topologicalSort</code> must return correct library order..');
|
||||
- text: <code>topologicalSort</code> must return correct library order..
|
||||
testString: 'assert.deepEqual(topologicalSort(libsCustom), solutionCustom, "<code>topologicalSort</code> must return correct library order..");'
|
||||
testString: assert.deepEqual(topologicalSort(libsCustom), solutionCustom, '<code>topologicalSort</code> must return correct library order..');
|
||||
- text: <code>topologicalSort</code> must ignore unorderable dependencies..
|
||||
testString: 'assert.deepEqual(topologicalSort(libsUnorderable), solutionUnorderable, "<code>topologicalSort</code> must ignore unorderable dependencies..");'
|
||||
testString: assert.deepEqual(topologicalSort(libsUnorderable), solutionUnorderable, '<code>topologicalSort</code> must ignore unorderable dependencies..');
|
||||
|
||||
```
|
||||
|
||||
@@ -106,7 +106,45 @@ function topologicalSort(libs) {
|
||||
<div id='js-teardown'>
|
||||
|
||||
```js
|
||||
console.info('after the test');
|
||||
const libsSimple =
|
||||
`aaa bbb
|
||||
bbb`;
|
||||
|
||||
const libsVHDL =
|
||||
`des_system_lib std synopsys std_cell_lib des_system_lib dw02 dw01 ramlib ieee
|
||||
dw01 ieee dw01 dware gtech
|
||||
dw02 ieee dw02 dware
|
||||
dw03 std synopsys dware dw03 dw02 dw01 ieee gtech
|
||||
dw04 dw04 ieee dw01 dware gtech
|
||||
dw05 dw05 ieee dware
|
||||
dw06 dw06 ieee dware
|
||||
dw07 ieee dware
|
||||
dware ieee dware
|
||||
gtech ieee gtech
|
||||
ramlib std ieee
|
||||
std_cell_lib ieee std_cell_lib
|
||||
synopsys`;
|
||||
|
||||
const solutionVHDL = [
|
||||
'ieee', 'std_cell_lib', 'gtech', 'dware', 'dw07', 'dw06',
|
||||
'dw05', 'dw02', 'dw01', 'dw04', 'std', 'ramlib', 'synopsys',
|
||||
'dw03', 'des_system_lib'
|
||||
];
|
||||
|
||||
const libsCustom =
|
||||
`a b c d
|
||||
b c d
|
||||
d c
|
||||
c base
|
||||
base`;
|
||||
const solutionCustom = ['base', 'c', 'd', 'b', 'a'];
|
||||
|
||||
const libsUnorderable =
|
||||
`TestLib Base MainLib
|
||||
MainLib TestLib
|
||||
Base`;
|
||||
|
||||
const solutionUnorderable = ['Base'];
|
||||
```
|
||||
|
||||
</div>
|
||||
@@ -123,7 +161,7 @@ function topologicalSort(libs) {
|
||||
// and array of packages on which it depends.
|
||||
const D = libs
|
||||
.split('\n')
|
||||
.map(e => e.split(' ').filter(ep => ep !== "))
|
||||
.map(e => e.split(' ').filter(ep => ep !== ''))
|
||||
.reduce((p, c) =>
|
||||
p.set(c[0], c.filter((e, i) => (i > 0 && e !== c[0] ? e : null))), new Map());
|
||||
[].concat(...D.values()).forEach(e => {
|
||||
|
||||
Reference in New Issue
Block a user