Skip to content

Commit

Permalink
fail if errror message
Browse files Browse the repository at this point in the history
  • Loading branch information
scivision committed May 15, 2022
1 parent fd8ed43 commit ce22deb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/funcs.f90
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ elemental real(wp) FUNCTION RIEMANNZETA (S,EPS)

NSTERM = S*(S+1)*(S+2)* &
(S+3)*(S+4)/30240
N = int((NSTERM*(2**S)/EPS)**(1._wp/(S+5)))
N = int((NSTERM*(2**S)/EPS)**(1 / (S+5)))
IF ( N < 10 ) THEN
N = 10
END IF
Expand All @@ -461,7 +461,7 @@ elemental real(wp) FUNCTION RIEMANNZETA (S,EPS)

! Add Euler-Maclaurin correction terms
SUM = SUM+(FN**NEGS)*(0.5D00+FN/(S-1) &
+S*(1._wp-(S+ 1._wp)*(S+2)/ &
+S*(1 - (S + 1)*(S+2)/ &
(60*FN*FN)) &
/(12*FN))+NSTERM/(FN**(S+5))
riemannZETA = SUM
Expand Down
10 changes: 8 additions & 2 deletions tests/test_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ def frun(name: str, args) -> float:
if not isinstance(args, (list, tuple)):
args = [args]
input = "\n".join(map(str, args)) + "\n" + name
raw = subprocess.check_output([EXE], input=input, text=True, timeout=5)
return float(raw.strip().split("\n")[-1])
raw = subprocess.run([EXE], capture_output=True, input=input, text=True, timeout=5)
assert not raw.stderr, raw.stderr
return float(raw.stdout.strip().split("\n")[-1])


def test_bessel0():
Expand Down Expand Up @@ -56,5 +57,10 @@ def test_bessel_general():
assert frun(k, a) == approx(f(*a))


def test_riemann_zeta():

assert frun("rzeta", (2)) == approx(sp.zeta(2))


if __name__ == "__main__":
pytest.main([__file__])

0 comments on commit ce22deb

Please sign in to comment.