Skip to content

Commit 8d09309

Browse files
committed
update baby-steps; add calculator initial operations b00tc4mp#1
1 parent 2cf348d commit 8d09309

File tree

9 files changed

+69
-0
lines changed

9 files changed

+69
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
let a: number
2+
3+
a = 123
4+
5+
console.log(a)
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import { add } from "./add"
2+
3+
console.info("TEST add")
4+
5+
6+
console.info("CASE a is 10 and b is 20 then r 30")
7+
8+
{
9+
const r = add(10, 20)
10+
11+
console.assert(r === 30, 'r is 30')
12+
}
13+
14+
15+
console.info("CASE a is -10 and b is 20 then r 10")
16+
17+
{
18+
const r = add(-10, 20)
19+
20+
console.assert(r === 10, "r is 10")
21+
}
22+
23+
console.info("CASE a is -10 and b is -20 then r -30")
24+
25+
{
26+
const r = add(-10, -20)
27+
28+
console.assert(r === -30, "rs is -30")
29+
}
30+
31+
console.info("CASE a is NaN and b is 20 then r NaN")
32+
33+
{
34+
const r = add(NaN, 20)
35+
36+
console.assert(isNaN(r), "r is NaN")
37+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const add = (a: number, b: number): number => a + b

staff/manuel-barzi/playground/calculator/div.test.ts

Whitespace-only changes.

staff/manuel-barzi/playground/calculator/mul.test.ts

Whitespace-only changes.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { pow } from "./pow"
2+
3+
console.info("TEST pow")
4+
5+
6+
console.info("CASE num is 2 and exp is 3 then r is 8")
7+
8+
{
9+
const r = pow(2, 3)
10+
11+
console.assert(r === 8, "r is 8")
12+
}
13+
14+
15+
console.info("CASE num is 10 and exp is 2 then r is 100")
16+
17+
{
18+
const r = pow(10, 2)
19+
20+
console.assert(r === 100, "r is 100")
21+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export const pow = (num: number, exp: number): number => {
2+
// TODO implement me
3+
4+
return -1
5+
}

staff/manuel-barzi/playground/calculator/sqrt.test.ts

Whitespace-only changes.

staff/manuel-barzi/playground/calculator/sub.test.ts

Whitespace-only changes.

0 commit comments

Comments
 (0)