Skip to content

Commit 6cd80c4

Browse files
committed
Add task
1 parent 5b8d49b commit 6cd80c4

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

Exercises/1-power.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
'use strict';
2+
3+
const power = null;
4+
const square = null;
5+
const cube = null;
6+
7+
module.exports = { power, square, cube };

Exercises/1-power.test

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
[{
2+
name: 'power',
3+
length: [32, 32],
4+
cases: [
5+
[0, 0, 1],
6+
[1, 1, 1],
7+
[1, 2, 1],
8+
[2, 1, 2],
9+
[2, 2, 4],
10+
[3, 1, 3],
11+
[3, 2, 9],
12+
[3, 3, 27],
13+
[1, -1, 1],
14+
[1, -2, 1],
15+
[2, -1, 0.5],
16+
[2, -2, 0.25],
17+
],
18+
test: power => {
19+
const src = power.toString();
20+
if (src !== 'function pow() { [native code] }') {
21+
throw new Error('Function power expected to be reference to Math.pow');
22+
}
23+
}
24+
}, {
25+
name: 'square',
26+
length: [10, 25],
27+
cases: [
28+
]
29+
}, {
30+
name: 'cube',
31+
length: [29, 29],
32+
test: cube => {
33+
const src = cube.toString();
34+
if (src !== 'function () { [native code] }') {
35+
throw new Error('Function cube expected to be binded Math.pow');
36+
}
37+
}
38+
}]

0 commit comments

Comments
 (0)