From 052f6c96636b3245367e32e880353ef91c8d6b9a Mon Sep 17 00:00:00 2001 From: Chris McDermut Date: Wed, 13 May 2020 14:55:33 -0700 Subject: [PATCH] topo Sorting beginning --- challenges/topologicalSort/topologicalSort.js | 5 +++++ .../topologicalSort/topologicalSort.test.js | 20 +++++++++++++++++++ .../topologicalSort/topologicalSortNotes.md | 1 + .../topologicalSort/topologicalSortSpec.md | 2 ++ helpers/generateSolution.js | 2 +- 5 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 challenges/topologicalSort/topologicalSort.js create mode 100644 challenges/topologicalSort/topologicalSort.test.js create mode 100644 challenges/topologicalSort/topologicalSortNotes.md create mode 100644 challenges/topologicalSort/topologicalSortSpec.md diff --git a/challenges/topologicalSort/topologicalSort.js b/challenges/topologicalSort/topologicalSort.js new file mode 100644 index 00000000..7239f928 --- /dev/null +++ b/challenges/topologicalSort/topologicalSort.js @@ -0,0 +1,5 @@ +function topologicalSort(input) { + +} + +module.exports = topologicalSort diff --git a/challenges/topologicalSort/topologicalSort.test.js b/challenges/topologicalSort/topologicalSort.test.js new file mode 100644 index 00000000..6be74c38 --- /dev/null +++ b/challenges/topologicalSort/topologicalSort.test.js @@ -0,0 +1,20 @@ +const topologicalSort = require('./topologicalSort') + +const testOne = { + input: [[1, 0]], + output: [0, 1] +} + +const testOneA = { + input: [[1, 0], [2, 0], [3, 1], [3, 2]], + output: [[0, 1, 2, 3], [0, 2, 1, 3]] +} + +describe('topologicalSort Test', () => { + + test('testOne', ()=>{ + let result = topologicalSort(testOne.input) + expect(testOneA.output).toContainEqual(result); + }) + +}) diff --git a/challenges/topologicalSort/topologicalSortNotes.md b/challenges/topologicalSort/topologicalSortNotes.md new file mode 100644 index 00000000..67d912bf --- /dev/null +++ b/challenges/topologicalSort/topologicalSortNotes.md @@ -0,0 +1 @@ +topologicalSort Notes go here! \ No newline at end of file diff --git a/challenges/topologicalSort/topologicalSortSpec.md b/challenges/topologicalSort/topologicalSortSpec.md new file mode 100644 index 00000000..5aeaa22e --- /dev/null +++ b/challenges/topologicalSort/topologicalSortSpec.md @@ -0,0 +1,2 @@ +topologicalSort Spec go here! +-https://www.geeksforgeeks.org/find-the-ordering-of-tasks-from-given-dependencies/ diff --git a/helpers/generateSolution.js b/helpers/generateSolution.js index ba93d2d4..d9c59295 100644 --- a/helpers/generateSolution.js +++ b/helpers/generateSolution.js @@ -4,7 +4,7 @@ const fs = require('fs'); const directory = 'challenges'; -const solutionName = 'stockProfit'; +const solutionName = 'topologicalSort'; const spec = `${solutionName} Spec go here!`; const notes = `${solutionName} Notes go here!`;