mirror of
https://github.com/venomade/calculator.git
synced 2026-11-16 18:27:39 +00:00
Add CircleArea with failing test
This commit is contained in:
1 parent
bf6cdbd999
commit
b6549523a1
2 files changed
+10
-1
No files matched your search
@@ -12,6 +12,12 @@ def multiply(a, b):
|
||||
def divide(a, b):
|
||||
return a / b
|
||||
|
||||
def CircleArea(r):
|
||||
if r >= 0:
|
||||
return 3.14 * r * r
|
||||
else:
|
||||
return "NaN"
|
||||
|
||||
def main():
|
||||
while True:
|
||||
a = float(input("First number: "))
|
||||
|
||||
+4
-1
@@ -1,4 +1,4 @@
|
||||
from calculator import add, subtract, multiply, divide
|
||||
from calculator import add, subtract, multiply, divide, CircleArea
|
||||
|
||||
def test_add():
|
||||
assert add(2, 3) == 5
|
||||
@@ -19,3 +19,6 @@ def test_divide_uneven():
|
||||
result = divide(a, b)
|
||||
# Assert
|
||||
assert result == 2.5
|
||||
|
||||
def test_circleArea():
|
||||
assert CircleArea(-4) == "Error"
|
||||
Reference in new issue
Block a user