Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
13 changes: 13 additions & 0 deletions 249053812/test/whitebox/statement_testing/bmi_calculator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
class BMICalculator:
@staticmethod
def bmi_calculator(weight, height):
bmi = weight / (height * height)
if bmi >= 30:
return "obesity"
elif 25 <= bmi < 30:
return "overweight"
elif 18.5 <= bmi < 25:
return "healthy"
elif 0 <= bmi < 18.5:
return "underweight"
return "error"
18 changes: 18 additions & 0 deletions 249053812/test/whitebox/statement_testing/test_bmi_calculator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import unittest
from bmi_calculator import BMICalculator

class TestBMICalculator(unittest.TestCase):
def testObesity(self):
self.assertIn("obesity", BMICalculator().bmi_calculator(85.3, 1.56))

def testOverweight(self):
self.assertIn("overweight", BMICalculator().bmi_calculator(65.9, 1.6))

def testHealthy(self):
self.assertIn("healthy", BMICalculator().bmi_calculator(45.5, 1.549))

def testUnderweight(self):
self.assertIn("underweight", BMICalculator().bmi_calculator(45.5, 1.6))

def testError(self):
self.assertIn("error", BMICalculator().bmi_calculator(-2, 1.56))
Loading