diff --git a/tests/functions/test_pi.py b/tests/functions/test_pi.py new file mode 100644 index 0000000..cb00897 --- /dev/null +++ b/tests/functions/test_pi.py @@ -0,0 +1,25 @@ +import pytest +from fabelous_math import approximate_pi + +def test_approximate_pi(): + # Test with a known precision value + precision = 10000 + pi_approx = approximate_pi(precision) + assert isinstance(pi_approx, float), "The result should be a float" + assert pi_approx > 3.14, "The approximation of Pi should be greater than 3.14" + assert pi_approx < 3.15, "The approximation of Pi should be less than 3.15" + +def test_approximate_pi_with_low_precision(): + # Test with a low precision value + precision = 100 + pi_approx = approximate_pi(precision) + assert isinstance(pi_approx, float), "The result should be a float" + assert pi_approx > 3.0, "The approximation of Pi should be greater than 3.0" + assert pi_approx < 4.0, "The approximation of Pi should be less than 4.0" + +def test_approximate_pi_with_high_precision(): + # Test with a high precision value + precision = 10000000 + pi_approx = approximate_pi(precision) + assert isinstance(pi_approx, float), "The result should be a float" + assert pi_approx > 3.1415926533, "The approximation of Pi should be greater than the known value of Pi" \ No newline at end of file