pi_coder/examples/python-calculator/test_calculator.py

18 lines
334 B
Python
Raw Permalink Normal View History

import pytest
from calculator import add, subtract
def test_add_positive():
assert add(2, 3) == 5
def test_add_negative():
assert add(-1, 1) == 0
def test_add_zero():
assert add(0, 0) == 0
def test_subtract_basic():
assert subtract(5, 3) == 2
def test_subtract_negative_result():
assert subtract(3, 5) == -2