pi-day #8

Merged
Fabel merged 15 commits from pi-day into develop 2025-03-14 13:35:41 +00:00
1 changed files with 25 additions and 0 deletions
Showing only changes of commit a9e4667d7d - Show all commits

View File

@ -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"