-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
74 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Week 18 challenge | ||
|
||
![Vegeta with scouter](image.jpg) | ||
|
||
You've been tasked to help Vegeta read data from his scouter. Unfortunately he can't read digits because of the shitty free font used by the developers. Please write a script that accepts a number as input and gives back the number as text. | ||
|
||
Examples: | ||
``` | ||
getSaiyanLevel(0); // zero | ||
getSaiyanLevel(10); // ten | ||
getSaiyanLevel(30); // thirty | ||
getSaiyanLevel(5000); // five thousand | ||
getSaiyanLevel(1234); // one thousand two hundred and thirty four | ||
``` | ||
|
||
Since Vegeta doesn't comprehend levels beyond 9000 just let him know: | ||
|
||
``` | ||
getSaiyanLevel(9001); // it's over 9000! | ||
``` | ||
|
||
## Background | ||
![meme origin](over9000.png) | ||
|
||
[Over 9000 on Wikipedia](https://en.wikipedia.org/wiki/It%27s_Over_9000!) | ||
|
||
## Author | ||
|
||
Mettin | ||
|
||
## Upload link | ||
|
||
[https://forms.gle/Q9ZHpSfHJVpNE3U49] | ||
|
||
|
||
## Results | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
const getSaiyanLevel = (input) => { | ||
// your solution here | ||
|
||
return undefined; | ||
}; | ||
|
||
module.exports = getSaiyanLevel; |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
const fs = require("fs"); | ||
const path = require("path"); | ||
const spec = require("./test-cases/spec.json"); | ||
const solutions = fs.readdirSync(path.resolve(__dirname, "solutions")); | ||
|
||
describe.each(solutions)("%s", (filename) => { | ||
const evaluate = require(path.resolve(__dirname, "solutions", filename)); | ||
test.each([ | ||
[0, 'zero'], | ||
[1, 'one'], | ||
[100, 'one hundred'], | ||
[200, 'two hundred'], | ||
[40, 'forty'], | ||
[420, 'four hundred and twenty'], | ||
[1234, 'one thousand two hundred and thirty four'], | ||
[9001, 'it\'s over nine thousand!'], | ||
])("%j = %j", (input, result) => { | ||
expect(evaluate(input)).toBe(result); | ||
}); | ||
|
||
test.each(spec.map(({ inputs, result }) => [inputs[0], result]))( | ||
"%j = %j", | ||
(input, result) => { | ||
expect(evaluate(input)).toEqual(result); | ||
} | ||
); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters