The actual algorithms from the course are implemented using JavaScript. I wanted to experiment with Jest and Flow. The course work is actually in Java as that is the language they expect. I am using Gradle to test drive the assignments.
I am assuming you have both Node.js and Java installed.
Install Flow globally:
brew install flow
Install Gradle:
brew install gradle
Install dependencies:
npm i
or yarn
Run the tests:
npm test
or yarn test
Output:
yarn run v1.3.2
$ jest --coverage
PASS union-find/weighted-quick-union-with-path-compression/WeightedQuickUnionWithPathCompression.spec.js
PASS union-find/quick-union/QuickUnion.spec.js
PASS union-find/weighted-quick-union/WeightedQuickUnion.spec.js
PASS union-find/quick-find/QuickFind.spec.js
Test Suites: 4 passed, 4 total
Tests: 28 passed, 28 total
Snapshots: 0 total
Time: 0.555s, estimated 1s
Ran all test suites.
--------------------------------------------|----------|----------|----------|----------|----------------|
File | % Stmts | % Branch | % Funcs | % Lines |Uncovered Lines |
--------------------------------------------|----------|----------|----------|----------|----------------|
All files | 100 | 100 | 100 | 100 | |
quick-find | 100 | 100 | 100 | 100 | |
QuickFind.js | 100 | 100 | 100 | 100 | |
quick-union | 100 | 100 | 100 | 100 | |
QuickUnion.js | 100 | 100 | 100 | 100 | |
weighted-quick-union | 100 | 100 | 100 | 100 | |
WeightedQuickUnion.js | 100 | 100 | 100 | 100 | |
weighted-quick-union-with-path-compression | 100 | 100 | 100 | 100 | |
WeightedQuickUnionWithPathCompression.js | 100 | 100 | 100 | 100 | |
--------------------------------------------|----------|----------|----------|----------|----------------|
✨ Done in 1.26s.
Notes:
Go to union-find/assignment/
and assuming you have both Java and Gradle installed, just run:
./gradlew clean test
Output:
BUILD SUCCESSFUL in 1s
4 actionable tasks: 4 executed
Notes:
The details of the assignment are here.
Go to bags-queues-and-stacks/assignment/
and assuming you have both Java and Gradle installed, just run:
./gradlew clean test
Output:
???? Coming soon