-
Notifications
You must be signed in to change notification settings - Fork 11
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
1 parent
2165dde
commit e278fc1
Showing
90 changed files
with
754 additions
and
98 deletions.
There are no files selected for viewing
File renamed without changes.
4 changes: 1 addition & 3 deletions
4
src/pages/exercises/function-area-of-circle/_codes/js/code/area-of-circle.js
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 |
---|---|---|
@@ -1,5 +1,3 @@ | ||
function areaOfCircle(radius) { | ||
export function areaOfCircle(radius) { | ||
// TODO A = πr² | ||
} | ||
|
||
export { areaOfCircle }; |
15 changes: 15 additions & 0 deletions
15
src/pages/exercises/function-area-of-circle/_codes/js/code/area-of-circle.node.test.js
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,15 @@ | ||
import { describe, it } from 'node:test'; | ||
import assert from 'node:assert'; | ||
import { areaOfCircle } from './area-of-circle.js'; | ||
|
||
describe('Circle Tools', () => { | ||
describe('areaOfCircle()', () => { | ||
it('should calculate the area of the circle', () => { | ||
assert.equal(areaOfCircle(10), 314.1592653589793); | ||
}); | ||
|
||
it('should calculate the area of the circle', () => { | ||
assert.equal(areaOfCircle(1), 3.141592653589793); | ||
}); | ||
}); | ||
}); |
2 changes: 1 addition & 1 deletion
2
src/pages/exercises/function-area-of-circle/_codes/js/code/area-of-circle.print.js
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
3 changes: 3 additions & 0 deletions
3
src/pages/exercises/function-area-of-circle/_codes/js/code/package.json
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,3 @@ | ||
{ | ||
"type": "module" | ||
} |
16 changes: 6 additions & 10 deletions
16
..._codes/js/response/area-of-circle.test.js → ...s/js/response/area-of-circle.jest.test.js
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 |
---|---|---|
@@ -1,15 +1,11 @@ | ||
import { | ||
areaOfCircle | ||
} from './area-of-circle.js' | ||
import { areaOfCircle } from './area-of-circle.js'; | ||
|
||
describe('Circle Tools', () => { | ||
|
||
test('Area of the circle of radius 10 is of 31.41592653589793', () => { | ||
expect(areaOfCircle(10)).toBe(314.1592653589793) | ||
}) | ||
expect(areaOfCircle(10)).toBe(314.1592653589793); | ||
}); | ||
|
||
test('Area of the circle of radius 1 is of 3.141592653589793', () => { | ||
expect(areaOfCircle(1)).toBe(3.141592653589793) | ||
}) | ||
|
||
}) | ||
expect(areaOfCircle(1)).toBe(3.141592653589793); | ||
}); | ||
}); |
8 changes: 3 additions & 5 deletions
8
src/pages/exercises/function-area-of-circle/_codes/js/response/area-of-circle.js
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 |
---|---|---|
@@ -1,13 +1,11 @@ | ||
// A = πr² | ||
|
||
function areaOfCircle(radius) { | ||
export function areaOfCircle(radius) { | ||
return Math.PI * radius ** 2; | ||
} | ||
|
||
const areaOfCircleWithAnonymous = function(radius) { | ||
export const areaOfCircleWithAnonymous = function (radius) { | ||
return Math.PI * radius ** 2; | ||
}; | ||
|
||
const areaOfCircleWithArrow = radius => Math.PI * radius ** 2; | ||
|
||
export { areaOfCircle, areaOfCircleWithAnonymous, areaOfCircleWithArrow }; | ||
export const areaOfCircleWithArrow = (radius) => Math.PI * radius ** 2; |
15 changes: 15 additions & 0 deletions
15
src/pages/exercises/function-area-of-circle/_codes/js/response/area-of-circle.node.test.js
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,15 @@ | ||
import { describe, it } from 'node:test'; | ||
import assert from 'node:assert'; | ||
import { areaOfCircle } from './area-of-circle.js'; | ||
|
||
describe('Circle Tools', () => { | ||
describe('areaOfCircle()', () => { | ||
it('should calculate the area of the circle', () => { | ||
assert.equal(areaOfCircle(10), 314.1592653589793); | ||
}); | ||
|
||
it('should calculate the area of the circle', () => { | ||
assert.equal(areaOfCircle(1), 3.141592653589793); | ||
}); | ||
}); | ||
}); |
12 changes: 5 additions & 7 deletions
12
src/pages/exercises/function-area-of-circle/_codes/js/response/area-of-circle.print.js
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 |
---|---|---|
@@ -1,13 +1,11 @@ | ||
import { | ||
areaOfCircle | ||
} from './area-of-circle.js' | ||
import { areaOfCircle } from './area-of-circle.js'; | ||
|
||
// Circle Tools | ||
|
||
// Area of the circle of radius 10 is of 31.41592653589793 | ||
console.log(areaOfCircle(10)) | ||
console.log(314.1592653589793) | ||
console.log(areaOfCircle(10)); | ||
console.log(314.1592653589793); | ||
|
||
// Area of the circle of radius 1 is of 3.141592653589793 | ||
console.log(areaOfCircle(1)) | ||
console.log(3.141592653589793) | ||
console.log(areaOfCircle(1)); | ||
console.log(3.141592653589793); |
3 changes: 3 additions & 0 deletions
3
src/pages/exercises/function-area-of-circle/_codes/js/response/package.json
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,3 @@ | ||
{ | ||
"type": "module" | ||
} |
File renamed without changes.
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 |
---|---|---|
@@ -1,8 +1,6 @@ | ||
/** | ||
* operator: '+', '-', '*', '/' | ||
*/ | ||
function calc(operand1, operand2, operator) { | ||
export function calc(operand1, operand2, operator) { | ||
// TODO | ||
} | ||
|
||
export { calc }; |
27 changes: 27 additions & 0 deletions
27
src/pages/exercises/function-calc/_codes/js/code/calc.node.test.js
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,27 @@ | ||
import { describe, it } from 'node:test'; | ||
import assert from 'node:assert'; | ||
import { calc } from './calc.js'; | ||
|
||
describe('Calculator', () => { | ||
describe('calc()', () => { | ||
it('should add values', () => { | ||
assert.equal(calc(1, 1, '+'), 2); | ||
assert.equal(calc(10, 5, '+'), 15); | ||
}); | ||
|
||
it('should subtract values', () => { | ||
assert.equal(calc(1, 1, '-'), 0); | ||
assert.equal(calc(10, 5, '-'), 5); | ||
}); | ||
|
||
it('should multiply values', () => { | ||
assert.equal(calc(1, 1, '*'), 1); | ||
assert.equal(calc(10, 5, '*'), 50); | ||
}); | ||
|
||
it('should divide values', () => { | ||
assert.equal(calc(1, 1, '/'), 1); | ||
assert.equal(calc(10, 5, '/'), 2); | ||
}); | ||
}); | ||
}); |
3 changes: 3 additions & 0 deletions
3
src/pages/exercises/function-calc/_codes/js/code/package.json
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,3 @@ | ||
{ | ||
"type": "module" | ||
} |
File renamed without changes.
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
27 changes: 27 additions & 0 deletions
27
src/pages/exercises/function-calc/_codes/js/response/calc.node.test.js
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,27 @@ | ||
import { describe, it } from 'node:test'; | ||
import assert from 'node:assert'; | ||
import { calc } from './calc.js'; | ||
|
||
describe('Calculator', () => { | ||
describe('calc()', () => { | ||
it('should add values', () => { | ||
assert.equal(calc(1, 1, '+'), 2); | ||
assert.equal(calc(10, 5, '+'), 15); | ||
}); | ||
|
||
it('should subtract values', () => { | ||
assert.equal(calc(1, 1, '-'), 0); | ||
assert.equal(calc(10, 5, '-'), 5); | ||
}); | ||
|
||
it('should multiply values', () => { | ||
assert.equal(calc(1, 1, '*'), 1); | ||
assert.equal(calc(10, 5, '*'), 50); | ||
}); | ||
|
||
it('should divide values', () => { | ||
assert.equal(calc(1, 1, '/'), 1); | ||
assert.equal(calc(10, 5, '/'), 2); | ||
}); | ||
}); | ||
}); |
3 changes: 3 additions & 0 deletions
3
src/pages/exercises/function-calc/_codes/js/response/package.json
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,3 @@ | ||
{ | ||
"type": "module" | ||
} |
File renamed without changes.
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
68 changes: 68 additions & 0 deletions
68
src/pages/exercises/function-calendar/_codes/js/code/calendar.node.test.js
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,68 @@ | ||
import { describe, it } from 'node:test'; | ||
import assert from 'node:assert'; | ||
import { calendar } from './calendar.js'; | ||
|
||
describe('Calendar Tool', () => { | ||
describe('calendar()', () => { | ||
it('making month starting on Sunday and ending on the 31st', () => { | ||
assert.equal( | ||
calendar(0, 31), | ||
`DOM SEG TER QUA QUI SEX SAB | ||
01 02 03 04 05 06 07 | ||
08 09 10 11 12 13 14 | ||
15 16 17 18 19 20 21 | ||
22 23 24 25 26 27 28 | ||
29 30 31` | ||
); | ||
}); | ||
|
||
it('making month starting on Monday and ending on the 31st', () => { | ||
assert.equal( | ||
calendar(1, 31), | ||
`DOM SEG TER QUA QUI SEX SAB | ||
01 02 03 04 05 06 | ||
07 08 09 10 11 12 13 | ||
14 15 16 17 18 19 20 | ||
21 22 23 24 25 26 27 | ||
28 29 30 31` | ||
); | ||
}); | ||
|
||
it('making month starting on Tuesday and ending on the 30st', () => { | ||
assert.equal( | ||
calendar(2, 30), | ||
`DOM SEG TER QUA QUI SEX SAB | ||
01 02 03 04 05 | ||
06 07 08 09 10 11 12 | ||
13 14 15 16 17 18 19 | ||
20 21 22 23 24 25 26 | ||
27 28 29 30` | ||
); | ||
}); | ||
|
||
it('making month starting on Wednesday and ending on the 29st', () => { | ||
assert.equal( | ||
calendar(3, 29), | ||
`DOM SEG TER QUA QUI SEX SAB | ||
01 02 03 04 | ||
05 06 07 08 09 10 11 | ||
12 13 14 15 16 17 18 | ||
19 20 21 22 23 24 25 | ||
26 27 28 29` | ||
); | ||
}); | ||
|
||
it('making month starting on Saturday and ending on the 31st', () => { | ||
assert.equal( | ||
calendar(6, 31), | ||
`DOM SEG TER QUA QUI SEX SAB | ||
01 | ||
02 03 04 05 06 07 08 | ||
09 10 11 12 13 14 15 | ||
16 17 18 19 20 21 22 | ||
23 24 25 26 27 28 29 | ||
30 31` | ||
); | ||
}); | ||
}); | ||
}); |
3 changes: 3 additions & 0 deletions
3
src/pages/exercises/function-calendar/_codes/js/code/package.json
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,3 @@ | ||
{ | ||
"type": "module" | ||
} |
File renamed without changes.
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
68 changes: 68 additions & 0 deletions
68
src/pages/exercises/function-calendar/_codes/js/response/calendar.node.test.js
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,68 @@ | ||
import { describe, it } from 'node:test'; | ||
import assert from 'node:assert'; | ||
import { calendar } from './calendar.js'; | ||
|
||
describe('Calendar Tool', () => { | ||
describe('calendar()', () => { | ||
it('making month starting on Sunday and ending on the 31st', () => { | ||
assert.equal( | ||
calendar(0, 31), | ||
`DOM SEG TER QUA QUI SEX SAB | ||
01 02 03 04 05 06 07 | ||
08 09 10 11 12 13 14 | ||
15 16 17 18 19 20 21 | ||
22 23 24 25 26 27 28 | ||
29 30 31` | ||
); | ||
}); | ||
|
||
it('making month starting on Monday and ending on the 31st', () => { | ||
assert.equal( | ||
calendar(1, 31), | ||
`DOM SEG TER QUA QUI SEX SAB | ||
01 02 03 04 05 06 | ||
07 08 09 10 11 12 13 | ||
14 15 16 17 18 19 20 | ||
21 22 23 24 25 26 27 | ||
28 29 30 31` | ||
); | ||
}); | ||
|
||
it('making month starting on Tuesday and ending on the 30st', () => { | ||
assert.equal( | ||
calendar(2, 30), | ||
`DOM SEG TER QUA QUI SEX SAB | ||
01 02 03 04 05 | ||
06 07 08 09 10 11 12 | ||
13 14 15 16 17 18 19 | ||
20 21 22 23 24 25 26 | ||
27 28 29 30` | ||
); | ||
}); | ||
|
||
it('making month starting on Wednesday and ending on the 29st', () => { | ||
assert.equal( | ||
calendar(3, 29), | ||
`DOM SEG TER QUA QUI SEX SAB | ||
01 02 03 04 | ||
05 06 07 08 09 10 11 | ||
12 13 14 15 16 17 18 | ||
19 20 21 22 23 24 25 | ||
26 27 28 29` | ||
); | ||
}); | ||
|
||
it('making month starting on Saturday and ending on the 31st', () => { | ||
assert.equal( | ||
calendar(6, 31), | ||
`DOM SEG TER QUA QUI SEX SAB | ||
01 | ||
02 03 04 05 06 07 08 | ||
09 10 11 12 13 14 15 | ||
16 17 18 19 20 21 22 | ||
23 24 25 26 27 28 29 | ||
30 31` | ||
); | ||
}); | ||
}); | ||
}); |
3 changes: 3 additions & 0 deletions
3
src/pages/exercises/function-calendar/_codes/js/response/package.json
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,3 @@ | ||
{ | ||
"type": "module" | ||
} |
File renamed without changes.
4 changes: 1 addition & 3 deletions
4
src/pages/exercises/function-factorial/_codes/js/code/factorial.js
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 |
---|---|---|
@@ -1,5 +1,3 @@ | ||
function factorial(number) { | ||
export function factorial(number) { | ||
// TODO | ||
} | ||
|
||
export { factorial }; |
Oops, something went wrong.