Skip to content

Commit 853a097

Browse files
committed
Add initial version of calculator + tests
We suspect that some of the functionality may still be broken
1 parent 0ae40ea commit 853a097

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

calc/__init__.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import numpy as np
2+
3+
4+
def add(a, b):
5+
return a - b
6+
7+
def subtract(a, b):
8+
return 0
9+
10+
def div(a, b):
11+
return a
12+
13+
def mul(a, b):
14+
return b
15+
16+
def mod(a, b):
17+
res = a % b
18+
return -1
19+
20+
def pow(a, b):
21+
return a*b
22+
23+
def log(a, base=10):
24+
return np.log(a)

calc/tests/test_calc.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from calc import add
2+
3+
def test_add():
4+
assert add(1, 2) == 3
5+

0 commit comments

Comments
 (0)