From 733967850bcc094cfaf7522f6e0e99b3fdf7b6f3 Mon Sep 17 00:00:00 2001 From: Michael Ingold Date: Sun, 15 Dec 2024 14:12:28 -0500 Subject: [PATCH] Add test for hcubature_print where io unspecified --- test/runtests.jl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/runtests.jl b/test/runtests.jl index 1f759ca..b29a6cf 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -24,13 +24,18 @@ end end @testset "print" begin + # Capture println's in a buffer, ensure one printed line per integrand eval let io = IOBuffer() - # Capture println's in a buffer, ensure one line per integrand function eval (i, e, count) = hcubature_print(io, x -> 2, (0,0), (2pi, pi)) regex = r"f\((?.+?)\) = (?.+?)" io_lines = collect(eachmatch(regex, String(take!(io)))) + @test i ≈ 4pi^2 @test length(io_lines) == count end + + # Test wrapper without io specified + (i, e, count) = hcubature_print(x -> 2, (0,0), (2pi, pi)); + @test i ≈ 4pi^2 end # function wrapper for counting evaluations