Skip to content

Commit

Permalink
Add two tests
Browse files Browse the repository at this point in the history
  • Loading branch information
felix1110xx committed Jul 15, 2024
1 parent f50148f commit f25ce18
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
7 changes: 7 additions & 0 deletions app/app/calc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Calculator functions

def add(x,y):
return x + y

def subtract(x,y):
return x - y
15 changes: 15 additions & 0 deletions app/app/tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Sample test

from django.test import SimpleTestCase

from app import calc

class CalcTests(SimpleTestCase):
# Test the calc module
def test_add_numbers(self):
res = calc.add(5, 6)
self.assertEqual(res, 11)

def test_subtract_numbers(self):
res = calc.subtract(10, 5)
self.assertEqual(res, 5)

0 comments on commit f25ce18

Please sign in to comment.