x = 2;
function besselj_integrand(theta)
    2/pi*sin(x*cos(theta))*cos(theta)
end

printstyled("Performing the besselj test, where BesselJ_1(2) is approximated and the result is compared to the value obtained from SpecialFunctions' besselj function.\n"; color = :red)
@testset "besselj" begin
    printstyled("Running: adaptive_simpsons_rule with ε=1e-7\n"; color = :magenta)
    @time @test adaptive_simpsons_rule(besselj_integrand, 0, pi/2, 1e-7) ≈ besselj(1,2)
    printstyled("Running: chebyshev_quadrature with k=1\n"; color = :magenta)
    @time @test chebyshev_quadrature(besselj_integrand, 4665, 1, 0, pi/2) ≈ besselj(1,2)
    printstyled("Running: chebyshev_quadrature with k=2\n"; color = :magenta)
    @time @test chebyshev_quadrature(besselj_integrand, 6596, 2, 0, pi/2) ≈ besselj(1,2)
    printstyled("Running: chebyshev_quadrature with k=3\n"; color = :magenta)
    @time @test chebyshev_quadrature(besselj_integrand, 6596, 3, 0, pi/2) ≈ besselj(1,2)
    printstyled("Running: chebyshev_quadrature with k=4\n"; color = :magenta)
    @time @test chebyshev_quadrature(besselj_integrand, 4664, 4, 0, pi/2) ≈ besselj(1,2)
    printstyled("Running: jacobi_quadrature with α=β=1\n"; color = :magenta)
    @time @test jacobi_quadrature(besselj_integrand, 10285, 1, 1, 0, pi/2) ≈ besselj(1,2)
    printstyled("Running: legendre_quadrature\n"; color = :magenta)
    @time @test legendre_quadrature(besselj_integrand, 8, 0, pi/2) ≈ besselj(1,2)
    printstyled("Running: lobatto_quadrature\n"; color = :magenta)
    @time @test lobatto_quadrature(besselj_integrand, 9, 0, pi/2) ≈ besselj(1,2)
    printstyled("Running: radau_quadrature\n"; color = :magenta)
    @time @test radau_quadrature(besselj_integrand, 8, 0, pi/2) ≈ besselj(1,2)
    printstyled("Running: rectangle_rule_left\n"; color = :magenta)
    @time @test rectangle_rule_left(besselj_integrand, 52378763, 0, pi/2) ≈ besselj(1,2)
    printstyled("Running: rectangle_rule_midpoint\n"; color = :magenta)
    @time @test rectangle_rule_midpoint(besselj_integrand, 4, 0, pi/2) ≈ besselj(1,2)
    printstyled("Running: rectangle_rule_right\n"; color = :magenta)
    @time @test rectangle_rule_right(besselj_integrand, 52995612, 0, pi/2) ≈ besselj(1,2)
    printstyled("Running: rombergs_method\n"; color = :magenta)
    @time @test rombergs_method(besselj_integrand, 5, 0, pi/2) ≈ besselj(1,2)
    printstyled("Running: simpsons_rule\n"; color = :magenta)
    @time @test simpsons_rule(besselj_integrand, 3, 0, pi/2) ≈ besselj(1,2)
    printstyled("Running: simpsons38_rule\n"; color = :magenta)
    @time @test simpsons38_rule(besselj_integrand, 9, 0, pi/2) ≈ besselj(1,2)
    printstyled("Running: trapezoidal_rule\n"; color = :magenta)
    @time @test trapezoidal_rule(besselj_integrand, 4, 0, pi/2) ≈ besselj(1,2)
end
