text:
@testset "8.1 Error functions" begin
    (a, b, c, d, e, m, n, x, ) = @variables a b c d e m n x

    #= ::Package:: =#

    #= ::Title::Closed:: =#
    #=Integration*Problems*Involving*The*Error*Function=#

    #= ::Section::Closed:: =#
    #=Integrands*of*the*form*(c+d*x)^m*erf(a+b*x)=#

    #= ::Subsection::Closed:: =#
    #=Integrands*of*the*form*x^m*erf(b*x)=#

    @test_int [x^5*erf(b*x), x, 5, (5*x)/(ℯ^(b^2*x^2)*(8*b^5*sqrt(pi))) + (5*x^3)/(ℯ^(b^2*x^2)*(12*b^3*sqrt(pi))) + x^5/(ℯ^(b^2*x^2)*(6*b*sqrt(pi))) - (5*erf(b*x))/(16*b^6) + (1/6)*x^6*erf(b*x)]
    @test_int [x^3*erf(b*x), x, 4, (3*x)/(ℯ^(b^2*x^2)*(8*b^3*sqrt(pi))) + x^3/(ℯ^(b^2*x^2)*(4*b*sqrt(pi))) - (3*erf(b*x))/(16*b^4) + (1/4)*x^4*erf(b*x)]
    @test_int [x^1*erf(b*x), x, 3, x/(ℯ^(b^2*x^2)*(2*b*sqrt(pi))) - erf(b*x)/(4*b^2) + (1/2)*x^2*erf(b*x)]
    @test_int [erf(b*x)/x^1, x, 1, (2*b*x*HypergeometricPFQ([1/2, 1/2], [3/2, 3/2], (-b^2)*x^2))/sqrt(pi)]
    @test_int [erf(b*x)/x^3, x, 3, -(b/(ℯ^(b^2*x^2)*(sqrt(pi)*x))) - b^2*erf(b*x) - erf(b*x)/(2*x^2)]
    @test_int [erf(b*x)/x^5, x, 4, -(b/(ℯ^(b^2*x^2)*(6*sqrt(pi)*x^3))) + b^3/(ℯ^(b^2*x^2)*(3*sqrt(pi)*x)) + (1/3)*b^4*erf(b*x) - erf(b*x)/(4*x^4)]
    @test_int [erf(b*x)/x^7, x, 5, -(b/(ℯ^(b^2*x^2)*(15*sqrt(pi)*x^5))) + (2*b^3)/(ℯ^(b^2*x^2)*(45*sqrt(pi)*x^3)) - (4*b^5)/(ℯ^(b^2*x^2)*(45*sqrt(pi)*x)) - (4/45)*b^6*erf(b*x) - erf(b*x)/(6*x^6)]

    @test_int [x^6*erf(b*x), x, 5, 6/(ℯ^(b^2*x^2)*(7*b^7*sqrt(pi))) + (6*x^2)/(ℯ^(b^2*x^2)*(7*b^5*sqrt(pi))) + (3*x^4)/(ℯ^(b^2*x^2)*(7*b^3*sqrt(pi))) + x^6/(ℯ^(b^2*x^2)*(7*b*sqrt(pi))) + (1/7)*x^7*erf(b*x)]
    @test_int [x^4*erf(b*x), x, 4, 2/(ℯ^(b^2*x^2)*(5*b^5*sqrt(pi))) + (2*x^2)/(ℯ^(b^2*x^2)*(5*b^3*sqrt(pi))) + x^4/(ℯ^(b^2*x^2)*(5*b*sqrt(pi))) + (1/5)*x^5*erf(b*x)]
    @test_int [x^2*erf(b*x), x, 3, 1/(ℯ^(b^2*x^2)*(3*b^3*sqrt(pi))) + x^2/(ℯ^(b^2*x^2)*(3*b*sqrt(pi))) + (1/3)*x^3*erf(b*x)]
    @test_int [x^0*erf(b*x), x, 1, 1/(ℯ^(b^2*x^2)*(b*sqrt(pi))) + x*erf(b*x)]
    @test_int [erf(b*x)/x^2, x, 2, -(erf(b*x)/x) + (b*ExpIntegralEi((-b^2)*x^2))/sqrt(pi)]
    @test_int [erf(b*x)/x^4, x, 3, -(b/(ℯ^(b^2*x^2)*(3*sqrt(pi)*x^2))) - erf(b*x)/(3*x^3) - (b^3*ExpIntegralEi((-b^2)*x^2))/(3*sqrt(pi))]
    @test_int [erf(b*x)/x^6, x, 4, -(b/(ℯ^(b^2*x^2)*(10*sqrt(pi)*x^4))) + b^3/(ℯ^(b^2*x^2)*(10*sqrt(pi)*x^2)) - erf(b*x)/(5*x^5) + (b^5*ExpIntegralEi((-b^2)*x^2))/(10*sqrt(pi))]

    #= ::Subsection::Closed:: =#
    #=Integrands*of*the*form*(c+d*x)^m*erf(a+b*x)=#

    @test_int [(c + d*x)^3*erf(a + b*x), x, 12, (d^2*(b*c - a*d))/(ℯ^(a + b*x)^2*(b^4*sqrt(pi))) + (b*c - a*d)^3/(ℯ^(a + b*x)^2*(b^4*sqrt(pi))) + (3*d^3*(a + b*x))/(ℯ^(a + b*x)^2*(8*b^4*sqrt(pi))) + (3*d*(b*c - a*d)^2*(a + b*x))/(ℯ^(a + b*x)^2*(2*b^4*sqrt(pi))) + (d^2*(b*c - a*d)*(a + b*x)^2)/(ℯ^(a + b*x)^2*(b^4*sqrt(pi))) + (d^3*(a + b*x)^3)/(ℯ^(a + b*x)^2*(4*b^4*sqrt(pi))) - (3*d^3*erf(a + b*x))/(16*b^4) - (3*d*(b*c - a*d)^2*erf(a + b*x))/(4*b^4) - ((b*c - a*d)^4*erf(a + b*x))/(4*b^4*d) + ((c + d*x)^4*erf(a + b*x))/(4*d)]
    @test_int [(c + d*x)^2*erf(a + b*x), x, 9, d^2/(ℯ^(a + b*x)^2*(3*b^3*sqrt(pi))) + (b*c - a*d)^2/(ℯ^(a + b*x)^2*(b^3*sqrt(pi))) + (d*(b*c - a*d)*(a + b*x))/(ℯ^(a + b*x)^2*(b^3*sqrt(pi))) + (d^2*(a + b*x)^2)/(ℯ^(a + b*x)^2*(3*b^3*sqrt(pi))) - (d*(b*c - a*d)*erf(a + b*x))/(2*b^3) - ((b*c - a*d)^3*erf(a + b*x))/(3*b^3*d) + ((c + d*x)^3*erf(a + b*x))/(3*d)]
    @test_int [(c + d*x)^1*erf(a + b*x), x, 7, (b*c - a*d)/(ℯ^(a + b*x)^2*(b^2*sqrt(pi))) + (d*(a + b*x))/(ℯ^(a + b*x)^2*(2*b^2*sqrt(pi))) - (d*erf(a + b*x))/(4*b^2) - ((b*c - a*d)^2*erf(a + b*x))/(2*b^2*d) + ((c + d*x)^2*erf(a + b*x))/(2*d)]
    @test_int [(c + d*x)^0*erf(a + b*x), x, 1, 1/(ℯ^(a + b*x)^2*(b*sqrt(pi))) + ((a + b*x)*erf(a + b*x))/b]
    @test_int [erf(a + b*x)/(c + d*x)^1, x, 0, Unintegrable(erf(a + b*x)/(c + d*x), x)]
    @test_int [erf(a + b*x)/(c + d*x)^2, x, 1, -(erf(a + b*x)/(d*(c + d*x))) + (2*b*Unintegrable(1/(ℯ^(a + b*x)^2*(c + d*x)), x))/(d*sqrt(pi))]
    @test_int [erf(a + b*x)/(c + d*x)^3, x, 3, -(b/(ℯ^(a + b*x)^2*(d^2*sqrt(pi)*(c + d*x)))) - (b^2*erf(a + b*x))/d^3 - erf(a + b*x)/(2*d*(c + d*x)^2) + (2*b^2*(b*c - a*d)*Unintegrable(1/(ℯ^(a + b*x)^2*(c + d*x)), x))/(d^3*sqrt(pi))]

    #= ::Section::Closed:: =#
    #=Integrands*of*the*form*(c+d*x)^m*erf(a+b*x)^2=#

    #= ::Subsection::Closed:: =#
    #=Integrands*of*the*form*x^m*erf(b*x)^2=#

    @test_int [x^5*erf(b*x)^2, x, 12, 11/(ℯ^(2*b^2*x^2)*(12*b^6*pi)) + (7*x^2)/(ℯ^(2*b^2*x^2)*(12*b^4*pi)) + x^4/(ℯ^(2*b^2*x^2)*(6*b^2*pi)) + (5*x*erf(b*x))/(ℯ^(b^2*x^2)*(4*b^5*sqrt(pi))) + (5*x^3*erf(b*x))/(ℯ^(b^2*x^2)*(6*b^3*sqrt(pi))) + (x^5*erf(b*x))/(ℯ^(b^2*x^2)*(3*b*sqrt(pi))) - (5*erf(b*x)^2)/(16*b^6) + (1/6)*x^6*erf(b*x)^2]
    @test_int [x^3*erf(b*x)^2, x, 8, 1/(ℯ^(2*b^2*x^2)*(2*b^4*pi)) + x^2/(ℯ^(2*b^2*x^2)*(4*b^2*pi)) + (3*x*erf(b*x))/(ℯ^(b^2*x^2)*(4*b^3*sqrt(pi))) + (x^3*erf(b*x))/(ℯ^(b^2*x^2)*(2*b*sqrt(pi))) - (3*erf(b*x)^2)/(16*b^4) + (1/4)*x^4*erf(b*x)^2]
    @test_int [x^1*erf(b*x)^2, x, 5, 1/(ℯ^(2*b^2*x^2)*(2*b^2*pi)) + (x*erf(b*x))/(ℯ^(b^2*x^2)*(b*sqrt(pi))) - erf(b*x)^2/(4*b^2) + (1/2)*x^2*erf(b*x)^2]
    @test_int [erf(b*x)^2/x^1, x, 0, Unintegrable(erf(b*x)^2/x, x)]
    @test_int [erf(b*x)^2/x^3, x, 5, -((2*b*erf(b*x))/(ℯ^(b^2*x^2)*(sqrt(pi)*x))) - b^2*erf(b*x)^2 - erf(b*x)^2/(2*x^2) + (2*b^2*ExpIntegralEi(-2*b^2*x^2))/pi]
    @test_int [erf(b*x)^2/x^5, x, 8, -(b^2/(ℯ^(2*b^2*x^2)*(3*pi*x^2))) - (b*erf(b*x))/(ℯ^(b^2*x^2)*(3*sqrt(pi)*x^3)) + (2*b^3*erf(b*x))/(ℯ^(b^2*x^2)*(3*sqrt(pi)*x)) + (1/3)*b^4*erf(b*x)^2 - erf(b*x)^2/(4*x^4) - (4*b^4*ExpIntegralEi(-2*b^2*x^2))/(3*pi)]
    @test_int [erf(b*x)^2/x^7, x, 12, -(b^2/(ℯ^(2*b^2*x^2)*(15*pi*x^4))) + (2*b^4)/(ℯ^(2*b^2*x^2)*(9*pi*x^2)) - (2*b*erf(b*x))/(ℯ^(b^2*x^2)*(15*sqrt(pi)*x^5)) + (4*b^3*erf(b*x))/(ℯ^(b^2*x^2)*(45*sqrt(pi)*x^3)) - (8*b^5*erf(b*x))/(ℯ^(b^2*x^2)*(45*sqrt(pi)*x)) - (4/45)*b^6*erf(b*x)^2 - erf(b*x)^2/(6*x^6) + (28*b^6*ExpIntegralEi(-2*b^2*x^2))/(45*pi)]

    @test_int [x^4*erf(b*x)^2, x, 10, (11*x)/(ℯ^(2*b^2*x^2)*(20*b^4*pi)) + x^3/(ℯ^(2*b^2*x^2)*(5*b^2*pi)) + (4*erf(b*x))/(ℯ^(b^2*x^2)*(5*b^5*sqrt(pi))) + (4*x^2*erf(b*x))/(ℯ^(b^2*x^2)*(5*b^3*sqrt(pi))) + (2*x^4*erf(b*x))/(ℯ^(b^2*x^2)*(5*b*sqrt(pi))) + (1/5)*x^5*erf(b*x)^2 - (43*erf(sqrt(2)*b*x))/(40*b^5*sqrt(2*pi))]
    @test_int [x^2*erf(b*x)^2, x, 6, x/(ℯ^(2*b^2*x^2)*(3*b^2*pi)) + (2*erf(b*x))/(ℯ^(b^2*x^2)*(3*b^3*sqrt(pi))) + (2*x^2*erf(b*x))/(ℯ^(b^2*x^2)*(3*b*sqrt(pi))) + (1/3)*x^3*erf(b*x)^2 - (5*erf(sqrt(2)*b*x))/(6*b^3*sqrt(2*pi))]
    @test_int [x^0*erf(b*x)^2, x, 4, (2*erf(b*x))/(ℯ^(b^2*x^2)*(b*sqrt(pi))) + x*erf(b*x)^2 - (sqrt(2/pi)*erf(sqrt(2)*b*x))/b]
    @test_int [erf(b*x)^2/x^2, x, 0, Unintegrable(erf(b*x)^2/x^2, x)]
    @test_int [erf(b*x)^2/x^4, x, 0, Unintegrable(erf(b*x)^2/x^4, x)]
    @test_int [erf(b*x)^2/x^6, x, 0, Unintegrable(erf(b*x)^2/x^6, x)]

    #= ::Subsection::Closed:: =#
    #=Integrands*of*the*form*(c+d*x)^m*erf(a+b*x)^2=#

    @test_int [(c + d*x)^2*erf(a + b*x)^2, x, 16, (d*(b*c - a*d))/(ℯ^(2*(a + b*x)^2)*(b^3*pi)) + (d^2*(a + b*x))/(ℯ^(2*(a + b*x)^2)*(3*b^3*pi)) + (2*d^2*erf(a + b*x))/(ℯ^(a + b*x)^2*(3*b^3*sqrt(pi))) + (2*(b*c - a*d)^2*erf(a + b*x))/(ℯ^(a + b*x)^2*(b^3*sqrt(pi))) + (2*d*(b*c - a*d)*(a + b*x)*erf(a + b*x))/(ℯ^(a + b*x)^2*(b^3*sqrt(pi))) + (2*d^2*(a + b*x)^2*erf(a + b*x))/(ℯ^(a + b*x)^2*(3*b^3*sqrt(pi))) - (d*(b*c - a*d)*erf(a + b*x)^2)/(2*b^3) + ((b*c - a*d)^2*(a + b*x)*erf(a + b*x)^2)/b^3 + (d*(b*c - a*d)*(a + b*x)^2*erf(a + b*x)^2)/b^3 + (d^2*(a + b*x)^3*erf(a + b*x)^2)/(3*b^3) - ((b*c - a*d)^2*sqrt(2/pi)*erf(sqrt(2)*(a + b*x)))/b^3 - (5*d^2*erf(sqrt(2)*(a + b*x)))/(6*b^3*sqrt(2*pi))]
    @test_int [(c + d*x)^1*erf(a + b*x)^2, x, 10, d/(ℯ^(2*(a + b*x)^2)*(2*b^2*pi)) + (2*(b*c - a*d)*erf(a + b*x))/(ℯ^(a + b*x)^2*(b^2*sqrt(pi))) + (d*(a + b*x)*erf(a + b*x))/(ℯ^(a + b*x)^2*(b^2*sqrt(pi))) - (d*erf(a + b*x)^2)/(4*b^2) + ((b*c - a*d)*(a + b*x)*erf(a + b*x)^2)/b^2 + (d*(a + b*x)^2*erf(a + b*x)^2)/(2*b^2) - ((b*c - a*d)*sqrt(2/pi)*erf(sqrt(2)*(a + b*x)))/b^2]
    @test_int [(c + d*x)^0*erf(a + b*x)^2, x, 4, (2*erf(a + b*x))/(ℯ^(a + b*x)^2*(b*sqrt(pi))) + ((a + b*x)*erf(a + b*x)^2)/b - (sqrt(2/pi)*erf(sqrt(2)*(a + b*x)))/b]
    @test_int [erf(a + b*x)^2/(c + d*x)^1, x, 0, Unintegrable(erf(a + b*x)^2/(c + d*x), x)]
    @test_int [erf(a + b*x)^2/(c + d*x)^2, x, 0, Unintegrable(erf(a + b*x)^2/(c + d*x)^2, x)]

    #= ::Section::Closed:: =#
    #=Integrands*of*the*form*(e*x)^m*erf(d*(a+b*log(c*x^n)))=#

    @test_int [x^2*erf(d*(a + b*log(c*x^n))), x, 5, (x^3*erf(d*(a + b*log(c*x^n))))/3 - (ℯ^((9 - 12*a*b*d^2*n)/(4*b^2*d^2*n^2))*x^3*erf((2*a*b*d^2 - 3/n + 2*b^2*d^2*log(c*x^n))/(2*b*d)))/(3*(c*x^n)^(3/n))]
    @test_int [x^1*erf(d*(a + b*log(c*x^n))), x, 5, (x^2*erf(d*(a + b*log(c*x^n))))/2 - (ℯ^((1 - 2*a*b*d^2*n)/(b^2*d^2*n^2))*x^2*erf((a*b*d^2 - n^(-1) + b^2*d^2*log(c*x^n))/(b*d)))/(2*(c*x^n)^(2/n))]
    @test_int [x^0*erf(d*(a + b*log(c*x^n))), x, 5, x*erf(d*(a + b*log(c*x^n))) - (ℯ^((1 - 4*a*b*d^2*n)/(4*b^2*d^2*n^2))*x*erf((2*a*b*d^2 - n^(-1) + 2*b^2*d^2*log(c*x^n))/(2*b*d)))/(c*x^n)^n^(-1)]
    @test_int [erf(d*(a + b*log(c*x^n)))/x^1, x, 3, 1/(b*d*ℯ^(d^2*(a + b*log(c*x^n))^2)*n*sqrt(pi)) + (erf(d*(a + b*log(c*x^n)))*(a + b*log(c*x^n)))/(b*n)]
    @test_int [erf(d*(a + b*log(c*x^n)))/x^2, x, 5, -(erf(d*(a + b*log(c*x^n)))/x) + (ℯ^(1/(4*b^2*d^2*n^2) + a/(b*n))*(c*x^n)^n^(-1)*erf((2*a*b*d^2 + n^(-1) + 2*b^2*d^2*log(c*x^n))/(2*b*d)))/x]
    @test_int [erf(d*(a + b*log(c*x^n)))/x^3, x, 5, -erf(d*(a + b*log(c*x^n)))/(2*x^2) + (ℯ^((1 + 2*a*b*d^2*n)/(b^2*d^2*n^2))*(c*x^n)^(2/n)*erf((1 + a*b*d^2*n + b^2*d^2*n*log(c*x^n))/(b*d*n)))/(2*x^2)]

    @test_int [(e*x)^m*erf(d*(a + b*log(c*x^n))), x, 5, ((e*x)^(1 + m)*erf(d*(a + b*log(c*x^n))))/(e*(1 + m)) + (ℯ^(((1 + m)*(1 + m - 4*a*b*d^2*n))/(4*b^2*d^2*n^2))*x*(e*x)^m*erf((1 + m - 2*a*b*d^2*n - 2*b^2*d^2*n*log(c*x^n))/(2*b*d*n)))/((1 + m)*(c*x^n)^((1 + m)/n))]

    #= ::Section::Closed:: =#
    #=Integrands*of*the*form*(e*x)^m*ℯ^(c+d*x^2)*erf(a+b*x)^n=#

    #= ::Subsection::Closed:: =#
    #=Integrands*of*the*form*ℯ^(c-b^2*x^2)*erf(b*x)^n=#

    @test_int [ℯ^(c - b^2*x^2)*erf(b*x)^2, x, 2, (ℯ^c*sqrt(pi)*erf(b*x)^3)/(6*b)]
    @test_int [ℯ^(c - b^2*x^2)*erf(b*x)^1, x, 2, (ℯ^c*sqrt(pi)*erf(b*x)^2)/(4*b)]
    @test_int [ℯ^(c - b^2*x^2)/erf(b*x)^1, x, 2, (ℯ^c*sqrt(pi)*log(erf(b*x)))/(2*b)]
    @test_int [ℯ^(c - b^2*x^2)/erf(b*x)^2, x, 2, -((ℯ^c*sqrt(pi))/(2*b*erf(b*x)))]
    @test_int [ℯ^(c - b^2*x^2)/erf(b*x)^3, x, 2, -((ℯ^c*sqrt(pi))/(4*b*erf(b*x)^2))]

    @test_int [ℯ^(c - b^2*x^2)*erf(b*x)^n, x, 2, (ℯ^c*sqrt(pi)*erf(b*x)^(1 + n))/(2*b*(1 + n))]

    #= ::Subsection::Closed:: =#
    #=Integrands*of*the*form*x^m*ℯ^(c+d*x^2)*erf(b*x)=#

    @test_int [x^5*ℯ^(c + d*x^2)*erf(b*x), x, 9, -((b*ℯ^(c - (b^2 - d)*x^2)*x)/((b^2 - d)*d^2*sqrt(pi))) + (3*b*ℯ^(c - (b^2 - d)*x^2)*x)/(4*(b^2 - d)^2*d*sqrt(pi)) + (b*ℯ^(c - (b^2 - d)*x^2)*x^3)/(2*(b^2 - d)*d*sqrt(pi)) + (ℯ^(c + d*x^2)*erf(b*x))/d^3 - (ℯ^(c + d*x^2)*x^2*erf(b*x))/d^2 + (ℯ^(c + d*x^2)*x^4*erf(b*x))/(2*d) - (b*ℯ^c*erf(sqrt(b^2 - d)*x))/(sqrt(b^2 - d)*d^3) + (b*ℯ^c*erf(sqrt(b^2 - d)*x))/(2*(b^2 - d)^(3/2)*d^2) - (3*b*ℯ^c*erf(sqrt(b^2 - d)*x))/(8*(b^2 - d)^(5/2)*d)]
    @test_int [x^3*ℯ^(c + d*x^2)*erf(b*x), x, 5, (b*ℯ^(c - (b^2 - d)*x^2)*x)/(2*(b^2 - d)*d*sqrt(pi)) - (ℯ^(c + d*x^2)*erf(b*x))/(2*d^2) + (ℯ^(c + d*x^2)*x^2*erf(b*x))/(2*d) + (b*ℯ^c*erf(sqrt(b^2 - d)*x))/(2*sqrt(b^2 - d)*d^2) - (b*ℯ^c*erf(sqrt(b^2 - d)*x))/(4*(b^2 - d)^(3/2)*d)]
    @test_int [x^1*ℯ^(c + d*x^2)*erf(b*x), x, 2, (ℯ^(c + d*x^2)*erf(b*x))/(2*d) - (b*ℯ^c*erf(sqrt(b^2 - d)*x))/(2*sqrt(b^2 - d)*d)]
    @test_int [ℯ^(c + d*x^2)*erf(b*x)/x^1, x, 0, Unintegrable((ℯ^(c + d*x^2)*erf(b*x))/x, x)]
    @test_int [ℯ^(c + d*x^2)*erf(b*x)/x^3, x, 3, -((b*ℯ^(c - (b^2 - d)*x^2))/(sqrt(pi)*x)) - (ℯ^(c + d*x^2)*erf(b*x))/(2*x^2) - b*sqrt(b^2 - d)*ℯ^c*erf(sqrt(b^2 - d)*x) + d*Unintegrable((ℯ^(c + d*x^2)*erf(b*x))/x, x)]
    @test_int [ℯ^(c + d*x^2)*erf(b*x)/x^5, x, 7, -((b*ℯ^(c - (b^2 - d)*x^2))/(6*sqrt(pi)*x^3)) + (b*(b^2 - d)*ℯ^(c - (b^2 - d)*x^2))/(3*sqrt(pi)*x) - (b*d*ℯ^(c - (b^2 - d)*x^2))/(2*sqrt(pi)*x) - (ℯ^(c + d*x^2)*erf(b*x))/(4*x^4) - (d*ℯ^(c + d*x^2)*erf(b*x))/(4*x^2) + (1/3)*b*(b^2 - d)^(3/2)*ℯ^c*erf(sqrt(b^2 - d)*x) - (1/2)*b*sqrt(b^2 - d)*d*ℯ^c*erf(sqrt(b^2 - d)*x) + (1/2)*d^2*Unintegrable((ℯ^(c + d*x^2)*erf(b*x))/x, x)]

    @test_int [x^4*ℯ^(c + d*x^2)*erf(b*x), x, 5, -((3*b*ℯ^(c - (b^2 - d)*x^2))/(4*(b^2 - d)*d^2*sqrt(pi))) + (b*ℯ^(c - (b^2 - d)*x^2))/(2*(b^2 - d)^2*d*sqrt(pi)) + (b*ℯ^(c - (b^2 - d)*x^2)*x^2)/(2*(b^2 - d)*d*sqrt(pi)) - (3*ℯ^(c + d*x^2)*x*erf(b*x))/(4*d^2) + (ℯ^(c + d*x^2)*x^3*erf(b*x))/(2*d) + (3*Unintegrable(ℯ^(c + d*x^2)*erf(b*x), x))/(4*d^2)]
    @test_int [x^2*ℯ^(c + d*x^2)*erf(b*x), x, 2, (b*ℯ^(c - (b^2 - d)*x^2))/(2*(b^2 - d)*d*sqrt(pi)) + (ℯ^(c + d*x^2)*x*erf(b*x))/(2*d) - Unintegrable(ℯ^(c + d*x^2)*erf(b*x), x)/(2*d)]
    @test_int [x^0*ℯ^(c + d*x^2)*erf(b*x), x, 0, Unintegrable(ℯ^(c + d*x^2)*erf(b*x), x)]
    @test_int [ℯ^(c + d*x^2)*erf(b*x)/x^2, x, 2, -((ℯ^(c + d*x^2)*erf(b*x))/x) + (b*ℯ^c*ExpIntegralEi(-((b^2 - d)*x^2)))/sqrt(pi) + 2*d*Unintegrable(ℯ^(c + d*x^2)*erf(b*x), x)]
    @test_int [ℯ^(c + d*x^2)*erf(b*x)/x^4, x, 5, -((b*ℯ^(c - (b^2 - d)*x^2))/(3*sqrt(pi)*x^2)) - (ℯ^(c + d*x^2)*erf(b*x))/(3*x^3) - (2*d*ℯ^(c + d*x^2)*erf(b*x))/(3*x) - (b*(b^2 - d)*ℯ^c*ExpIntegralEi(-((b^2 - d)*x^2)))/(3*sqrt(pi)) + (2*b*d*ℯ^c*ExpIntegralEi(-((b^2 - d)*x^2)))/(3*sqrt(pi)) + (4/3)*d^2*Unintegrable(ℯ^(c + d*x^2)*erf(b*x), x)]

    @test_int [x^5*ℯ^(c + b^2*x^2)*erf(b*x), x, 8, -((2*ℯ^c*x)/(b^5*sqrt(pi))) + (2*ℯ^c*x^3)/(3*b^3*sqrt(pi)) - (ℯ^c*x^5)/(5*b*sqrt(pi)) + (ℯ^(c + b^2*x^2)*erf(b*x))/b^6 - (ℯ^(c + b^2*x^2)*x^2*erf(b*x))/b^4 + (ℯ^(c + b^2*x^2)*x^4*erf(b*x))/(2*b^2)]
    @test_int [x^3*ℯ^(c + b^2*x^2)*erf(b*x), x, 5, (ℯ^c*x)/(b^3*sqrt(pi)) - (ℯ^c*x^3)/(3*b*sqrt(pi)) - (ℯ^(c + b^2*x^2)*erf(b*x))/(2*b^4) + (ℯ^(c + b^2*x^2)*x^2*erf(b*x))/(2*b^2)]
    @test_int [x^1*ℯ^(c + b^2*x^2)*erf(b*x), x, 2, -((ℯ^c*x)/(b*sqrt(pi))) + (ℯ^(c + b^2*x^2)*erf(b*x))/(2*b^2)]
    @test_int [ℯ^(c + b^2*x^2)*erf(b*x)/x^1, x, 1, (2*b*ℯ^c*x*HypergeometricPFQ([1/2, 1], [3/2, 3/2], b^2*x^2))/sqrt(pi)]
    @test_int [ℯ^(c + b^2*x^2)*erf(b*x)/x^3, x, 4, -((b*ℯ^c)/(sqrt(pi)*x)) - (ℯ^(c + b^2*x^2)*erf(b*x))/(2*x^2) + (2*b^3*ℯ^c*x*HypergeometricPFQ([1/2, 1], [3/2, 3/2], b^2*x^2))/sqrt(pi)]
    @test_int [ℯ^(c + b^2*x^2)*erf(b*x)/x^5, x, 7, -((b*ℯ^c)/(6*sqrt(pi)*x^3)) - (b^3*ℯ^c)/(2*sqrt(pi)*x) - (ℯ^(c + b^2*x^2)*erf(b*x))/(4*x^4) - (b^2*ℯ^(c + b^2*x^2)*erf(b*x))/(4*x^2) + (b^5*ℯ^c*x*HypergeometricPFQ([1/2, 1], [3/2, 3/2], b^2*x^2))/sqrt(pi)]

    @test_int [x^4*ℯ^(c + b^2*x^2)*erf(b*x), x, 7, (3*ℯ^c*x^2)/(4*b^3*sqrt(pi)) - (ℯ^c*x^4)/(4*b*sqrt(pi)) - (3*ℯ^(c + b^2*x^2)*x*erf(b*x))/(4*b^4) + (ℯ^(c + b^2*x^2)*x^3*erf(b*x))/(2*b^2) + (3*ℯ^c*x^2*HypergeometricPFQ([1, 1], [3/2, 2], b^2*x^2))/(4*b^3*sqrt(pi))]
    @test_int [x^2*ℯ^(c + b^2*x^2)*erf(b*x), x, 4, -((ℯ^c*x^2)/(2*b*sqrt(pi))) + (ℯ^(c + b^2*x^2)*x*erf(b*x))/(2*b^2) - (ℯ^c*x^2*HypergeometricPFQ([1, 1], [3/2, 2], b^2*x^2))/(2*b*sqrt(pi))]
    @test_int [x^0*ℯ^(c + b^2*x^2)*erf(b*x), x, 1, (b*ℯ^c*x^2*HypergeometricPFQ([1, 1], [3/2, 2], b^2*x^2))/sqrt(pi)]
    @test_int [ℯ^(c + b^2*x^2)*erf(b*x)/x^2, x, 4, -((ℯ^(c + b^2*x^2)*erf(b*x))/x) + (2*b^3*ℯ^c*x^2*HypergeometricPFQ([1, 1], [3/2, 2], b^2*x^2))/sqrt(pi) + (2*b*ℯ^c*log(x))/sqrt(pi)]
    @test_int [ℯ^(c + b^2*x^2)*erf(b*x)/x^4, x, 7, -((b*ℯ^c)/(3*sqrt(pi)*x^2)) - (ℯ^(c + b^2*x^2)*erf(b*x))/(3*x^3) - (2*b^2*ℯ^(c + b^2*x^2)*erf(b*x))/(3*x) + (4*b^5*ℯ^c*x^2*HypergeometricPFQ([1, 1], [3/2, 2], b^2*x^2))/(3*sqrt(pi)) + (4*b^3*ℯ^c*log(x))/(3*sqrt(pi))]

    @test_int [x^5*ℯ^(-b^2*x^2)*erf(b*x), x, 9, -((11*x)/(ℯ^(2*b^2*x^2)*(16*b^5*sqrt(pi)))) - x^3/(ℯ^(2*b^2*x^2)*(4*b^3*sqrt(pi))) - erf(b*x)/(ℯ^(b^2*x^2)*b^6) - (x^2*erf(b*x))/(ℯ^(b^2*x^2)*b^4) - (x^4*erf(b*x))/(ℯ^(b^2*x^2)*(2*b^2)) + (43*erf(sqrt(2)*b*x))/(32*sqrt(2)*b^6)]
    @test_int [x^3*ℯ^(-b^2*x^2)*erf(b*x), x, 5, -(x/(ℯ^(2*b^2*x^2)*(4*b^3*sqrt(pi)))) - erf(b*x)/(ℯ^(b^2*x^2)*(2*b^4)) - (x^2*erf(b*x))/(ℯ^(b^2*x^2)*(2*b^2)) + (5*erf(sqrt(2)*b*x))/(8*sqrt(2)*b^4)]
    @test_int [x^1*ℯ^(-b^2*x^2)*erf(b*x), x, 2, -(erf(b*x)/(ℯ^(b^2*x^2)*(2*b^2))) + erf(sqrt(2)*b*x)/(2*sqrt(2)*b^2)]
    @test_int [ℯ^(-b^2*x^2)*erf(b*x)/x^1, x, 0, Unintegrable(erf(b*x)/(ℯ^(b^2*x^2)*x), x)]
    @test_int [ℯ^(-b^2*x^2)*erf(b*x)/x^3, x, 3, -(b/(ℯ^(2*b^2*x^2)*(sqrt(pi)*x))) - erf(b*x)/(ℯ^(b^2*x^2)*(2*x^2)) - sqrt(2)*b^2*erf(sqrt(2)*b*x) - b^2*Unintegrable(erf(b*x)/(ℯ^(b^2*x^2)*x), x)]
    @test_int [ℯ^(-b^2*x^2)*erf(b*x)/x^5, x, 7, -(b/(ℯ^(2*b^2*x^2)*(6*sqrt(pi)*x^3))) + (7*b^3)/(ℯ^(2*b^2*x^2)*(6*sqrt(pi)*x)) - erf(b*x)/(ℯ^(b^2*x^2)*(4*x^4)) + (b^2*erf(b*x))/(ℯ^(b^2*x^2)*(4*x^2)) + (b^4*erf(sqrt(2)*b*x))/sqrt(2) + (2/3)*sqrt(2)*b^4*erf(sqrt(2)*b*x) + (1/2)*b^4*Unintegrable(erf(b*x)/(ℯ^(b^2*x^2)*x), x)]

    @test_int [x^4*ℯ^(-b^2*x^2)*erf(b*x), x, 7, -(1/(ℯ^(2*b^2*x^2)*(2*b^5*sqrt(pi)))) - x^2/(ℯ^(2*b^2*x^2)*(4*b^3*sqrt(pi))) - (3*x*erf(b*x))/(ℯ^(b^2*x^2)*(4*b^4)) - (x^3*erf(b*x))/(ℯ^(b^2*x^2)*(2*b^2)) + (3*sqrt(pi)*erf(b*x)^2)/(16*b^5)]
    @test_int [x^2*ℯ^(-b^2*x^2)*erf(b*x), x, 4, -(1/(ℯ^(2*b^2*x^2)*(4*b^3*sqrt(pi)))) - (x*erf(b*x))/(ℯ^(b^2*x^2)*(2*b^2)) + (sqrt(pi)*erf(b*x)^2)/(8*b^3)]
    @test_int [x^0*ℯ^(-b^2*x^2)*erf(b*x), x, 2, (sqrt(pi)*erf(b*x)^2)/(4*b)]
    @test_int [ℯ^(-b^2*x^2)*erf(b*x)/x^2, x, 4, -(erf(b*x)/(ℯ^(b^2*x^2)*x)) - (1/2)*b*sqrt(pi)*erf(b*x)^2 + (b*ExpIntegralEi(-2*b^2*x^2))/sqrt(pi)]
    @test_int [ℯ^(-b^2*x^2)*erf(b*x)/x^4, x, 7, -(b/(ℯ^(2*b^2*x^2)*(3*sqrt(pi)*x^2))) - erf(b*x)/(ℯ^(b^2*x^2)*(3*x^3)) + (2*b^2*erf(b*x))/(ℯ^(b^2*x^2)*(3*x)) + (1/3)*b^3*sqrt(pi)*erf(b*x)^2 - (4*b^3*ExpIntegralEi(-2*b^2*x^2))/(3*sqrt(pi))]

    #= ::Subsection::Closed:: =#
    #=Integrands*of*the*form*x^m*ℯ^(c+d*x^2)*erf(a+b*x)=#

    @test_int [x^3*ℯ^(c + d*x^2)*erf(a + b*x), x, 10, -((a*b^2*ℯ^(-a^2 + c - 2*a*b*x - (b^2 - d)*x^2))/(2*(b^2 - d)^2*d*sqrt(pi))) + (b*ℯ^(-a^2 + c - 2*a*b*x - (b^2 - d)*x^2)*x)/(2*(b^2 - d)*d*sqrt(pi)) - (ℯ^(c + d*x^2)*erf(a + b*x))/(2*d^2) + (ℯ^(c + d*x^2)*x^2*erf(a + b*x))/(2*d) + (b*ℯ^(c + (a^2*d)/(b^2 - d))*erf((a*b + (b^2 - d)*x)/sqrt(b^2 - d)))/(2*sqrt(b^2 - d)*d^2) - (a^2*b^3*ℯ^(c + (a^2*d)/(b^2 - d))*erf((a*b + (b^2 - d)*x)/sqrt(b^2 - d)))/(2*(b^2 - d)^(5/2)*d) - (b*ℯ^(c + (a^2*d)/(b^2 - d))*erf((a*b + (b^2 - d)*x)/sqrt(b^2 - d)))/(4*(b^2 - d)^(3/2)*d)]
    @test_int [x^1*ℯ^(c + d*x^2)*erf(a + b*x), x, 3, (ℯ^(c + d*x^2)*erf(a + b*x))/(2*d) - (b*ℯ^(c + (a^2*d)/(b^2 - d))*erf((a*b + (b^2 - d)*x)/sqrt(b^2 - d)))/(2*sqrt(b^2 - d)*d)]
    @test_int [ℯ^(c + d*x^2)*erf(a + b*x)/x^1, x, 0, Unintegrable((ℯ^(c + d*x^2)*erf(a + b*x))/x, x)]
    @test_int [ℯ^(c + d*x^2)*erf(a + b*x)/x^3, x, 4, -((b*ℯ^(-a^2 + c - 2*a*b*x - (b^2 - d)*x^2))/(sqrt(pi)*x)) - (ℯ^(c + d*x^2)*erf(a + b*x))/(2*x^2) - b*sqrt(b^2 - d)*ℯ^(c + (a^2*d)/(b^2 - d))*erf((a*b + (b^2 - d)*x)/sqrt(b^2 - d)) - (2*a*b^2*Unintegrable(ℯ^(-a^2 + c - 2*a*b*x + (-b^2 + d)*x^2)/x, x))/sqrt(pi) + d*Unintegrable((ℯ^(c + d*x^2)*erf(a + b*x))/x, x)]

    @test_int [x^4*ℯ^(c + d*x^2)*erf(a + b*x), x, 15, -((3*b*ℯ^(-a^2 + c - 2*a*b*x - (b^2 - d)*x^2))/(4*(b^2 - d)*d^2*sqrt(pi))) + (a^2*b^3*ℯ^(-a^2 + c - 2*a*b*x - (b^2 - d)*x^2))/(2*(b^2 - d)^3*d*sqrt(pi)) + (b*ℯ^(-a^2 + c - 2*a*b*x - (b^2 - d)*x^2))/(2*(b^2 - d)^2*d*sqrt(pi)) - (a*b^2*ℯ^(-a^2 + c - 2*a*b*x - (b^2 - d)*x^2)*x)/(2*(b^2 - d)^2*d*sqrt(pi)) + (b*ℯ^(-a^2 + c - 2*a*b*x - (b^2 - d)*x^2)*x^2)/(2*(b^2 - d)*d*sqrt(pi)) - (3*ℯ^(c + d*x^2)*x*erf(a + b*x))/(4*d^2) + (ℯ^(c + d*x^2)*x^3*erf(a + b*x))/(2*d) - (3*a*b^2*ℯ^(c + (a^2*d)/(b^2 - d))*erf((a*b + (b^2 - d)*x)/sqrt(b^2 - d)))/(4*(b^2 - d)^(3/2)*d^2) + (a^3*b^4*ℯ^(c + (a^2*d)/(b^2 - d))*erf((a*b + (b^2 - d)*x)/sqrt(b^2 - d)))/(2*(b^2 - d)^(7/2)*d) + (3*a*b^2*ℯ^(c + (a^2*d)/(b^2 - d))*erf((a*b + (b^2 - d)*x)/sqrt(b^2 - d)))/(4*(b^2 - d)^(5/2)*d) + (3*Unintegrable(ℯ^(c + d*x^2)*erf(a + b*x), x))/(4*d^2)]
    @test_int [x^2*ℯ^(c + d*x^2)*erf(a + b*x), x, 4, (b*ℯ^(-a^2 + c - 2*a*b*x - (b^2 - d)*x^2))/(2*(b^2 - d)*d*sqrt(pi)) + (ℯ^(c + d*x^2)*x*erf(a + b*x))/(2*d) + (a*b^2*ℯ^(c + (a^2*d)/(b^2 - d))*erf((a*b + (b^2 - d)*x)/sqrt(b^2 - d)))/(2*(b^2 - d)^(3/2)*d) - Unintegrable(ℯ^(c + d*x^2)*erf(a + b*x), x)/(2*d)]
    @test_int [x^0*ℯ^(c + d*x^2)*erf(a + b*x), x, 0, Unintegrable(ℯ^(c + d*x^2)*erf(a + b*x), x)]
    @test_int [ℯ^(c + d*x^2)*erf(a + b*x)/x^2, x, 1, -((ℯ^(c + d*x^2)*erf(a + b*x))/x) + (2*b*Unintegrable(ℯ^(-a^2 + c - 2*a*b*x + (-b^2 + d)*x^2)/x, x))/sqrt(pi) + 2*d*Unintegrable(ℯ^(c + d*x^2)*erf(a + b*x), x)]
    @test_int [ℯ^(c + d*x^2)*erf(a + b*x)/x^4, x, 6, -((b*ℯ^(-a^2 + c - 2*a*b*x - (b^2 - d)*x^2))/(3*sqrt(pi)*x^2)) + (2*a*b^2*ℯ^(-a^2 + c - 2*a*b*x - (b^2 - d)*x^2))/(3*sqrt(pi)*x) - (ℯ^(c + d*x^2)*erf(a + b*x))/(3*x^3) - (2*d*ℯ^(c + d*x^2)*erf(a + b*x))/(3*x) + (2/3)*a*b^2*sqrt(b^2 - d)*ℯ^(c + (a^2*d)/(b^2 - d))*erf((a*b + (b^2 - d)*x)/sqrt(b^2 - d)) + (4*a^2*b^3*Unintegrable(ℯ^(-a^2 + c - 2*a*b*x + (-b^2 + d)*x^2)/x, x))/(3*sqrt(pi)) - (2*b*(b^2 - d)*Unintegrable(ℯ^(-a^2 + c - 2*a*b*x + (-b^2 + d)*x^2)/x, x))/(3*sqrt(pi)) + (4*b*d*Unintegrable(ℯ^(-a^2 + c - 2*a*b*x + (-b^2 + d)*x^2)/x, x))/(3*sqrt(pi)) + (4/3)*d^2*Unintegrable(ℯ^(c + d*x^2)*erf(a + b*x), x)]

    @test_int [erf(b*x)/(ℯ^(b^2*x^2)*x^3) + (b^2*erf(b*x))/(ℯ^(b^2*x^2)*x), x, 4, -(b/(ℯ^(2*b^2*x^2)*(sqrt(pi)*x))) - erf(b*x)/(ℯ^(b^2*x^2)*(2*x^2)) - sqrt(2)*b^2*erf(sqrt(2)*b*x)]

    #= ::Section::Closed:: =#
    #=Integrands*of*the*form*(e*x)^m*Trig(c+d*x^2)*erf(a+b*x)^n=#

    @test_int [sin(c + im*b^2*x^2)*erf(b*x), x, 4, -((im*ℯ^(im*c)*sqrt(pi)*erf(b*x)^2)/(8*b)) + (im*b*x^2*HypergeometricPFQ([1, 1], [3/2, 2], b^2*x^2))/(ℯ^(im*c)*(2*sqrt(pi)))]
    @test_int [sin(c - im*b^2*x^2)*erf(b*x), x, 4, (im*sqrt(pi)*erf(b*x)^2)/(ℯ^(im*c)*(8*b)) - (im*b*ℯ^(im*c)*x^2*HypergeometricPFQ([1, 1], [3/2, 2], b^2*x^2))/(2*sqrt(pi))]

    @test_int [cos(c + im*b^2*x^2)*erf(b*x), x, 4, (ℯ^(im*c)*sqrt(pi)*erf(b*x)^2)/(8*b) + (b*x^2*HypergeometricPFQ([1, 1], [3/2, 2], b^2*x^2))/(ℯ^(im*c)*(2*sqrt(pi)))]
    @test_int [cos(c - im*b^2*x^2)*erf(b*x), x, 4, (sqrt(pi)*erf(b*x)^2)/(ℯ^(im*c)*(8*b)) + (b*ℯ^(im*c)*x^2*HypergeometricPFQ([1, 1], [3/2, 2], b^2*x^2))/(2*sqrt(pi))]

    @test_int [sinh(c + b^2*x^2)*erf(b*x), x, 4, -((sqrt(pi)*erf(b*x)^2)/(ℯ^c*(8*b))) + (b*ℯ^c*x^2*HypergeometricPFQ([1, 1], [3/2, 2], b^2*x^2))/(2*sqrt(pi))]
    @test_int [sinh(c - b^2*x^2)*erf(b*x), x, 4, (ℯ^c*sqrt(pi)*erf(b*x)^2)/(8*b) - (b*x^2*HypergeometricPFQ([1, 1], [3/2, 2], b^2*x^2))/(ℯ^c*(2*sqrt(pi)))]

    @test_int [cosh(c + b^2*x^2)*erf(b*x), x, 4, (sqrt(pi)*erf(b*x)^2)/(ℯ^c*(8*b)) + (b*ℯ^c*x^2*HypergeometricPFQ([1, 1], [3/2, 2], b^2*x^2))/(2*sqrt(pi))]
    @test_int [cosh(c - b^2*x^2)*erf(b*x), x, 4, (ℯ^c*sqrt(pi)*erf(b*x)^2)/(8*b) + (b*x^2*HypergeometricPFQ([1, 1], [3/2, 2], b^2*x^2))/(ℯ^c*(2*sqrt(pi)))]

    #= ::Title::Closed:: =#
    #=Integration*Problems*Involving*The*Complementary*Error*Function=#

    #= ::Section::Closed:: =#
    #=Integrands*of*the*form*(c+d*x)^m*Erfc(a+b*x)=#

    #= ::Subsection::Closed:: =#
    #=Integrands*of*the*form*x^m*Erfc(b*x)=#

    @test_int [x^5*Erfc(b*x), x, 5, (-5*x)/(8*b^5*ℯ^(b^2*x^2)*sqrt(pi)) - (5*x^3)/(12*b^3*ℯ^(b^2*x^2)*sqrt(pi)) - x^5/(6*b*ℯ^(b^2*x^2)*sqrt(pi)) + (5*erf(b*x))/(16*b^6) + (x^6*Erfc(b*x))/6]
    @test_int [x^3*Erfc(b*x), x, 4, (-3*x)/(8*b^3*ℯ^(b^2*x^2)*sqrt(pi)) - x^3/(4*b*ℯ^(b^2*x^2)*sqrt(pi)) + (3*erf(b*x))/(16*b^4) + (x^4*Erfc(b*x))/4]
    @test_int [x^1*Erfc(b*x), x, 3, -x/(2*b*ℯ^(b^2*x^2)*sqrt(pi)) + erf(b*x)/(4*b^2) + (x^2*Erfc(b*x))/2]
    @test_int [Erfc(b*x)/x^1, x, 2, (-2*b*x*HypergeometricPFQ([1/2, 1/2], [3/2, 3/2], -(b^2*x^2)))/sqrt(pi) + log(x)]
    @test_int [Erfc(b*x)/x^3, x, 3, b/(ℯ^(b^2*x^2)*sqrt(pi)*x) + b^2*erf(b*x) - Erfc(b*x)/(2*x^2)]
    @test_int [Erfc(b*x)/x^5, x, 4, b/(6*ℯ^(b^2*x^2)*sqrt(pi)*x^3) - b^3/(3*ℯ^(b^2*x^2)*sqrt(pi)*x) - (b^4*erf(b*x))/3 - Erfc(b*x)/(4*x^4)]
    @test_int [Erfc(b*x)/x^7, x, 5, b/(15*ℯ^(b^2*x^2)*sqrt(pi)*x^5) - (2*b^3)/(45*ℯ^(b^2*x^2)*sqrt(pi)*x^3) + (4*b^5)/(45*ℯ^(b^2*x^2)*sqrt(pi)*x) + (4*b^6*erf(b*x))/45 - Erfc(b*x)/(6*x^6)]

    @test_int [x^6*Erfc(b*x), x, 5, -6/(7*b^7*ℯ^(b^2*x^2)*sqrt(pi)) - (6*x^2)/(7*b^5*ℯ^(b^2*x^2)*sqrt(pi)) - (3*x^4)/(7*b^3*ℯ^(b^2*x^2)*sqrt(pi)) - x^6/(7*b*ℯ^(b^2*x^2)*sqrt(pi)) + (x^7*Erfc(b*x))/7]
    @test_int [x^4*Erfc(b*x), x, 4, -2/(5*b^5*ℯ^(b^2*x^2)*sqrt(pi)) - (2*x^2)/(5*b^3*ℯ^(b^2*x^2)*sqrt(pi)) - x^4/(5*b*ℯ^(b^2*x^2)*sqrt(pi)) + (x^5*Erfc(b*x))/5]
    @test_int [x^2*Erfc(b*x), x, 3, -1/(3*b^3*ℯ^(b^2*x^2)*sqrt(pi)) - x^2/(3*b*ℯ^(b^2*x^2)*sqrt(pi)) + (x^3*Erfc(b*x))/3]
    @test_int [x^0*Erfc(b*x), x, 1, -(1/(b*ℯ^(b^2*x^2)*sqrt(pi))) + x*Erfc(b*x)]
    @test_int [Erfc(b*x)/x^2, x, 2, -(Erfc(b*x)/x) - (b*ExpIntegralEi(-(b^2*x^2)))/sqrt(pi)]
    @test_int [Erfc(b*x)/x^4, x, 3, b/(3*ℯ^(b^2*x^2)*sqrt(pi)*x^2) - Erfc(b*x)/(3*x^3) + (b^3*ExpIntegralEi(-(b^2*x^2)))/(3*sqrt(pi))]
    @test_int [Erfc(b*x)/x^6, x, 4, b/(10*ℯ^(b^2*x^2)*sqrt(pi)*x^4) - b^3/(10*ℯ^(b^2*x^2)*sqrt(pi)*x^2) - Erfc(b*x)/(5*x^5) - (b^5*ExpIntegralEi(-(b^2*x^2)))/(10*sqrt(pi))]

    #= ::Subsection::Closed:: =#
    #=Integrands*of*the*form*(c+d*x)^m*Erfc(a+b*x)=#

    @test_int [(c + d*x)^3*Erfc(a + b*x), x, 12, -((d^2*(b*c - a*d))/(b^4*ℯ^(a + b*x)^2*sqrt(pi))) - (b*c - a*d)^3/(b^4*ℯ^(a + b*x)^2*sqrt(pi)) - (3*d^3*(a + b*x))/(8*b^4*ℯ^(a + b*x)^2*sqrt(pi)) - (3*d*(b*c - a*d)^2*(a + b*x))/(2*b^4*ℯ^(a + b*x)^2*sqrt(pi)) - (d^2*(b*c - a*d)*(a + b*x)^2)/(b^4*ℯ^(a + b*x)^2*sqrt(pi)) - (d^3*(a + b*x)^3)/(4*b^4*ℯ^(a + b*x)^2*sqrt(pi)) + (3*d^3*erf(a + b*x))/(16*b^4) + (3*d*(b*c - a*d)^2*erf(a + b*x))/(4*b^4) + ((b*c - a*d)^4*erf(a + b*x))/(4*b^4*d) + ((c + d*x)^4*Erfc(a + b*x))/(4*d)]
    @test_int [(c + d*x)^2*Erfc(a + b*x), x, 9, -d^2/(3*b^3*ℯ^(a + b*x)^2*sqrt(pi)) - (b*c - a*d)^2/(b^3*ℯ^(a + b*x)^2*sqrt(pi)) - (d*(b*c - a*d)*(a + b*x))/(b^3*ℯ^(a + b*x)^2*sqrt(pi)) - (d^2*(a + b*x)^2)/(3*b^3*ℯ^(a + b*x)^2*sqrt(pi)) + (d*(b*c - a*d)*erf(a + b*x))/(2*b^3) + ((b*c - a*d)^3*erf(a + b*x))/(3*b^3*d) + ((c + d*x)^3*Erfc(a + b*x))/(3*d)]
    @test_int [(c + d*x)^1*Erfc(a + b*x), x, 7, -((b*c - a*d)/(b^2*ℯ^(a + b*x)^2*sqrt(pi))) - (d*(a + b*x))/(2*b^2*ℯ^(a + b*x)^2*sqrt(pi)) + (d*erf(a + b*x))/(4*b^2) + ((b*c - a*d)^2*erf(a + b*x))/(2*b^2*d) + ((c + d*x)^2*Erfc(a + b*x))/(2*d)]
    @test_int [(c + d*x)^0*Erfc(a + b*x), x, 1, -(1/(b*ℯ^(a + b*x)^2*sqrt(pi))) + ((a + b*x)*Erfc(a + b*x))/b]
    @test_int [Erfc(a + b*x)/(c + d*x)^1, x, 0, Unintegrable(Erfc(a + b*x)/(c + d*x), x)]
    @test_int [Erfc(a + b*x)/(c + d*x)^2, x, 1, -(Erfc(a + b*x)/(d*(c + d*x))) - (2*b*Unintegrable(1/(ℯ^(a + b*x)^2*(c + d*x)), x))/(d*sqrt(pi))]
    @test_int [Erfc(a + b*x)/(c + d*x)^3, x, 3, b/(d^2*ℯ^(a + b*x)^2*sqrt(pi)*(c + d*x)) + (b^2*erf(a + b*x))/d^3 - Erfc(a + b*x)/(2*d*(c + d*x)^2) - (2*b^2*(b*c - a*d)*Unintegrable(1/(ℯ^(a + b*x)^2*(c + d*x)), x))/(d^3*sqrt(pi))]

    #= ::Section::Closed:: =#
    #=Integrands*of*the*form*(c+d*x)^m*Erfc(a+b*x)^2=#

    #= ::Subsection::Closed:: =#
    #=Integrands*of*the*form*x^m*Erfc(b*x)^2=#

    @test_int [x^5*Erfc(b*x)^2, x, 12, 11/(12*b^6*ℯ^(2*b^2*x^2)*pi) + (7*x^2)/(12*b^4*ℯ^(2*b^2*x^2)*pi) + x^4/(6*b^2*ℯ^(2*b^2*x^2)*pi) - (5*x*Erfc(b*x))/(4*b^5*ℯ^(b^2*x^2)*sqrt(pi)) - (5*x^3*Erfc(b*x))/(6*b^3*ℯ^(b^2*x^2)*sqrt(pi)) - (x^5*Erfc(b*x))/(3*b*ℯ^(b^2*x^2)*sqrt(pi)) - (5*Erfc(b*x)^2)/(16*b^6) + (x^6*Erfc(b*x)^2)/6]
    @test_int [x^3*Erfc(b*x)^2, x, 8, 1/(2*b^4*ℯ^(2*b^2*x^2)*pi) + x^2/(4*b^2*ℯ^(2*b^2*x^2)*pi) - (3*x*Erfc(b*x))/(4*b^3*ℯ^(b^2*x^2)*sqrt(pi)) - (x^3*Erfc(b*x))/(2*b*ℯ^(b^2*x^2)*sqrt(pi)) - (3*Erfc(b*x)^2)/(16*b^4) + (x^4*Erfc(b*x)^2)/4]
    @test_int [x^1*Erfc(b*x)^2, x, 5, 1/(2*b^2*ℯ^(2*b^2*x^2)*pi) - (x*Erfc(b*x))/(b*ℯ^(b^2*x^2)*sqrt(pi)) - Erfc(b*x)^2/(4*b^2) + (x^2*Erfc(b*x)^2)/2]
    @test_int [Erfc(b*x)^2/x^1, x, 0, Unintegrable(Erfc(b*x)^2/x, x)]
    @test_int [Erfc(b*x)^2/x^3, x, 5, (2*b*Erfc(b*x))/(ℯ^(b^2*x^2)*sqrt(pi)*x) - b^2*Erfc(b*x)^2 - Erfc(b*x)^2/(2*x^2) + (2*b^2*ExpIntegralEi(-2*b^2*x^2))/pi]
    @test_int [Erfc(b*x)^2/x^5, x, 8, -b^2/(3*ℯ^(2*b^2*x^2)*pi*x^2) + (b*Erfc(b*x))/(3*ℯ^(b^2*x^2)*sqrt(pi)*x^3) - (2*b^3*Erfc(b*x))/(3*ℯ^(b^2*x^2)*sqrt(pi)*x) + (b^4*Erfc(b*x)^2)/3 - Erfc(b*x)^2/(4*x^4) - (4*b^4*ExpIntegralEi(-2*b^2*x^2))/(3*pi)]
    @test_int [Erfc(b*x)^2/x^7, x, 12, -b^2/(15*ℯ^(2*b^2*x^2)*pi*x^4) + (2*b^4)/(9*ℯ^(2*b^2*x^2)*pi*x^2) + (2*b*Erfc(b*x))/(15*ℯ^(b^2*x^2)*sqrt(pi)*x^5) - (4*b^3*Erfc(b*x))/(45*ℯ^(b^2*x^2)*sqrt(pi)*x^3) + (8*b^5*Erfc(b*x))/(45*ℯ^(b^2*x^2)*sqrt(pi)*x) - (4*b^6*Erfc(b*x)^2)/45 - Erfc(b*x)^2/(6*x^6) + (28*b^6*ExpIntegralEi(-2*b^2*x^2))/(45*pi)]

    @test_int [x^4*Erfc(b*x)^2, x, 10, (11*x)/(20*b^4*ℯ^(2*b^2*x^2)*pi) + x^3/(5*b^2*ℯ^(2*b^2*x^2)*pi) - (43*erf(sqrt(2)*b*x))/(40*b^5*sqrt(2*pi)) - (4*Erfc(b*x))/(5*b^5*ℯ^(b^2*x^2)*sqrt(pi)) - (4*x^2*Erfc(b*x))/(5*b^3*ℯ^(b^2*x^2)*sqrt(pi)) - (2*x^4*Erfc(b*x))/(5*b*ℯ^(b^2*x^2)*sqrt(pi)) + (x^5*Erfc(b*x)^2)/5]
    @test_int [x^2*Erfc(b*x)^2, x, 6, x/(3*b^2*ℯ^(2*b^2*x^2)*pi) - (5*erf(sqrt(2)*b*x))/(6*b^3*sqrt(2*pi)) - (2*Erfc(b*x))/(3*b^3*ℯ^(b^2*x^2)*sqrt(pi)) - (2*x^2*Erfc(b*x))/(3*b*ℯ^(b^2*x^2)*sqrt(pi)) + (x^3*Erfc(b*x)^2)/3]
    @test_int [x^0*Erfc(b*x)^2, x, 4, -((sqrt(2/pi)*erf(sqrt(2)*b*x))/b) - (2*Erfc(b*x))/(b*ℯ^(b^2*x^2)*sqrt(pi)) + x*Erfc(b*x)^2]
    @test_int [Erfc(b*x)^2/x^2, x, 0, Unintegrable(Erfc(b*x)^2/x^2, x)]
    @test_int [Erfc(b*x)^2/x^4, x, 0, Unintegrable(Erfc(b*x)^2/x^4, x)]
    @test_int [Erfc(b*x)^2/x^6, x, 0, Unintegrable(Erfc(b*x)^2/x^6, x)]

    #= ::Subsection::Closed:: =#
    #=Integrands*of*the*form*(c+d*x)^m*Erfc(a+b*x)^2=#

    @test_int [(c + d*x)^2*Erfc(a + b*x)^2, x, 16, (d*(b*c - a*d))/(b^3*ℯ^(2*(a + b*x)^2)*pi) + (d^2*(a + b*x))/(3*b^3*ℯ^(2*(a + b*x)^2)*pi) - ((b*c - a*d)^2*sqrt(2/pi)*erf(sqrt(2)*(a + b*x)))/b^3 - (5*d^2*erf(sqrt(2)*(a + b*x)))/(6*b^3*sqrt(2*pi)) - (2*d^2*Erfc(a + b*x))/(3*b^3*ℯ^(a + b*x)^2*sqrt(pi)) - (2*(b*c - a*d)^2*Erfc(a + b*x))/(b^3*ℯ^(a + b*x)^2*sqrt(pi)) - (2*d*(b*c - a*d)*(a + b*x)*Erfc(a + b*x))/(b^3*ℯ^(a + b*x)^2*sqrt(pi)) - (2*d^2*(a + b*x)^2*Erfc(a + b*x))/(3*b^3*ℯ^(a + b*x)^2*sqrt(pi)) - (d*(b*c - a*d)*Erfc(a + b*x)^2)/(2*b^3) + ((b*c - a*d)^2*(a + b*x)*Erfc(a + b*x)^2)/b^3 + (d*(b*c - a*d)*(a + b*x)^2*Erfc(a + b*x)^2)/b^3 + (d^2*(a + b*x)^3*Erfc(a + b*x)^2)/(3*b^3)]
    @test_int [(c + d*x)^1*Erfc(a + b*x)^2, x, 10, d/(2*b^2*ℯ^(2*(a + b*x)^2)*pi) - ((b*c - a*d)*sqrt(2/pi)*erf(sqrt(2)*(a + b*x)))/b^2 - (2*(b*c - a*d)*Erfc(a + b*x))/(b^2*ℯ^(a + b*x)^2*sqrt(pi)) - (d*(a + b*x)*Erfc(a + b*x))/(b^2*ℯ^(a + b*x)^2*sqrt(pi)) - (d*Erfc(a + b*x)^2)/(4*b^2) + ((b*c - a*d)*(a + b*x)*Erfc(a + b*x)^2)/b^2 + (d*(a + b*x)^2*Erfc(a + b*x)^2)/(2*b^2)]
    @test_int [(c + d*x)^0*Erfc(a + b*x)^2, x, 4, -((sqrt(2/pi)*erf(sqrt(2)*(a + b*x)))/b) - (2*Erfc(a + b*x))/(b*ℯ^(a + b*x)^2*sqrt(pi)) + ((a + b*x)*Erfc(a + b*x)^2)/b]
    @test_int [Erfc(a + b*x)^2/(c + d*x)^1, x, 0, Unintegrable(Erfc(a + b*x)^2/(c + d*x), x)]
    @test_int [Erfc(a + b*x)^2/(c + d*x)^2, x, 0, Unintegrable(Erfc(a + b*x)^2/(c + d*x)^2, x)]

    #= ::Section::Closed:: =#
    #=Integrands*of*the*form*(e*x)^m*Erfc(d*(a+b*log(c*x^n)))=#

    @test_int [x^2*Erfc(d*(a + b*log(c*x^n))), x, 5, (ℯ^((9 - 12*a*b*d^2*n)/(4*b^2*d^2*n^2))*x^3*erf((2*a*b*d^2 - 3/n + 2*b^2*d^2*log(c*x^n))/(2*b*d)))/(3*(c*x^n)^(3/n)) + (x^3*Erfc(d*(a + b*log(c*x^n))))/3]
    @test_int [x^1*Erfc(d*(a + b*log(c*x^n))), x, 5, (ℯ^((1 - 2*a*b*d^2*n)/(b^2*d^2*n^2))*x^2*erf((a*b*d^2 - n^(-1) + b^2*d^2*log(c*x^n))/(b*d)))/(2*(c*x^n)^(2/n)) + (x^2*Erfc(d*(a + b*log(c*x^n))))/2]
    @test_int [x^0*Erfc(d*(a + b*log(c*x^n))), x, 5, (ℯ^((1 - 4*a*b*d^2*n)/(4*b^2*d^2*n^2))*x*erf((2*a*b*d^2 - n^(-1) + 2*b^2*d^2*log(c*x^n))/(2*b*d)))/(c*x^n)^n^(-1) + x*Erfc(d*(a + b*log(c*x^n)))]
    @test_int [Erfc(d*(a + b*log(c*x^n)))/x^1, x, 3, -(1/(b*d*ℯ^(d^2*(a + b*log(c*x^n))^2)*n*sqrt(pi))) + (Erfc(d*(a + b*log(c*x^n)))*(a + b*log(c*x^n)))/(b*n)]
    @test_int [Erfc(d*(a + b*log(c*x^n)))/x^2, x, 5, -((ℯ^(1/(4*b^2*d^2*n^2) + a/(b*n))*(c*x^n)^n^(-1)*erf((2*a*b*d^2 + n^(-1) + 2*b^2*d^2*log(c*x^n))/(2*b*d)))/x) - Erfc(d*(a + b*log(c*x^n)))/x]
    @test_int [Erfc(d*(a + b*log(c*x^n)))/x^3, x, 5, -(ℯ^((1 + 2*a*b*d^2*n)/(b^2*d^2*n^2))*(c*x^n)^(2/n)*erf((1 + a*b*d^2*n + b^2*d^2*n*log(c*x^n))/(b*d*n)))/(2*x^2) - Erfc(d*(a + b*log(c*x^n)))/(2*x^2)]

    @test_int [(e*x)^m*Erfc(d*(a + b*log(c*x^n))), x, 5, -((ℯ^(((1 + m)*(1 + m - 4*a*b*d^2*n))/(4*b^2*d^2*n^2))*x*(e*x)^m*erf((1 + m - 2*a*b*d^2*n - 2*b^2*d^2*n*log(c*x^n))/(2*b*d*n)))/((1 + m)*(c*x^n)^((1 + m)/n))) + ((e*x)^(1 + m)*Erfc(d*(a + b*log(c*x^n))))/(e*(1 + m))]

    #= ::Section::Closed:: =#
    #=Integrands*of*the*form*(e*x)^m*ℯ^(c+d*x^2)*Erfc(a+b*x)^n=#

    #= ::Subsection::Closed:: =#
    #=Integrands*of*the*form*ℯ^(c-b^2*x^2)*Erfc(b*x)^n=#

    @test_int [ℯ^(c - b^2*x^2)*Erfc(b*x)^2, x, 2, -((ℯ^c*sqrt(pi)*Erfc(b*x)^3)/(6*b))]
    @test_int [ℯ^(c - b^2*x^2)*Erfc(b*x)^1, x, 2, -((ℯ^c*sqrt(pi)*Erfc(b*x)^2)/(4*b))]
    @test_int [ℯ^(c - b^2*x^2)/Erfc(b*x)^1, x, 2, -((ℯ^c*sqrt(pi)*log(Erfc(b*x)))/(2*b))]
    @test_int [ℯ^(c - b^2*x^2)/Erfc(b*x)^2, x, 2, (ℯ^c*sqrt(pi))/(2*b*Erfc(b*x))]
    @test_int [ℯ^(c - b^2*x^2)/Erfc(b*x)^3, x, 2, (ℯ^c*sqrt(pi))/(4*b*Erfc(b*x)^2)]

    @test_int [ℯ^(c - b^2*x^2)*Erfc(b*x)^n, x, 2, -((ℯ^c*sqrt(pi)*Erfc(b*x)^(1 + n))/(2*b*(1 + n)))]

    #= ::Subsection::Closed:: =#
    #=Integrands*of*the*form*x^m*ℯ^(c+d*x^2)*Erfc(b*x)=#

    @test_int [ℯ^(c + d*x^2)*x^5*Erfc(b*x), x, 9, (b*ℯ^(c - (b^2 - d)*x^2)*x)/((b^2 - d)*d^2*sqrt(pi)) - (3*b*ℯ^(c - (b^2 - d)*x^2)*x)/(4*(b^2 - d)^2*d*sqrt(pi)) - (b*ℯ^(c - (b^2 - d)*x^2)*x^3)/(2*(b^2 - d)*d*sqrt(pi)) + (b*ℯ^c*erf(sqrt(b^2 - d)*x))/(sqrt(b^2 - d)*d^3) - (b*ℯ^c*erf(sqrt(b^2 - d)*x))/(2*(b^2 - d)^(3/2)*d^2) + (3*b*ℯ^c*erf(sqrt(b^2 - d)*x))/(8*(b^2 - d)^(5/2)*d) + (ℯ^(c + d*x^2)*Erfc(b*x))/d^3 - (ℯ^(c + d*x^2)*x^2*Erfc(b*x))/d^2 + (ℯ^(c + d*x^2)*x^4*Erfc(b*x))/(2*d)]
    @test_int [ℯ^(c + d*x^2)*x^3*Erfc(b*x), x, 5, -(b*ℯ^(c - (b^2 - d)*x^2)*x)/(2*(b^2 - d)*d*sqrt(pi)) - (b*ℯ^c*erf(sqrt(b^2 - d)*x))/(2*sqrt(b^2 - d)*d^2) + (b*ℯ^c*erf(sqrt(b^2 - d)*x))/(4*(b^2 - d)^(3/2)*d) - (ℯ^(c + d*x^2)*Erfc(b*x))/(2*d^2) + (ℯ^(c + d*x^2)*x^2*Erfc(b*x))/(2*d)]
    @test_int [ℯ^(c + d*x^2)*x^1*Erfc(b*x), x, 2, (b*ℯ^c*erf(sqrt(b^2 - d)*x))/(2*sqrt(b^2 - d)*d) + (ℯ^(c + d*x^2)*Erfc(b*x))/(2*d)]
    @test_int [(ℯ^(c + d*x^2)*Erfc(b*x))/x^1, x, 0, Unintegrable((ℯ^(c + d*x^2)*Erfc(b*x))/x, x)]
    @test_int [(ℯ^(c + d*x^2)*Erfc(b*x))/x^3, x, 3, (b*ℯ^(c - (b^2 - d)*x^2))/(sqrt(pi)*x) + b*sqrt(b^2 - d)*ℯ^c*erf(sqrt(b^2 - d)*x) - (ℯ^(c + d*x^2)*Erfc(b*x))/(2*x^2) + d*Unintegrable((ℯ^(c + d*x^2)*Erfc(b*x))/x, x)]
    @test_int [(ℯ^(c + d*x^2)*Erfc(b*x))/x^5, x, 7, (b*ℯ^(c - (b^2 - d)*x^2))/(6*sqrt(pi)*x^3) - (b*(b^2 - d)*ℯ^(c - (b^2 - d)*x^2))/(3*sqrt(pi)*x) + (b*d*ℯ^(c - (b^2 - d)*x^2))/(2*sqrt(pi)*x) - (b*(b^2 - d)^(3/2)*ℯ^c*erf(sqrt(b^2 - d)*x))/3 + (b*sqrt(b^2 - d)*d*ℯ^c*erf(sqrt(b^2 - d)*x))/2 - (ℯ^(c + d*x^2)*Erfc(b*x))/(4*x^4) - (d*ℯ^(c + d*x^2)*Erfc(b*x))/(4*x^2) + (d^2*Unintegrable((ℯ^(c + d*x^2)*Erfc(b*x))/x, x))/2]

    @test_int [ℯ^(c + d*x^2)*x^4*Erfc(b*x), x, 5, (3*b*ℯ^(c - (b^2 - d)*x^2))/(4*(b^2 - d)*d^2*sqrt(pi)) - (b*ℯ^(c - (b^2 - d)*x^2))/(2*(b^2 - d)^2*d*sqrt(pi)) - (b*ℯ^(c - (b^2 - d)*x^2)*x^2)/(2*(b^2 - d)*d*sqrt(pi)) - (3*ℯ^(c + d*x^2)*x*Erfc(b*x))/(4*d^2) + (ℯ^(c + d*x^2)*x^3*Erfc(b*x))/(2*d) + (3*Unintegrable(ℯ^(c + d*x^2)*Erfc(b*x), x))/(4*d^2)]
    @test_int [ℯ^(c + d*x^2)*x^2*Erfc(b*x), x, 2, -(b*ℯ^(c - (b^2 - d)*x^2))/(2*(b^2 - d)*d*sqrt(pi)) + (ℯ^(c + d*x^2)*x*Erfc(b*x))/(2*d) - Unintegrable(ℯ^(c + d*x^2)*Erfc(b*x), x)/(2*d)]
    @test_int [ℯ^(c + d*x^2)*x^0*Erfc(b*x), x, 0, Unintegrable(ℯ^(c + d*x^2)*Erfc(b*x), x)]
    @test_int [(ℯ^(c + d*x^2)*Erfc(b*x))/x^2, x, 2, -((ℯ^(c + d*x^2)*Erfc(b*x))/x) - (b*ℯ^c*ExpIntegralEi(-((b^2 - d)*x^2)))/sqrt(pi) + 2*d*Unintegrable(ℯ^(c + d*x^2)*Erfc(b*x), x)]
    @test_int [(ℯ^(c + d*x^2)*Erfc(b*x))/x^4, x, 5, (b*ℯ^(c - (b^2 - d)*x^2))/(3*sqrt(pi)*x^2) - (ℯ^(c + d*x^2)*Erfc(b*x))/(3*x^3) - (2*d*ℯ^(c + d*x^2)*Erfc(b*x))/(3*x) + (b*(b^2 - d)*ℯ^c*ExpIntegralEi(-((b^2 - d)*x^2)))/(3*sqrt(pi)) - (2*b*d*ℯ^c*ExpIntegralEi(-((b^2 - d)*x^2)))/(3*sqrt(pi)) + (4*d^2*Unintegrable(ℯ^(c + d*x^2)*Erfc(b*x), x))/3]

    @test_int [ℯ^(c + b^2*x^2)*x^5*Erfc(b*x), x, 8, (2*ℯ^c*x)/(b^5*sqrt(pi)) - (2*ℯ^c*x^3)/(3*b^3*sqrt(pi)) + (ℯ^c*x^5)/(5*b*sqrt(pi)) + (ℯ^(c + b^2*x^2)*Erfc(b*x))/b^6 - (ℯ^(c + b^2*x^2)*x^2*Erfc(b*x))/b^4 + (ℯ^(c + b^2*x^2)*x^4*Erfc(b*x))/(2*b^2)]
    @test_int [ℯ^(c + b^2*x^2)*x^3*Erfc(b*x), x, 5, -((ℯ^c*x)/(b^3*sqrt(pi))) + (ℯ^c*x^3)/(3*b*sqrt(pi)) - (ℯ^(c + b^2*x^2)*Erfc(b*x))/(2*b^4) + (ℯ^(c + b^2*x^2)*x^2*Erfc(b*x))/(2*b^2)]
    @test_int [ℯ^(c + b^2*x^2)*x^1*Erfc(b*x), x, 2, (ℯ^c*x)/(b*sqrt(pi)) + (ℯ^(c + b^2*x^2)*Erfc(b*x))/(2*b^2)]
    @test_int [(ℯ^(c + b^2*x^2)*Erfc(b*x))/x^1, x, 3, (ℯ^c*ExpIntegralEi(b^2*x^2))/2 - (2*b*ℯ^c*x*HypergeometricPFQ([1/2, 1], [3/2, 3/2], b^2*x^2))/sqrt(pi)]
    @test_int [(ℯ^(c + b^2*x^2)*Erfc(b*x))/x^3, x, 6, (b*ℯ^c)/(sqrt(pi)*x) - (ℯ^(c + b^2*x^2)*Erfc(b*x))/(2*x^2) + (b^2*ℯ^c*ExpIntegralEi(b^2*x^2))/2 - (2*b^3*ℯ^c*x*HypergeometricPFQ([1/2, 1], [3/2, 3/2], b^2*x^2))/sqrt(pi)]
    @test_int [(ℯ^(c + b^2*x^2)*Erfc(b*x))/x^5, x, 9, (b*ℯ^c)/(6*sqrt(pi)*x^3) + (b^3*ℯ^c)/(2*sqrt(pi)*x) - (ℯ^(c + b^2*x^2)*Erfc(b*x))/(4*x^4) - (b^2*ℯ^(c + b^2*x^2)*Erfc(b*x))/(4*x^2) + (b^4*ℯ^c*ExpIntegralEi(b^2*x^2))/4 - (b^5*ℯ^c*x*HypergeometricPFQ([1/2, 1], [3/2, 3/2], b^2*x^2))/sqrt(pi)]

    @test_int [ℯ^(c + b^2*x^2)*x^4*Erfc(b*x), x, 9, -((3*ℯ^c*x^2)/(4*b^3*sqrt(pi))) + (ℯ^c*x^4)/(4*b*sqrt(pi)) - (3*ℯ^(c + b^2*x^2)*x*Erfc(b*x))/(4*b^4) + (ℯ^(c + b^2*x^2)*x^3*Erfc(b*x))/(2*b^2) + (3*ℯ^c*sqrt(pi)*erfi(b*x))/(8*b^5) - (3*ℯ^c*x^2*HypergeometricPFQ([1, 1], [3/2, 2], b^2*x^2))/(4*b^3*sqrt(pi))]
    @test_int [ℯ^(c + b^2*x^2)*x^2*Erfc(b*x), x, 6, (ℯ^c*x^2)/(2*b*sqrt(pi)) + (ℯ^(c + b^2*x^2)*x*Erfc(b*x))/(2*b^2) - (ℯ^c*sqrt(pi)*erfi(b*x))/(4*b^3) + (ℯ^c*x^2*HypergeometricPFQ([1, 1], [3/2, 2], b^2*x^2))/(2*b*sqrt(pi))]
    @test_int [ℯ^(c + b^2*x^2)*x^0*Erfc(b*x), x, 3, (ℯ^c*sqrt(pi)*erfi(b*x))/(2*b) - (b*ℯ^c*x^2*HypergeometricPFQ([1, 1], [3/2, 2], b^2*x^2))/sqrt(pi)]
    @test_int [(ℯ^(c + b^2*x^2)*Erfc(b*x))/x^2, x, 6, -((ℯ^(c + b^2*x^2)*Erfc(b*x))/x) + b*ℯ^c*sqrt(pi)*erfi(b*x) - (2*b^3*ℯ^c*x^2*HypergeometricPFQ([1, 1], [3/2, 2], b^2*x^2))/sqrt(pi) - (2*b*ℯ^c*log(x))/sqrt(pi)]
    @test_int [(ℯ^(c + b^2*x^2)*Erfc(b*x))/x^4, x, 9, (b*ℯ^c)/(3*sqrt(pi)*x^2) - (ℯ^(c + b^2*x^2)*Erfc(b*x))/(3*x^3) - (2*b^2*ℯ^(c + b^2*x^2)*Erfc(b*x))/(3*x) + (2/3)*b^3*ℯ^c*sqrt(pi)*erfi(b*x) - (4*b^5*ℯ^c*x^2*HypergeometricPFQ([1, 1], [3/2, 2], b^2*x^2))/(3*sqrt(pi)) - (4*b^3*ℯ^c*log(x))/(3*sqrt(pi))]

    @test_int [x^5*Erfc(b*x)/ℯ^(b^2*x^2), x, 9, (11*x)/(16*b^5*ℯ^(2*b^2*x^2)*sqrt(pi)) + x^3/(4*b^3*ℯ^(2*b^2*x^2)*sqrt(pi)) - (43*erf(sqrt(2)*b*x))/(32*sqrt(2)*b^6) - Erfc(b*x)/(b^6*ℯ^(b^2*x^2)) - (x^2*Erfc(b*x))/(b^4*ℯ^(b^2*x^2)) - (x^4*Erfc(b*x))/(2*b^2*ℯ^(b^2*x^2))]
    @test_int [x^3*Erfc(b*x)/ℯ^(b^2*x^2), x, 5, x/(4*b^3*ℯ^(2*b^2*x^2)*sqrt(pi)) - (5*erf(sqrt(2)*b*x))/(8*sqrt(2)*b^4) - Erfc(b*x)/(2*b^4*ℯ^(b^2*x^2)) - (x^2*Erfc(b*x))/(2*b^2*ℯ^(b^2*x^2))]
    @test_int [x^1*Erfc(b*x)/ℯ^(b^2*x^2), x, 2, -erf(sqrt(2)*b*x)/(2*sqrt(2)*b^2) - Erfc(b*x)/(2*b^2*ℯ^(b^2*x^2))]
    @test_int [Erfc(b*x)/(ℯ^(b^2*x^2)*x^1), x, 0, Unintegrable(Erfc(b*x)/(ℯ^(b^2*x^2)*x), x)]
    @test_int [Erfc(b*x)/(ℯ^(b^2*x^2)*x^3), x, 3, b/(ℯ^(2*b^2*x^2)*sqrt(pi)*x) + sqrt(2)*b^2*erf(sqrt(2)*b*x) - Erfc(b*x)/(2*ℯ^(b^2*x^2)*x^2) - b^2*Unintegrable(Erfc(b*x)/(ℯ^(b^2*x^2)*x), x)]
    @test_int [Erfc(b*x)/(ℯ^(b^2*x^2)*x^5), x, 7, b/(6*ℯ^(2*b^2*x^2)*sqrt(pi)*x^3) - (7*b^3)/(6*ℯ^(2*b^2*x^2)*sqrt(pi)*x) - (b^4*erf(sqrt(2)*b*x))/sqrt(2) - (2*sqrt(2)*b^4*erf(sqrt(2)*b*x))/3 - Erfc(b*x)/(4*ℯ^(b^2*x^2)*x^4) + (b^2*Erfc(b*x))/(4*ℯ^(b^2*x^2)*x^2) + (b^4*Unintegrable(Erfc(b*x)/(ℯ^(b^2*x^2)*x), x))/2]

    @test_int [x^4*Erfc(b*x)/ℯ^(b^2*x^2), x, 7, 1/(2*b^5*ℯ^(2*b^2*x^2)*sqrt(pi)) + x^2/(4*b^3*ℯ^(2*b^2*x^2)*sqrt(pi)) - (3*x*Erfc(b*x))/(4*b^4*ℯ^(b^2*x^2)) - (x^3*Erfc(b*x))/(2*b^2*ℯ^(b^2*x^2)) - (3*sqrt(pi)*Erfc(b*x)^2)/(16*b^5)]
    @test_int [x^2*Erfc(b*x)/ℯ^(b^2*x^2), x, 4, 1/(4*b^3*ℯ^(2*b^2*x^2)*sqrt(pi)) - (x*Erfc(b*x))/(2*b^2*ℯ^(b^2*x^2)) - (sqrt(pi)*Erfc(b*x)^2)/(8*b^3)]
    @test_int [x^0*Erfc(b*x)/ℯ^(b^2*x^2), x, 2, -(sqrt(pi)*Erfc(b*x)^2)/(4*b)]
    @test_int [Erfc(b*x)/(ℯ^(b^2*x^2)*x^2), x, 4, -(Erfc(b*x)/(ℯ^(b^2*x^2)*x)) + (b*sqrt(pi)*Erfc(b*x)^2)/2 - (b*ExpIntegralEi(-2*b^2*x^2))/sqrt(pi)]
    @test_int [Erfc(b*x)/(ℯ^(b^2*x^2)*x^4), x, 7, b/(3*ℯ^(2*b^2*x^2)*sqrt(pi)*x^2) - Erfc(b*x)/(3*ℯ^(b^2*x^2)*x^3) + (2*b^2*Erfc(b*x))/(3*ℯ^(b^2*x^2)*x) - (b^3*sqrt(pi)*Erfc(b*x)^2)/3 + (4*b^3*ExpIntegralEi(-2*b^2*x^2))/(3*sqrt(pi))]

    #= ::Subsection::Closed:: =#
    #=Integrands*of*the*form*x^m*ℯ^(c+d*x^2)*Erfc(a+b*x)=#

    @test_int [ℯ^(c + d*x^2)*x^3*Erfc(a + b*x), x, 10, (a*b^2*ℯ^(-a^2 + c - 2*a*b*x - (b^2 - d)*x^2))/(2*(b^2 - d)^2*d*sqrt(pi)) - (b*ℯ^(-a^2 + c - 2*a*b*x - (b^2 - d)*x^2)*x)/(2*(b^2 - d)*d*sqrt(pi)) - (b*ℯ^(c + (a^2*d)/(b^2 - d))*erf((a*b + (b^2 - d)*x)/sqrt(b^2 - d)))/(2*sqrt(b^2 - d)*d^2) + (a^2*b^3*ℯ^(c + (a^2*d)/(b^2 - d))*erf((a*b + (b^2 - d)*x)/sqrt(b^2 - d)))/(2*(b^2 - d)^(5/2)*d) + (b*ℯ^(c + (a^2*d)/(b^2 - d))*erf((a*b + (b^2 - d)*x)/sqrt(b^2 - d)))/(4*(b^2 - d)^(3/2)*d) - (ℯ^(c + d*x^2)*Erfc(a + b*x))/(2*d^2) + (ℯ^(c + d*x^2)*x^2*Erfc(a + b*x))/(2*d)]
    @test_int [ℯ^(c + d*x^2)*x^1*Erfc(a + b*x), x, 3, (b*ℯ^(c + (a^2*d)/(b^2 - d))*erf((a*b + (b^2 - d)*x)/sqrt(b^2 - d)))/(2*sqrt(b^2 - d)*d) + (ℯ^(c + d*x^2)*Erfc(a + b*x))/(2*d)]
    @test_int [ℯ^(c + d*x^2)*Erfc(a + b*x)/x^1, x, 0, Unintegrable((ℯ^(c + d*x^2)*Erfc(a + b*x))/x, x)]
    @test_int [ℯ^(c + d*x^2)*Erfc(a + b*x)/x^3, x, 4, (b*ℯ^(-a^2 + c - 2*a*b*x - (b^2 - d)*x^2))/(sqrt(pi)*x) + b*sqrt(b^2 - d)*ℯ^(c + (a^2*d)/(b^2 - d))*erf((a*b + (b^2 - d)*x)/sqrt(b^2 - d)) - (ℯ^(c + d*x^2)*Erfc(a + b*x))/(2*x^2) + (2*a*b^2*Unintegrable(ℯ^(-a^2 + c - 2*a*b*x + (-b^2 + d)*x^2)/x, x))/sqrt(pi) + d*Unintegrable((ℯ^(c + d*x^2)*Erfc(a + b*x))/x, x)]

    @test_int [ℯ^(c + d*x^2)*x^4*Erfc(a + b*x), x, 15, (3*b*ℯ^(-a^2 + c - 2*a*b*x - (b^2 - d)*x^2))/(4*(b^2 - d)*d^2*sqrt(pi)) - (a^2*b^3*ℯ^(-a^2 + c - 2*a*b*x - (b^2 - d)*x^2))/(2*(b^2 - d)^3*d*sqrt(pi)) - (b*ℯ^(-a^2 + c - 2*a*b*x - (b^2 - d)*x^2))/(2*(b^2 - d)^2*d*sqrt(pi)) + (a*b^2*ℯ^(-a^2 + c - 2*a*b*x - (b^2 - d)*x^2)*x)/(2*(b^2 - d)^2*d*sqrt(pi)) - (b*ℯ^(-a^2 + c - 2*a*b*x - (b^2 - d)*x^2)*x^2)/(2*(b^2 - d)*d*sqrt(pi)) + (3*a*b^2*ℯ^(c + (a^2*d)/(b^2 - d))*erf((a*b + (b^2 - d)*x)/sqrt(b^2 - d)))/(4*(b^2 - d)^(3/2)*d^2) - (a^3*b^4*ℯ^(c + (a^2*d)/(b^2 - d))*erf((a*b + (b^2 - d)*x)/sqrt(b^2 - d)))/(2*(b^2 - d)^(7/2)*d) - (3*a*b^2*ℯ^(c + (a^2*d)/(b^2 - d))*erf((a*b + (b^2 - d)*x)/sqrt(b^2 - d)))/(4*(b^2 - d)^(5/2)*d) - (3*ℯ^(c + d*x^2)*x*Erfc(a + b*x))/(4*d^2) + (ℯ^(c + d*x^2)*x^3*Erfc(a + b*x))/(2*d) + (3*Unintegrable(ℯ^(c + d*x^2)*Erfc(a + b*x), x))/(4*d^2)]
    @test_int [ℯ^(c + d*x^2)*x^2*Erfc(a + b*x), x, 4, -(b*ℯ^(-a^2 + c - 2*a*b*x - (b^2 - d)*x^2))/(2*(b^2 - d)*d*sqrt(pi)) - (a*b^2*ℯ^(c + (a^2*d)/(b^2 - d))*erf((a*b + (b^2 - d)*x)/sqrt(b^2 - d)))/(2*(b^2 - d)^(3/2)*d) + (ℯ^(c + d*x^2)*x*Erfc(a + b*x))/(2*d) - Unintegrable(ℯ^(c + d*x^2)*Erfc(a + b*x), x)/(2*d)]
    @test_int [ℯ^(c + d*x^2)*x^0*Erfc(a + b*x), x, 0, Unintegrable(ℯ^(c + d*x^2)*Erfc(a + b*x), x)]
    @test_int [ℯ^(c + d*x^2)*Erfc(a + b*x)/x^2, x, 1, -((ℯ^(c + d*x^2)*Erfc(a + b*x))/x) - (2*b*Unintegrable(ℯ^(-a^2 + c - 2*a*b*x + (-b^2 + d)*x^2)/x, x))/sqrt(pi) + 2*d*Unintegrable(ℯ^(c + d*x^2)*Erfc(a + b*x), x)]
    @test_int [ℯ^(c + d*x^2)*Erfc(a + b*x)/x^4, x, 6, (b*ℯ^(-a^2 + c - 2*a*b*x - (b^2 - d)*x^2))/(3*sqrt(pi)*x^2) - (2*a*b^2*ℯ^(-a^2 + c - 2*a*b*x - (b^2 - d)*x^2))/(3*sqrt(pi)*x) - (2*a*b^2*sqrt(b^2 - d)*ℯ^(c + (a^2*d)/(b^2 - d))*erf((a*b + (b^2 - d)*x)/sqrt(b^2 - d)))/3 - (ℯ^(c + d*x^2)*Erfc(a + b*x))/(3*x^3) - (2*d*ℯ^(c + d*x^2)*Erfc(a + b*x))/(3*x) - (4*a^2*b^3*Unintegrable(ℯ^(-a^2 + c - 2*a*b*x + (-b^2 + d)*x^2)/x, x))/(3*sqrt(pi)) + (2*b*(b^2 - d)*Unintegrable(ℯ^(-a^2 + c - 2*a*b*x + (-b^2 + d)*x^2)/x, x))/(3*sqrt(pi)) - (4*b*d*Unintegrable(ℯ^(-a^2 + c - 2*a*b*x + (-b^2 + d)*x^2)/x, x))/(3*sqrt(pi)) + (4*d^2*Unintegrable(ℯ^(c + d*x^2)*Erfc(a + b*x), x))/3]

    @test_int [Erfc(b*x)/(ℯ^(b^2*x^2)*x^3) + (b^2*Erfc(b*x))/(ℯ^(b^2*x^2)*x), x, 4, b/(ℯ^(2*b^2*x^2)*sqrt(pi)*x) + sqrt(2)*b^2*erf(sqrt(2)*b*x) - Erfc(b*x)/(2*ℯ^(b^2*x^2)*x^2)]

    #= ::Section::Closed:: =#
    #=Integrands*of*the*form*(e*x)^m*Trig(c+d*x^2)*Erfc(a+b*x)^n=#

    @test_int [sin(c + im*b^2*x^2)*Erfc(b*x), x, 6, (im*ℯ^(im*c)*sqrt(pi)*Erfc(b*x)^2)/(8*b) + (im*sqrt(pi)*erfi(b*x))/(ℯ^(im*c)*(4*b)) - (im*b*x^2*HypergeometricPFQ([1, 1], [3/2, 2], b^2*x^2))/(ℯ^(im*c)*(2*sqrt(pi)))]
    @test_int [sin(c - im*b^2*x^2)*Erfc(b*x), x, 6, -((im*sqrt(pi)*Erfc(b*x)^2)/(ℯ^(im*c)*(8*b))) - (im*ℯ^(im*c)*sqrt(pi)*erfi(b*x))/(4*b) + (im*b*ℯ^(im*c)*x^2*HypergeometricPFQ([1, 1], [3/2, 2], b^2*x^2))/(2*sqrt(pi))]

    @test_int [cos(c + im*b^2*x^2)*Erfc(b*x), x, 6, -((ℯ^(im*c)*sqrt(pi)*Erfc(b*x)^2)/(8*b)) + (sqrt(pi)*erfi(b*x))/(ℯ^(im*c)*(4*b)) - (b*x^2*HypergeometricPFQ([1, 1], [3/2, 2], b^2*x^2))/(ℯ^(im*c)*(2*sqrt(pi)))]
    @test_int [cos(c - im*b^2*x^2)*Erfc(b*x), x, 6, -((sqrt(pi)*Erfc(b*x)^2)/(ℯ^(im*c)*(8*b))) + (ℯ^(im*c)*sqrt(pi)*erfi(b*x))/(4*b) - (b*ℯ^(im*c)*x^2*HypergeometricPFQ([1, 1], [3/2, 2], b^2*x^2))/(2*sqrt(pi))]

    @test_int [sinh(c + b^2*x^2)*Erfc(b*x), x, 6, (sqrt(pi)*Erfc(b*x)^2)/(ℯ^c*(8*b)) + (ℯ^c*sqrt(pi)*erfi(b*x))/(4*b) - (b*ℯ^c*x^2*HypergeometricPFQ([1, 1], [3/2, 2], b^2*x^2))/(2*sqrt(pi))]
    @test_int [sinh(c - b^2*x^2)*Erfc(b*x), x, 6, -((ℯ^c*sqrt(pi)*Erfc(b*x)^2)/(8*b)) - (sqrt(pi)*erfi(b*x))/(ℯ^c*(4*b)) + (b*x^2*HypergeometricPFQ([1, 1], [3/2, 2], b^2*x^2))/(ℯ^c*(2*sqrt(pi)))]

    @test_int [cosh(c + b^2*x^2)*Erfc(b*x), x, 6, -((sqrt(pi)*Erfc(b*x)^2)/(ℯ^c*(8*b))) + (ℯ^c*sqrt(pi)*erfi(b*x))/(4*b) - (b*ℯ^c*x^2*HypergeometricPFQ([1, 1], [3/2, 2], b^2*x^2))/(2*sqrt(pi))]
    @test_int [cosh(c - b^2*x^2)*Erfc(b*x), x, 6, -((ℯ^c*sqrt(pi)*Erfc(b*x)^2)/(8*b)) + (sqrt(pi)*erfi(b*x))/(ℯ^c*(4*b)) - (b*x^2*HypergeometricPFQ([1, 1], [3/2, 2], b^2*x^2))/(ℯ^c*(2*sqrt(pi)))]

    #= ::Title::Closed:: =#
    #=Integration*Problems*Involving*The*Imaginary*Error*Function=#

    #= ::Section::Closed:: =#
    #=Integrands*of*the*form*(c+d*x)^m*erfi(a+b*x)=#

    #= ::Subsection::Closed:: =#
    #=Integrands*of*the*form*x^m*erfi(b*x)=#

    @test_int [x^5*erfi(b*x), x, 5, (-5*ℯ^(b^2*x^2)*x)/(8*b^5*sqrt(pi)) + (5*ℯ^(b^2*x^2)*x^3)/(12*b^3*sqrt(pi)) - (ℯ^(b^2*x^2)*x^5)/(6*b*sqrt(pi)) + (5*erfi(b*x))/(16*b^6) + (x^6*erfi(b*x))/6]
    @test_int [x^3*erfi(b*x), x, 4, (3*ℯ^(b^2*x^2)*x)/(8*b^3*sqrt(pi)) - (ℯ^(b^2*x^2)*x^3)/(4*b*sqrt(pi)) - (3*erfi(b*x))/(16*b^4) + (x^4*erfi(b*x))/4]
    @test_int [x^1*erfi(b*x), x, 3, -(ℯ^(b^2*x^2)*x)/(2*b*sqrt(pi)) + erfi(b*x)/(4*b^2) + (x^2*erfi(b*x))/2]
    @test_int [erfi(b*x)/x^1, x, 1, (2*b*x*HypergeometricPFQ([1/2, 1/2], [3/2, 3/2], b^2*x^2))/sqrt(pi)]
    @test_int [erfi(b*x)/x^3, x, 3, -((b*ℯ^(b^2*x^2))/(sqrt(pi)*x)) + b^2*erfi(b*x) - erfi(b*x)/(2*x^2)]
    @test_int [erfi(b*x)/x^5, x, 4, -(b*ℯ^(b^2*x^2))/(6*sqrt(pi)*x^3) - (b^3*ℯ^(b^2*x^2))/(3*sqrt(pi)*x) + (b^4*erfi(b*x))/3 - erfi(b*x)/(4*x^4)]
    @test_int [erfi(b*x)/x^7, x, 5, -(b*ℯ^(b^2*x^2))/(15*sqrt(pi)*x^5) - (2*b^3*ℯ^(b^2*x^2))/(45*sqrt(pi)*x^3) - (4*b^5*ℯ^(b^2*x^2))/(45*sqrt(pi)*x) + (4*b^6*erfi(b*x))/45 - erfi(b*x)/(6*x^6)]

    @test_int [x^6*erfi(b*x), x, 5, (6*ℯ^(b^2*x^2))/(7*b^7*sqrt(pi)) - (6*ℯ^(b^2*x^2)*x^2)/(7*b^5*sqrt(pi)) + (3*ℯ^(b^2*x^2)*x^4)/(7*b^3*sqrt(pi)) - (ℯ^(b^2*x^2)*x^6)/(7*b*sqrt(pi)) + (x^7*erfi(b*x))/7]
    @test_int [x^4*erfi(b*x), x, 4, (-2*ℯ^(b^2*x^2))/(5*b^5*sqrt(pi)) + (2*ℯ^(b^2*x^2)*x^2)/(5*b^3*sqrt(pi)) - (ℯ^(b^2*x^2)*x^4)/(5*b*sqrt(pi)) + (x^5*erfi(b*x))/5]
    @test_int [x^2*erfi(b*x), x, 3, ℯ^(b^2*x^2)/(3*b^3*sqrt(pi)) - (ℯ^(b^2*x^2)*x^2)/(3*b*sqrt(pi)) + (x^3*erfi(b*x))/3]
    @test_int [x^0*erfi(b*x), x, 1, -(ℯ^(b^2*x^2)/(b*sqrt(pi))) + x*erfi(b*x)]
    @test_int [erfi(b*x)/x^2, x, 2, -(erfi(b*x)/x) + (b*ExpIntegralEi(b^2*x^2))/sqrt(pi)]
    @test_int [erfi(b*x)/x^4, x, 3, -(b*ℯ^(b^2*x^2))/(3*sqrt(pi)*x^2) - erfi(b*x)/(3*x^3) + (b^3*ExpIntegralEi(b^2*x^2))/(3*sqrt(pi))]
    @test_int [erfi(b*x)/x^6, x, 4, -(b*ℯ^(b^2*x^2))/(10*sqrt(pi)*x^4) - (b^3*ℯ^(b^2*x^2))/(10*sqrt(pi)*x^2) - erfi(b*x)/(5*x^5) + (b^5*ExpIntegralEi(b^2*x^2))/(10*sqrt(pi))]

    #= ::Subsection::Closed:: =#
    #=Integrands*of*the*form*(c+d*x)^m*erfi(a+b*x)=#

    @test_int [(c + d*x)^3*erfi(a + b*x), x, 12, (d^2*(b*c - a*d)*ℯ^(a + b*x)^2)/(b^4*sqrt(pi)) - ((b*c - a*d)^3*ℯ^(a + b*x)^2)/(b^4*sqrt(pi)) + (3*d^3*ℯ^(a + b*x)^2*(a + b*x))/(8*b^4*sqrt(pi)) - (3*d*(b*c - a*d)^2*ℯ^(a + b*x)^2*(a + b*x))/(2*b^4*sqrt(pi)) - (d^2*(b*c - a*d)*ℯ^(a + b*x)^2*(a + b*x)^2)/(b^4*sqrt(pi)) - (d^3*ℯ^(a + b*x)^2*(a + b*x)^3)/(4*b^4*sqrt(pi)) - (3*d^3*erfi(a + b*x))/(16*b^4) + (3*d*(b*c - a*d)^2*erfi(a + b*x))/(4*b^4) - ((b*c - a*d)^4*erfi(a + b*x))/(4*b^4*d) + ((c + d*x)^4*erfi(a + b*x))/(4*d)]
    @test_int [(c + d*x)^2*erfi(a + b*x), x, 9, (d^2*ℯ^(a + b*x)^2)/(3*b^3*sqrt(pi)) - ((b*c - a*d)^2*ℯ^(a + b*x)^2)/(b^3*sqrt(pi)) - (d*(b*c - a*d)*ℯ^(a + b*x)^2*(a + b*x))/(b^3*sqrt(pi)) - (d^2*ℯ^(a + b*x)^2*(a + b*x)^2)/(3*b^3*sqrt(pi)) + (d*(b*c - a*d)*erfi(a + b*x))/(2*b^3) - ((b*c - a*d)^3*erfi(a + b*x))/(3*b^3*d) + ((c + d*x)^3*erfi(a + b*x))/(3*d)]
    @test_int [(c + d*x)^1*erfi(a + b*x), x, 7, -(((b*c - a*d)*ℯ^(a + b*x)^2)/(b^2*sqrt(pi))) - (d*ℯ^(a + b*x)^2*(a + b*x))/(2*b^2*sqrt(pi)) + (d*erfi(a + b*x))/(4*b^2) - ((b*c - a*d)^2*erfi(a + b*x))/(2*b^2*d) + ((c + d*x)^2*erfi(a + b*x))/(2*d)]
    @test_int [(c + d*x)^0*erfi(a + b*x), x, 1, -(ℯ^(a + b*x)^2/(b*sqrt(pi))) + ((a + b*x)*erfi(a + b*x))/b]
    @test_int [erfi(a + b*x)/(c + d*x)^1, x, 0, Unintegrable(erfi(a + b*x)/(c + d*x), x)]
    @test_int [erfi(a + b*x)/(c + d*x)^2, x, 1, -(erfi(a + b*x)/(d*(c + d*x))) + (2*b*Unintegrable(ℯ^(a + b*x)^2/(c + d*x), x))/(d*sqrt(pi))]
    @test_int [erfi(a + b*x)/(c + d*x)^3, x, 3, -((b*ℯ^(a + b*x)^2)/(d^2*sqrt(pi)*(c + d*x))) + (b^2*erfi(a + b*x))/d^3 - erfi(a + b*x)/(2*d*(c + d*x)^2) - (2*b^2*(b*c - a*d)*Unintegrable(ℯ^(a + b*x)^2/(c + d*x), x))/(d^3*sqrt(pi))]

    #= ::Section::Closed:: =#
    #=Integrands*of*the*form*(c+d*x)^m*erfi(a+b*x)^2=#

    #= ::Subsection::Closed:: =#
    #=Integrands*of*the*form*x^m*erfi(b*x)^2=#

    @test_int [x^5*erfi(b*x)^2, x, 12, (11*ℯ^(2*b^2*x^2))/(12*b^6*pi) - (7*ℯ^(2*b^2*x^2)*x^2)/(12*b^4*pi) + (ℯ^(2*b^2*x^2)*x^4)/(6*b^2*pi) - (5*ℯ^(b^2*x^2)*x*erfi(b*x))/(4*b^5*sqrt(pi)) + (5*ℯ^(b^2*x^2)*x^3*erfi(b*x))/(6*b^3*sqrt(pi)) - (ℯ^(b^2*x^2)*x^5*erfi(b*x))/(3*b*sqrt(pi)) + (5*erfi(b*x)^2)/(16*b^6) + (x^6*erfi(b*x)^2)/6]
    @test_int [x^3*erfi(b*x)^2, x, 8, -ℯ^(2*b^2*x^2)/(2*b^4*pi) + (ℯ^(2*b^2*x^2)*x^2)/(4*b^2*pi) + (3*ℯ^(b^2*x^2)*x*erfi(b*x))/(4*b^3*sqrt(pi)) - (ℯ^(b^2*x^2)*x^3*erfi(b*x))/(2*b*sqrt(pi)) - (3*erfi(b*x)^2)/(16*b^4) + (x^4*erfi(b*x)^2)/4]
    @test_int [x^1*erfi(b*x)^2, x, 5, ℯ^(2*b^2*x^2)/(2*b^2*pi) - (ℯ^(b^2*x^2)*x*erfi(b*x))/(b*sqrt(pi)) + erfi(b*x)^2/(4*b^2) + (x^2*erfi(b*x)^2)/2]
    @test_int [erfi(b*x)^2/x^1, x, 0, Unintegrable(erfi(b*x)^2/x, x)]
    @test_int [erfi(b*x)^2/x^3, x, 5, (-2*b*ℯ^(b^2*x^2)*erfi(b*x))/(sqrt(pi)*x) + b^2*erfi(b*x)^2 - erfi(b*x)^2/(2*x^2) + (2*b^2*ExpIntegralEi(2*b^2*x^2))/pi]
    @test_int [erfi(b*x)^2/x^5, x, 8, -(b^2*ℯ^(2*b^2*x^2))/(3*pi*x^2) - (b*ℯ^(b^2*x^2)*erfi(b*x))/(3*sqrt(pi)*x^3) - (2*b^3*ℯ^(b^2*x^2)*erfi(b*x))/(3*sqrt(pi)*x) + (b^4*erfi(b*x)^2)/3 - erfi(b*x)^2/(4*x^4) + (4*b^4*ExpIntegralEi(2*b^2*x^2))/(3*pi)]
    @test_int [erfi(b*x)^2/x^7, x, 12, -(b^2*ℯ^(2*b^2*x^2))/(15*pi*x^4) - (2*b^4*ℯ^(2*b^2*x^2))/(9*pi*x^2) - (2*b*ℯ^(b^2*x^2)*erfi(b*x))/(15*sqrt(pi)*x^5) - (4*b^3*ℯ^(b^2*x^2)*erfi(b*x))/(45*sqrt(pi)*x^3) - (8*b^5*ℯ^(b^2*x^2)*erfi(b*x))/(45*sqrt(pi)*x) + (4*b^6*erfi(b*x)^2)/45 - erfi(b*x)^2/(6*x^6) + (28*b^6*ExpIntegralEi(2*b^2*x^2))/(45*pi)]

    @test_int [x^4*erfi(b*x)^2, x, 10, (-11*ℯ^(2*b^2*x^2)*x)/(20*b^4*pi) + (ℯ^(2*b^2*x^2)*x^3)/(5*b^2*pi) - (4*ℯ^(b^2*x^2)*erfi(b*x))/(5*b^5*sqrt(pi)) + (4*ℯ^(b^2*x^2)*x^2*erfi(b*x))/(5*b^3*sqrt(pi)) - (2*ℯ^(b^2*x^2)*x^4*erfi(b*x))/(5*b*sqrt(pi)) + (x^5*erfi(b*x)^2)/5 + (43*erfi(sqrt(2)*b*x))/(40*b^5*sqrt(2*pi))]
    @test_int [x^2*erfi(b*x)^2, x, 6, (ℯ^(2*b^2*x^2)*x)/(3*b^2*pi) + (2*ℯ^(b^2*x^2)*erfi(b*x))/(3*b^3*sqrt(pi)) - (2*ℯ^(b^2*x^2)*x^2*erfi(b*x))/(3*b*sqrt(pi)) + (x^3*erfi(b*x)^2)/3 - (5*erfi(sqrt(2)*b*x))/(6*b^3*sqrt(2*pi))]
    @test_int [x^0*erfi(b*x)^2, x, 4, (-2*ℯ^(b^2*x^2)*erfi(b*x))/(b*sqrt(pi)) + x*erfi(b*x)^2 + (sqrt(2/pi)*erfi(sqrt(2)*b*x))/b]
    @test_int [erfi(b*x)^2/x^2, x, 0, Unintegrable(erfi(b*x)^2/x^2, x)]
    @test_int [erfi(b*x)^2/x^4, x, 0, Unintegrable(erfi(b*x)^2/x^4, x)]
    @test_int [erfi(b*x)^2/x^6, x, 0, Unintegrable(erfi(b*x)^2/x^6, x)]

    #= ::Subsection::Closed:: =#
    #=Integrands*of*the*form*(c+d*x)^m*erfi(a+b*x)^2=#

    @test_int [(c + d*x)^2*erfi(a + b*x)^2, x, 16, (d*(b*c - a*d)*ℯ^(2*(a + b*x)^2))/(b^3*pi) + (d^2*ℯ^(2*(a + b*x)^2)*(a + b*x))/(3*b^3*pi) + (2*d^2*ℯ^(a + b*x)^2*erfi(a + b*x))/(3*b^3*sqrt(pi)) - (2*(b*c - a*d)^2*ℯ^(a + b*x)^2*erfi(a + b*x))/(b^3*sqrt(pi)) - (2*d*(b*c - a*d)*ℯ^(a + b*x)^2*(a + b*x)*erfi(a + b*x))/(b^3*sqrt(pi)) - (2*d^2*ℯ^(a + b*x)^2*(a + b*x)^2*erfi(a + b*x))/(3*b^3*sqrt(pi)) + (d*(b*c - a*d)*erfi(a + b*x)^2)/(2*b^3) + ((b*c - a*d)^2*(a + b*x)*erfi(a + b*x)^2)/b^3 + (d*(b*c - a*d)*(a + b*x)^2*erfi(a + b*x)^2)/b^3 + (d^2*(a + b*x)^3*erfi(a + b*x)^2)/(3*b^3) + ((b*c - a*d)^2*sqrt(2/pi)*erfi(sqrt(2)*(a + b*x)))/b^3 - (5*d^2*erfi(sqrt(2)*(a + b*x)))/(6*b^3*sqrt(2*pi))]
    @test_int [(c + d*x)^1*erfi(a + b*x)^2, x, 10, (d*ℯ^(2*(a + b*x)^2))/(2*b^2*pi) - (2*(b*c - a*d)*ℯ^(a + b*x)^2*erfi(a + b*x))/(b^2*sqrt(pi)) - (d*ℯ^(a + b*x)^2*(a + b*x)*erfi(a + b*x))/(b^2*sqrt(pi)) + (d*erfi(a + b*x)^2)/(4*b^2) + ((b*c - a*d)*(a + b*x)*erfi(a + b*x)^2)/b^2 + (d*(a + b*x)^2*erfi(a + b*x)^2)/(2*b^2) + ((b*c - a*d)*sqrt(2/pi)*erfi(sqrt(2)*(a + b*x)))/b^2]
    @test_int [(c + d*x)^0*erfi(a + b*x)^2, x, 4, (-2*ℯ^(a + b*x)^2*erfi(a + b*x))/(b*sqrt(pi)) + ((a + b*x)*erfi(a + b*x)^2)/b + (sqrt(2/pi)*erfi(sqrt(2)*(a + b*x)))/b]
    @test_int [erfi(a + b*x)^2/(c + d*x)^1, x, 0, Unintegrable(erfi(a + b*x)^2/(c + d*x), x)]
    @test_int [erfi(a + b*x)^2/(c + d*x)^2, x, 0, Unintegrable(erfi(a + b*x)^2/(c + d*x)^2, x)]

    #= ::Section::Closed:: =#
    #=Integrands*of*the*form*(e*x)^m*erfi(d*(a+b*log(c*x^n)))=#

    @test_int [x^2*erfi(d*(a + b*log(c*x^n))), x, 5, (x^3*erfi(d*(a + b*log(c*x^n))))/3 - (x^3*erfi((2*a*b*d^2 + 3/n + 2*b^2*d^2*log(c*x^n))/(2*b*d)))/(3*ℯ^((3*(3 + 4*a*b*d^2*n))/(4*b^2*d^2*n^2))*(c*x^n)^(3/n))]
    @test_int [x^1*erfi(d*(a + b*log(c*x^n))), x, 5, (x^2*erfi(d*(a + b*log(c*x^n))))/2 - (x^2*erfi((a*b*d^2 + n^(-1) + b^2*d^2*log(c*x^n))/(b*d)))/(2*ℯ^((1 + 2*a*b*d^2*n)/(b^2*d^2*n^2))*(c*x^n)^(2/n))]
    @test_int [x^0*erfi(d*(a + b*log(c*x^n))), x, 5, x*erfi(d*(a + b*log(c*x^n))) - (x*erfi((2*a*b*d^2 + n^(-1) + 2*b^2*d^2*log(c*x^n))/(2*b*d)))/(ℯ^((1 + 4*a*b*d^2*n)/(4*b^2*d^2*n^2))*(c*x^n)^n^(-1))]
    @test_int [erfi(d*(a + b*log(c*x^n)))/x^1, x, 3, -(ℯ^(a*d + b*d*log(c*x^n))^2/(b*d*n*sqrt(pi))) + (erfi(d*(a + b*log(c*x^n)))*(a + b*log(c*x^n)))/(b*n)]
    @test_int [erfi(d*(a + b*log(c*x^n)))/x^2, x, 5, -(erfi(d*(a + b*log(c*x^n)))/x) + (ℯ^(-1/(4*b^2*d^2*n^2) + a/(b*n))*(c*x^n)^n^(-1)*erfi((2*a*b*d^2 - n^(-1) + 2*b^2*d^2*log(c*x^n))/(2*b*d)))/x]
    @test_int [erfi(d*(a + b*log(c*x^n)))/x^3, x, 5, -erfi(d*(a + b*log(c*x^n)))/(2*x^2) + ((c*x^n)^(2/n)*erfi((a*b*d^2 - n^(-1) + b^2*d^2*log(c*x^n))/(b*d)))/(2*ℯ^((1 - 2*a*b*d^2*n)/(b^2*d^2*n^2))*x^2)]

    @test_int [(e*x)^m*erfi(d*(a + b*log(c*x^n))), x, 5, ((e*x)^(1 + m)*erfi(d*(a + b*log(c*x^n))))/(e*(1 + m)) - (x*(e*x)^m*erfi((1 + m + 2*a*b*d^2*n + 2*b^2*d^2*n*log(c*x^n))/(2*b*d*n)))/(ℯ^(((1 + m)*(1 + m + 4*a*b*d^2*n))/(4*b^2*d^2*n^2))*(1 + m)*(c*x^n)^((1 + m)/n))]

    #= ::Section::Closed:: =#
    #=Integrands*of*the*form*(e*x)^m*ℯ^(c+d*x^2)*erfi(a+b*x)^n=#

    #= ::Subsection::Closed:: =#
    #=Integrands*of*the*form*ℯ^(c+b^2*x^2)*erfi(b*x)^n=#

    @test_int [ℯ^(c + b^2*x^2)*erfi(b*x)^2, x, 2, (ℯ^c*sqrt(pi)*erfi(b*x)^3)/(6*b)]
    @test_int [ℯ^(c + b^2*x^2)*erfi(b*x)^1, x, 2, (ℯ^c*sqrt(pi)*erfi(b*x)^2)/(4*b)]
    @test_int [ℯ^(c + b^2*x^2)/erfi(b*x)^1, x, 2, (ℯ^c*sqrt(pi)*log(erfi(b*x)))/(2*b)]
    @test_int [ℯ^(c + b^2*x^2)/erfi(b*x)^2, x, 2, -((ℯ^c*sqrt(pi))/(2*b*erfi(b*x)))]
    @test_int [ℯ^(c + b^2*x^2)/erfi(b*x)^3, x, 2, -((ℯ^c*sqrt(pi))/(4*b*erfi(b*x)^2))]

    @test_int [ℯ^(c + b^2*x^2)*erfi(b*x)^n, x, 2, (ℯ^c*sqrt(pi)*erfi(b*x)^(1 + n))/(2*b*(1 + n))]

    #= ::Subsection::Closed:: =#
    #=Integrands*of*the*form*x^m*ℯ^(c+d*x^2)*erfi(b*x)=#

    @test_int [ℯ^(c + d*x^2)*x^5*erfi(b*x), x, 9, (3*b*ℯ^(c + (b^2 + d)*x^2)*x)/(4*d*(b^2 + d)^2*sqrt(pi)) + (b*ℯ^(c + (b^2 + d)*x^2)*x)/(d^2*(b^2 + d)*sqrt(pi)) - (b*ℯ^(c + (b^2 + d)*x^2)*x^3)/(2*d*(b^2 + d)*sqrt(pi)) + (ℯ^(c + d*x^2)*erfi(b*x))/d^3 - (ℯ^(c + d*x^2)*x^2*erfi(b*x))/d^2 + (ℯ^(c + d*x^2)*x^4*erfi(b*x))/(2*d) - (3*b*ℯ^c*erfi(sqrt(b^2 + d)*x))/(8*d*(b^2 + d)^(5/2)) - (b*ℯ^c*erfi(sqrt(b^2 + d)*x))/(2*d^2*(b^2 + d)^(3/2)) - (b*ℯ^c*erfi(sqrt(b^2 + d)*x))/(d^3*sqrt(b^2 + d))]
    @test_int [ℯ^(c + d*x^2)*x^3*erfi(b*x), x, 5, -(b*ℯ^(c + (b^2 + d)*x^2)*x)/(2*d*(b^2 + d)*sqrt(pi)) - (ℯ^(c + d*x^2)*erfi(b*x))/(2*d^2) + (ℯ^(c + d*x^2)*x^2*erfi(b*x))/(2*d) + (b*ℯ^c*erfi(sqrt(b^2 + d)*x))/(4*d*(b^2 + d)^(3/2)) + (b*ℯ^c*erfi(sqrt(b^2 + d)*x))/(2*d^2*sqrt(b^2 + d))]
    @test_int [ℯ^(c + d*x^2)*x^1*erfi(b*x), x, 2, (ℯ^(c + d*x^2)*erfi(b*x))/(2*d) - (b*ℯ^c*erfi(sqrt(b^2 + d)*x))/(2*d*sqrt(b^2 + d))]
    @test_int [(ℯ^(c + d*x^2)*erfi(b*x))/x^1, x, 0, Unintegrable((ℯ^(c + d*x^2)*erfi(b*x))/x, x)]
    @test_int [(ℯ^(c + d*x^2)*erfi(b*x))/x^3, x, 3, -((b*ℯ^(c + (b^2 + d)*x^2))/(sqrt(pi)*x)) - (ℯ^(c + d*x^2)*erfi(b*x))/(2*x^2) + b*sqrt(b^2 + d)*ℯ^c*erfi(sqrt(b^2 + d)*x) + d*Unintegrable((ℯ^(c + d*x^2)*erfi(b*x))/x, x)]
    @test_int [(ℯ^(c + d*x^2)*erfi(b*x))/x^5, x, 7, -(b*ℯ^(c + (b^2 + d)*x^2))/(6*sqrt(pi)*x^3) - (b*d*ℯ^(c + (b^2 + d)*x^2))/(2*sqrt(pi)*x) - (b*(b^2 + d)*ℯ^(c + (b^2 + d)*x^2))/(3*sqrt(pi)*x) - (ℯ^(c + d*x^2)*erfi(b*x))/(4*x^4) - (d*ℯ^(c + d*x^2)*erfi(b*x))/(4*x^2) + (b*d*sqrt(b^2 + d)*ℯ^c*erfi(sqrt(b^2 + d)*x))/2 + (b*(b^2 + d)^(3/2)*ℯ^c*erfi(sqrt(b^2 + d)*x))/3 + (d^2*Unintegrable((ℯ^(c + d*x^2)*erfi(b*x))/x, x))/2]

    @test_int [ℯ^(c + d*x^2)*x^4*erfi(b*x), x, 5, (b*ℯ^(c + (b^2 + d)*x^2))/(2*d*(b^2 + d)^2*sqrt(pi)) + (3*b*ℯ^(c + (b^2 + d)*x^2))/(4*d^2*(b^2 + d)*sqrt(pi)) - (b*ℯ^(c + (b^2 + d)*x^2)*x^2)/(2*d*(b^2 + d)*sqrt(pi)) - (3*ℯ^(c + d*x^2)*x*erfi(b*x))/(4*d^2) + (ℯ^(c + d*x^2)*x^3*erfi(b*x))/(2*d) + (3*Unintegrable(ℯ^(c + d*x^2)*erfi(b*x), x))/(4*d^2)]
    @test_int [ℯ^(c + d*x^2)*x^2*erfi(b*x), x, 2, -(b*ℯ^(c + (b^2 + d)*x^2))/(2*d*(b^2 + d)*sqrt(pi)) + (ℯ^(c + d*x^2)*x*erfi(b*x))/(2*d) - Unintegrable(ℯ^(c + d*x^2)*erfi(b*x), x)/(2*d)]
    @test_int [ℯ^(c + d*x^2)*x^0*erfi(b*x), x, 0, Unintegrable(ℯ^(c + d*x^2)*erfi(b*x), x)]
    @test_int [(ℯ^(c + d*x^2)*erfi(b*x))/x^2, x, 2, -((ℯ^(c + d*x^2)*erfi(b*x))/x) + (b*ℯ^c*ExpIntegralEi((b^2 + d)*x^2))/sqrt(pi) + 2*d*Unintegrable(ℯ^(c + d*x^2)*erfi(b*x), x)]
    @test_int [(ℯ^(c + d*x^2)*erfi(b*x))/x^4, x, 5, -(b*ℯ^(c + (b^2 + d)*x^2))/(3*sqrt(pi)*x^2) - (ℯ^(c + d*x^2)*erfi(b*x))/(3*x^3) - (2*d*ℯ^(c + d*x^2)*erfi(b*x))/(3*x) + (2*b*d*ℯ^c*ExpIntegralEi((b^2 + d)*x^2))/(3*sqrt(pi)) + (b*(b^2 + d)*ℯ^c*ExpIntegralEi((b^2 + d)*x^2))/(3*sqrt(pi)) + (4*d^2*Unintegrable(ℯ^(c + d*x^2)*erfi(b*x), x))/3]

    @test_int [x^5*erfi(b*x)/ℯ^(b^2*x^2), x, 6, (2*x)/(b^5*sqrt(pi)) + (2*x^3)/(3*b^3*sqrt(pi)) + x^5/(5*b*sqrt(pi)) - erfi(b*x)/(b^6*ℯ^(b^2*x^2)) - (x^2*erfi(b*x))/(b^4*ℯ^(b^2*x^2)) - (x^4*erfi(b*x))/(2*b^2*ℯ^(b^2*x^2))]
    @test_int [x^3*erfi(b*x)/ℯ^(b^2*x^2), x, 4, x/(b^3*sqrt(pi)) + x^3/(3*b*sqrt(pi)) - erfi(b*x)/(2*b^4*ℯ^(b^2*x^2)) - (x^2*erfi(b*x))/(2*b^2*ℯ^(b^2*x^2))]
    @test_int [x^1*erfi(b*x)/ℯ^(b^2*x^2), x, 2, x/(b*sqrt(pi)) - erfi(b*x)/(2*b^2*ℯ^(b^2*x^2))]
    @test_int [erfi(b*x)/(ℯ^(b^2*x^2)*x^1), x, 1, (2*b*x*HypergeometricPFQ([1/2, 1], [3/2, 3/2], -(b^2*x^2)))/sqrt(pi)]
    @test_int [erfi(b*x)/(ℯ^(b^2*x^2)*x^3), x, 3, -(b/(sqrt(pi)*x)) - erfi(b*x)/(2*ℯ^(b^2*x^2)*x^2) - (2*b^3*x*HypergeometricPFQ([1/2, 1], [3/2, 3/2], -(b^2*x^2)))/sqrt(pi)]
    @test_int [erfi(b*x)/(ℯ^(b^2*x^2)*x^5), x, 5, -b/(6*sqrt(pi)*x^3) + b^3/(2*sqrt(pi)*x) - erfi(b*x)/(4*ℯ^(b^2*x^2)*x^4) + (b^2*erfi(b*x))/(4*ℯ^(b^2*x^2)*x^2) + (b^5*x*HypergeometricPFQ([1/2, 1], [3/2, 3/2], -(b^2*x^2)))/sqrt(pi)]

    @test_int [x^6*erfi(b*x)/ℯ^(b^2*x^2), x, 7, (15*x^2)/(8*b^5*sqrt(pi)) + (5*x^4)/(8*b^3*sqrt(pi)) + x^6/(6*b*sqrt(pi)) - (15*x*erfi(b*x))/(ℯ^(b^2*x^2)*(8*b^6)) - (5*x^3*erfi(b*x))/(ℯ^(b^2*x^2)*(4*b^4)) - (x^5*erfi(b*x))/(ℯ^(b^2*x^2)*(2*b^2)) + (15*x^2*HypergeometricPFQ([1, 1], [3/2, 2], (-b^2)*x^2))/(8*b^5*sqrt(pi))]
    @test_int [x^4*erfi(b*x)/ℯ^(b^2*x^2), x, 5, (3*x^2)/(4*b^3*sqrt(pi)) + x^4/(4*b*sqrt(pi)) - (3*x*erfi(b*x))/(ℯ^(b^2*x^2)*(4*b^4)) - (x^3*erfi(b*x))/(ℯ^(b^2*x^2)*(2*b^2)) + (3*x^2*HypergeometricPFQ([1, 1], [3/2, 2], (-b^2)*x^2))/(4*b^3*sqrt(pi))]
    @test_int [x^2*erfi(b*x)/ℯ^(b^2*x^2), x, 3, x^2/(2*b*sqrt(pi)) - (x*erfi(b*x))/(ℯ^(b^2*x^2)*(2*b^2)) + (x^2*HypergeometricPFQ([1, 1], [3/2, 2], (-b^2)*x^2))/(2*b*sqrt(pi))]
    @test_int [x^0*erfi(b*x)/ℯ^(b^2*x^2), x, 1, (b*x^2*HypergeometricPFQ([1, 1], [3/2, 2], (-b^2)*x^2))/sqrt(pi)]
    @test_int [erfi(b*x)/(ℯ^(b^2*x^2)*x^2), x, 3, -(erfi(b*x)/(ℯ^(b^2*x^2)*x)) - (2*b^3*x^2*HypergeometricPFQ([1, 1], [3/2, 2], (-b^2)*x^2))/sqrt(pi) + (2*b*log(x))/sqrt(pi)]
    @test_int [erfi(b*x)/(ℯ^(b^2*x^2)*x^4), x, 5, -(b/(3*sqrt(pi)*x^2)) - erfi(b*x)/(ℯ^(b^2*x^2)*(3*x^3)) + (2*b^2*erfi(b*x))/(ℯ^(b^2*x^2)*(3*x)) + (4*b^5*x^2*HypergeometricPFQ([1, 1], [3/2, 2], (-b^2)*x^2))/(3*sqrt(pi)) - (4*b^3*log(x))/(3*sqrt(pi))]
    @test_int [erfi(b*x)/(ℯ^(b^2*x^2)*x^6), x, 7, -(b/(10*sqrt(pi)*x^4)) + (2*b^3)/(15*sqrt(pi)*x^2) - erfi(b*x)/(ℯ^(b^2*x^2)*(5*x^5)) + (2*b^2*erfi(b*x))/(ℯ^(b^2*x^2)*(15*x^3)) - (4*b^4*erfi(b*x))/(ℯ^(b^2*x^2)*(15*x)) - (8*b^7*x^2*HypergeometricPFQ([1, 1], [3/2, 2], (-b^2)*x^2))/(15*sqrt(pi)) + (8*b^5*log(x))/(15*sqrt(pi))]

    @test_int [ℯ^(c + b^2*x^2)*x^5*erfi(b*x), x, 9, (11*ℯ^(c + 2*b^2*x^2)*x)/(16*b^5*sqrt(pi)) - (ℯ^(c + 2*b^2*x^2)*x^3)/(4*b^3*sqrt(pi)) + (ℯ^(c + b^2*x^2)*erfi(b*x))/b^6 - (ℯ^(c + b^2*x^2)*x^2*erfi(b*x))/b^4 + (ℯ^(c + b^2*x^2)*x^4*erfi(b*x))/(2*b^2) - (43*ℯ^c*erfi(sqrt(2)*b*x))/(32*sqrt(2)*b^6)]
    @test_int [ℯ^(c + b^2*x^2)*x^3*erfi(b*x), x, 5, -(ℯ^(c + 2*b^2*x^2)*x)/(4*b^3*sqrt(pi)) - (ℯ^(c + b^2*x^2)*erfi(b*x))/(2*b^4) + (ℯ^(c + b^2*x^2)*x^2*erfi(b*x))/(2*b^2) + (5*ℯ^c*erfi(sqrt(2)*b*x))/(8*sqrt(2)*b^4)]
    @test_int [ℯ^(c + b^2*x^2)*x^1*erfi(b*x), x, 2, (ℯ^(c + b^2*x^2)*erfi(b*x))/(2*b^2) - (ℯ^c*erfi(sqrt(2)*b*x))/(2*sqrt(2)*b^2)]
    @test_int [(ℯ^(c + b^2*x^2)*erfi(b*x))/x^1, x, 0, Unintegrable((ℯ^(c + b^2*x^2)*erfi(b*x))/x, x)]
    @test_int [(ℯ^(c + b^2*x^2)*erfi(b*x))/x^3, x, 3, -((b*ℯ^(c + 2*b^2*x^2))/(sqrt(pi)*x)) - (ℯ^(c + b^2*x^2)*erfi(b*x))/(2*x^2) + sqrt(2)*b^2*ℯ^c*erfi(sqrt(2)*b*x) + b^2*Unintegrable((ℯ^(c + b^2*x^2)*erfi(b*x))/x, x)]
    @test_int [(ℯ^(c + b^2*x^2)*erfi(b*x))/x^5, x, 7, -(b*ℯ^(c + 2*b^2*x^2))/(6*sqrt(pi)*x^3) - (7*b^3*ℯ^(c + 2*b^2*x^2))/(6*sqrt(pi)*x) - (ℯ^(c + b^2*x^2)*erfi(b*x))/(4*x^4) - (b^2*ℯ^(c + b^2*x^2)*erfi(b*x))/(4*x^2) + (b^4*ℯ^c*erfi(sqrt(2)*b*x))/sqrt(2) + (2*sqrt(2)*b^4*ℯ^c*erfi(sqrt(2)*b*x))/3 + (b^4*Unintegrable((ℯ^(c + b^2*x^2)*erfi(b*x))/x, x))/2]

    @test_int [ℯ^(c + b^2*x^2)*x^4*erfi(b*x), x, 7, ℯ^(c + 2*b^2*x^2)/(2*b^5*sqrt(pi)) - (ℯ^(c + 2*b^2*x^2)*x^2)/(4*b^3*sqrt(pi)) - (3*ℯ^(c + b^2*x^2)*x*erfi(b*x))/(4*b^4) + (ℯ^(c + b^2*x^2)*x^3*erfi(b*x))/(2*b^2) + (3*ℯ^c*sqrt(pi)*erfi(b*x)^2)/(16*b^5)]
    @test_int [ℯ^(c + b^2*x^2)*x^2*erfi(b*x), x, 4, -ℯ^(c + 2*b^2*x^2)/(4*b^3*sqrt(pi)) + (ℯ^(c + b^2*x^2)*x*erfi(b*x))/(2*b^2) - (ℯ^c*sqrt(pi)*erfi(b*x)^2)/(8*b^3)]
    @test_int [ℯ^(c + b^2*x^2)*x^0*erfi(b*x), x, 2, (ℯ^c*sqrt(pi)*erfi(b*x)^2)/(4*b)]
    @test_int [(ℯ^(c + b^2*x^2)*erfi(b*x))/x^2, x, 4, -((ℯ^(c + b^2*x^2)*erfi(b*x))/x) + (b*ℯ^c*sqrt(pi)*erfi(b*x)^2)/2 + (b*ℯ^c*ExpIntegralEi(2*b^2*x^2))/sqrt(pi)]
    @test_int [(ℯ^(c + b^2*x^2)*erfi(b*x))/x^4, x, 7, -(b*ℯ^(c + 2*b^2*x^2))/(3*sqrt(pi)*x^2) - (ℯ^(c + b^2*x^2)*erfi(b*x))/(3*x^3) - (2*b^2*ℯ^(c + b^2*x^2)*erfi(b*x))/(3*x) + (b^3*ℯ^c*sqrt(pi)*erfi(b*x)^2)/3 + (4*b^3*ℯ^c*ExpIntegralEi(2*b^2*x^2))/(3*sqrt(pi))]

    #= ::Subsection::Closed:: =#
    #=Integrands*of*the*form*x^m*ℯ^(c+d*x^2)*erfi(a+b*x)=#

    @test_int [ℯ^(c + d*x^2)*x^3*erfi(a + b*x), x, 10, (a*b^2*ℯ^(a^2 + c + 2*a*b*x + (b^2 + d)*x^2))/(2*d*(b^2 + d)^2*sqrt(pi)) - (b*ℯ^(a^2 + c + 2*a*b*x + (b^2 + d)*x^2)*x)/(2*d*(b^2 + d)*sqrt(pi)) - (ℯ^(c + d*x^2)*erfi(a + b*x))/(2*d^2) + (ℯ^(c + d*x^2)*x^2*erfi(a + b*x))/(2*d) - (a^2*b^3*ℯ^(c + (a^2*d)/(b^2 + d))*erfi((a*b + (b^2 + d)*x)/sqrt(b^2 + d)))/(2*d*(b^2 + d)^(5/2)) + (b*ℯ^(c + (a^2*d)/(b^2 + d))*erfi((a*b + (b^2 + d)*x)/sqrt(b^2 + d)))/(4*d*(b^2 + d)^(3/2)) + (b*ℯ^(c + (a^2*d)/(b^2 + d))*erfi((a*b + (b^2 + d)*x)/sqrt(b^2 + d)))/(2*d^2*sqrt(b^2 + d))]
    @test_int [ℯ^(c + d*x^2)*x^1*erfi(a + b*x), x, 3, (ℯ^(c + d*x^2)*erfi(a + b*x))/(2*d) - (b*ℯ^(c + (a^2*d)/(b^2 + d))*erfi((a*b + (b^2 + d)*x)/sqrt(b^2 + d)))/(2*d*sqrt(b^2 + d))]
    @test_int [ℯ^(c + d*x^2)*erfi(a + b*x)/x^1, x, 0, Unintegrable((ℯ^(c + d*x^2)*erfi(a + b*x))/x, x)]
    @test_int [ℯ^(c + d*x^2)*erfi(a + b*x)/x^3, x, 4, -((b*ℯ^(a^2 + c + 2*a*b*x + (b^2 + d)*x^2))/(sqrt(pi)*x)) - (ℯ^(c + d*x^2)*erfi(a + b*x))/(2*x^2) + b*sqrt(b^2 + d)*ℯ^(c + (a^2*d)/(b^2 + d))*erfi((a*b + (b^2 + d)*x)/sqrt(b^2 + d)) + (2*a*b^2*Unintegrable(ℯ^(a^2 + c + 2*a*b*x + (b^2 + d)*x^2)/x, x))/sqrt(pi) + d*Unintegrable((ℯ^(c + d*x^2)*erfi(a + b*x))/x, x)]

    @test_int [ℯ^(c + d*x^2)*x^4*erfi(a + b*x), x, 15, -(a^2*b^3*ℯ^(a^2 + c + 2*a*b*x + (b^2 + d)*x^2))/(2*d*(b^2 + d)^3*sqrt(pi)) + (b*ℯ^(a^2 + c + 2*a*b*x + (b^2 + d)*x^2))/(2*d*(b^2 + d)^2*sqrt(pi)) + (3*b*ℯ^(a^2 + c + 2*a*b*x + (b^2 + d)*x^2))/(4*d^2*(b^2 + d)*sqrt(pi)) + (a*b^2*ℯ^(a^2 + c + 2*a*b*x + (b^2 + d)*x^2)*x)/(2*d*(b^2 + d)^2*sqrt(pi)) - (b*ℯ^(a^2 + c + 2*a*b*x + (b^2 + d)*x^2)*x^2)/(2*d*(b^2 + d)*sqrt(pi)) - (3*ℯ^(c + d*x^2)*x*erfi(a + b*x))/(4*d^2) + (ℯ^(c + d*x^2)*x^3*erfi(a + b*x))/(2*d) + (a^3*b^4*ℯ^(c + (a^2*d)/(b^2 + d))*erfi((a*b + (b^2 + d)*x)/sqrt(b^2 + d)))/(2*d*(b^2 + d)^(7/2)) - (3*a*b^2*ℯ^(c + (a^2*d)/(b^2 + d))*erfi((a*b + (b^2 + d)*x)/sqrt(b^2 + d)))/(4*d*(b^2 + d)^(5/2)) - (3*a*b^2*ℯ^(c + (a^2*d)/(b^2 + d))*erfi((a*b + (b^2 + d)*x)/sqrt(b^2 + d)))/(4*d^2*(b^2 + d)^(3/2)) + (3*Unintegrable(ℯ^(c + d*x^2)*erfi(a + b*x), x))/(4*d^2)]
    @test_int [ℯ^(c + d*x^2)*x^2*erfi(a + b*x), x, 4, -(b*ℯ^(a^2 + c + 2*a*b*x + (b^2 + d)*x^2))/(2*d*(b^2 + d)*sqrt(pi)) + (ℯ^(c + d*x^2)*x*erfi(a + b*x))/(2*d) + (a*b^2*ℯ^(c + (a^2*d)/(b^2 + d))*erfi((a*b + (b^2 + d)*x)/sqrt(b^2 + d)))/(2*d*(b^2 + d)^(3/2)) - Unintegrable(ℯ^(c + d*x^2)*erfi(a + b*x), x)/(2*d)]
    @test_int [ℯ^(c + d*x^2)*x^0*erfi(a + b*x), x, 0, Unintegrable(ℯ^(c + d*x^2)*erfi(a + b*x), x)]
    @test_int [ℯ^(c + d*x^2)*erfi(a + b*x)/x^2, x, 1, -((ℯ^(c + d*x^2)*erfi(a + b*x))/x) + (2*b*Unintegrable(ℯ^(a^2 + c + 2*a*b*x + (b^2 + d)*x^2)/x, x))/sqrt(pi) + 2*d*Unintegrable(ℯ^(c + d*x^2)*erfi(a + b*x), x)]
    @test_int [ℯ^(c + d*x^2)*erfi(a + b*x)/x^4, x, 6, -(b*ℯ^(a^2 + c + 2*a*b*x + (b^2 + d)*x^2))/(3*sqrt(pi)*x^2) - (2*a*b^2*ℯ^(a^2 + c + 2*a*b*x + (b^2 + d)*x^2))/(3*sqrt(pi)*x) - (ℯ^(c + d*x^2)*erfi(a + b*x))/(3*x^3) - (2*d*ℯ^(c + d*x^2)*erfi(a + b*x))/(3*x) + (2*a*b^2*sqrt(b^2 + d)*ℯ^(c + (a^2*d)/(b^2 + d))*erfi((a*b + (b^2 + d)*x)/sqrt(b^2 + d)))/3 + (4*a^2*b^3*Unintegrable(ℯ^(a^2 + c + 2*a*b*x + (b^2 + d)*x^2)/x, x))/(3*sqrt(pi)) + (4*b*d*Unintegrable(ℯ^(a^2 + c + 2*a*b*x + (b^2 + d)*x^2)/x, x))/(3*sqrt(pi)) + (2*b*(b^2 + d)*Unintegrable(ℯ^(a^2 + c + 2*a*b*x + (b^2 + d)*x^2)/x, x))/(3*sqrt(pi)) + (4*d^2*Unintegrable(ℯ^(c + d*x^2)*erfi(a + b*x), x))/3]

    @test_int [erfi(b*x)/(ℯ^(b^2*x^2)*x^3) + (b^2*erfi(b*x))/(ℯ^(b^2*x^2)*x), x, 5, -(b/(sqrt(pi)*x)) - erfi(b*x)/(2*ℯ^(b^2*x^2)*x^2)]

    #= ::Section::Closed:: =#
    #=Integrands*of*the*form*(e*x)^m*Trig(c+d*x^2)*erfi(a+b*x)^n=#

    @test_int [sin(c + im*b^2*x^2)*erfi(b*x), x, 4, (im*sqrt(pi)*erfi(b*x)^2)/(ℯ^(im*c)*(8*b)) - (im*b*ℯ^(im*c)*x^2*HypergeometricPFQ([1, 1], [3/2, 2], (-b^2)*x^2))/(2*sqrt(pi))]
    @test_int [sin(c - im*b^2*x^2)*erfi(b*x), x, 4, -((im*ℯ^(im*c)*sqrt(pi)*erfi(b*x)^2)/(8*b)) + (im*b*x^2*HypergeometricPFQ([1, 1], [3/2, 2], (-b^2)*x^2))/(ℯ^(im*c)*(2*sqrt(pi)))]

    @test_int [cos(c + im*b^2*x^2)*erfi(b*x), x, 4, (sqrt(pi)*erfi(b*x)^2)/(ℯ^(im*c)*(8*b)) + (b*ℯ^(im*c)*x^2*HypergeometricPFQ([1, 1], [3/2, 2], (-b^2)*x^2))/(2*sqrt(pi))]
    @test_int [cos(c - im*b^2*x^2)*erfi(b*x), x, 4, (ℯ^(im*c)*sqrt(pi)*erfi(b*x)^2)/(8*b) + (b*x^2*HypergeometricPFQ([1, 1], [3/2, 2], (-b^2)*x^2))/(ℯ^(im*c)*(2*sqrt(pi)))]

    @test_int [sinh(c + b^2*x^2)*erfi(b*x), x, 4, (ℯ^c*sqrt(pi)*erfi(b*x)^2)/(8*b) - (b*x^2*HypergeometricPFQ([1, 1], [3/2, 2], (-b^2)*x^2))/(ℯ^c*(2*sqrt(pi)))]
    @test_int [sinh(c - b^2*x^2)*erfi(b*x), x, 4, -((sqrt(pi)*erfi(b*x)^2)/(ℯ^c*(8*b))) + (b*ℯ^c*x^2*HypergeometricPFQ([1, 1], [3/2, 2], (-b^2)*x^2))/(2*sqrt(pi))]

    @test_int [cosh(c + b^2*x^2)*erfi(b*x), x, 4, (ℯ^c*sqrt(pi)*erfi(b*x)^2)/(8*b) + (b*x^2*HypergeometricPFQ([1, 1], [3/2, 2], (-b^2)*x^2))/(ℯ^c*(2*sqrt(pi)))]
    @test_int [cosh(c - b^2*x^2)*erfi(b*x), x, 4, (sqrt(pi)*erfi(b*x)^2)/(ℯ^c*(8*b)) + (b*ℯ^c*x^2*HypergeometricPFQ([1, 1], [3/2, 2], (-b^2)*x^2))/(2*sqrt(pi))]
    end

max_stars_repo_path: test/8 Special functions/8.1 Error functions.jl


text:
export AbstractVariable, degree
export is_clamped, is_marginalisation, is_moment_matching
export FoldLeftProdStrategy, FoldRightProdStrategy, CustomProdStrategy
export getmarginal, getmarginals, setmarginal!, setmarginals!, name, as_variable

using Rocket

abstract type AbstractVariable end

## Messages to Marginal product strategies

struct FoldLeftProdStrategy end
struct FoldRightProdStrategy end

struct CustomProdStrategy{F}
    prod_callback_generator :: F
end

"""
    messages_prod_fn(strategy, prod_constraint, form_constraint, form_check_strategy)

Returns a suitable prod computation function for a given strategy and constraints

See also: [`FoldLeftProdStrategy`](@ref), [`FoldRightProdStrategy`](@ref), [`CustomProdStrategy`](@ref)
"""
function messages_prod_fn end

messages_prod_fn(::FoldLeftProdStrategy, prod_constraint, form_constraint, form_check_strategy)       = prod_foldl_reduce(prod_constraint, form_constraint, form_check_strategy)
messages_prod_fn(::FoldRightProdStrategy, prod_constraint, form_constraint, form_check_strategy)      = prod_foldr_reduce(prod_constraint, form_constraint, form_check_strategy)
messages_prod_fn(strategy::CustomProdStrategy, prod_constraint, form_constraint, form_check_strategy) = strategy.prod_callback_generator(prod_constraint, form_constraint, form_check_strategy)

function marginal_prod_fn(strategy, prod_constraint, form_constraint, form_check_strategy)
    return let prod_fn = messages_prod_fn(strategy, prod_constraint, form_constraint, form_check_strategy)
        return (messages) -> as_marginal(prod_fn(messages))
    end
end

## Common functions

function degree end

add_pipeline_stage!(variable::AbstractVariable, stage) = error("Its not possible to add a new pipeline stage for $(variable)")

# Helper functions
# Getters

getmarginal(variable::AbstractVariable) = getmarginal(variable, SkipInitial())

function getmarginal(variable::AbstractVariable, skip_strategy::MarginalSkipStrategy)
    vmarginal = _getmarginal(variable)
    if vmarginal === nothing
        vmarginal = as_marginal_observable(_makemarginal(variable))
        _setmarginal!(variable, vmarginal)
    end
    return as_marginal_observable(vmarginal, skip_strategy)
end

getmarginals(variables::AbstractArray{ <: AbstractVariable })                                      = getmarginals(variables, SkipInitial())
getmarginals(variables::AbstractArray{ <: AbstractVariable }, skip_strategy::MarginalSkipStrategy) = collectLatest(map(v -> getmarginal(v, skip_strategy), variables))

# Setters

function setmarginal!(variable::AbstractVariable, marginal)
    setmarginal!(getmarginal(variable, IncludeAll()), marginal)
end

setmarginals!(variables::AbstractArray{ <: AbstractVariable }, marginal::Distribution)    = _setmarginals!(Base.HasLength(), variables, Iterators.repeated(marginal, length(variables)))
setmarginals!(variables::AbstractArray{ <: AbstractVariable }, marginals)                 = _setmarginals!(Base.IteratorSize(marginals), variables, marginals)

function _setmarginals!(::Base.IteratorSize, variables::AbstractArray{ <: AbstractVariable }, marginals)
    foreach(zip(variables, marginals)) do (variable, marginal)
        setmarginal!(getmarginal(variable, IncludeAll()), marginal)
    end
end

function _setmarginals!(::Any, variables::AbstractArray{ <: AbstractVariable }, marginals)
    error("setmarginals!() failed. Default value is neither an iterable object nor a distribution.")
end

function name(variable::AbstractVariable)
    return variable.name
end

## Helper functions

as_variable(x)                   = constvar(gensym(:as_var), x)
as_variable(v::AbstractVariable) = v
as_variable(t::Tuple)            = map(as_variable, t)

ext: jl


text:
function CorpusARI(state::State,model::Model,corpus::LdaCorpus)
  #for synthetic data, turn our mixed membership document vectors into max likelihood assignments
  # and check ARI between the ground truth and the state

  learned_max_clust = map(i->i[1], findmax(getTopicDist(state,model),dims=1)[2])
  true_max_clust = map(i->i[1], findmax(CorpusTopics(corpus),dims=1)[2])
  randindex(learned_max_clust,true_max_clust)
end

function DocsARI(state::State,corpus::LdaCorpus)
  #for synthetic data, find the topic ARI across [all terms in] all documents in the corpus
  learned_clust = AllTopics(state)
  true_clust = AllTopics(corpus)
  randindex(learned_clust,true_clust)
end


text:
using Compat.Test
using Compat.InteractiveUtils
using Rematch
import Rematch: MatchFailure

if VERSION < v"0.7.0-DEV"
    AbstractRange = Range
end

assertion_error = (VERSION >= v"0.7.0-DEV") ? LoadError : AssertionError

# Note we use `@eval` to allow defining a struct within a @testset
# (https://github.com/JuliaLang/julia/issues/23794)

@testset "Basic Matching" begin
    @eval struct Foo
        x
        y
    end

    # test basic match
    let x = nothing
        @test (@match Foo(x,2) = Foo(1,2)) == Foo(1,2)
        @test x == 1
    end

    # variables not bound if match fails
    let x = nothing
        @test_throws MatchFailure @match Foo(x, 3) = Foo(1,2)
        @test x == nothing
    end

    # doesn't overwrite variables in outer scope
    let x = nothing
        @test (@match Foo(1,2) begin
            Foo(x,2) => x
        end) == 1
        @test x == nothing
    end

    # variables not bound if guard fails
    let x = nothing
        @test_throws MatchFailure @match Foo(1,2) begin
          Foo(x, 2) where x != 1 => :ok
        end
        @test x == nothing
    end
end

@testset "Match Struct by field names" begin
    # match one struct field by name
    let x = nothing
        x1 = nothing
        @test (@match Foo(1,2) begin
               Foo(x=x1) => x1
        end) == 1
        @test x == nothing
        @test x1 == nothing
    end

    # match struct with mix of by-value and by-field name
    let x1 = nothing
        @test (@match Foo(1,2) begin
               Foo(0,2) => nothing
               Foo(x=x1) => x1
        end) == 1
    end

    # match multiple struct fields by name
    let x1 = nothing, y1 = nothing
        @test (@match Foo(1,2) begin
               Foo(x=x1,y=y1) => (x1,y1)
        end) == (1,2)
    end

    # match struct field by name redundantly
    let x1 = nothing, x2 = nothing
        @test_throws assertion_error @eval (@match Foo(1,2) begin
               Foo(x=x1,x=x2) => (x1,x2)
        end)
    end

    # variables in patterns are local, and can match multiple positions
    let z = 0
        @test z == 0
        @test (@match Foo(1,1) begin
               Foo(x=z, y=z) => z # inner z matches both x and y
               end) == 1
        @test z == 0 # no change to outer z
    end

    # variable in a pattern can match multiple positions
    @test_throws MatchFailure @eval (@match Foo(1,2) begin
                                     Foo(x=x1, y=x1) => true
                                     end)
end

@testset "non-struct Matches" begin
    # throw MatchFailure if no matches
    @test_throws MatchFailure @match :this begin
        :that => :ok
    end

    # match against symbols
    @test (@match :this begin
        :this => :ok
    end) == :ok

    # treat macros as constants
    @test (@match v"1.2.0" begin
      v"1.2.0" => :ok
    end) == :ok

    # QuoteNodes
    @test (@match :(:x) begin
      :(:x) => :ok
    end) == :ok
    @test (@match :(:x+:y) begin
      :(:x + :y) => :ok
    end) == :ok
end

@testset "logical expressions with branches" begin
    # disjunction
    @test (@match (1,(2,3)) begin
      (1, (x,:nope) || (2,x)) => x
    end) == 3

    # disjunction and repeated variables
    @test (@match (1,(2,3), 3) begin
      (1, (x,:nope) || (2,x), x) => x
    end) == 3
    @test (@match (1,(2,3), 4) begin
      (1, (x,:nope) || (2,x), x) => x
      _ => :ok
    end) == :ok
    @test (@match (3,(2,3), 3) begin
      (x, (x,:nope) || (2,x), 3) => x
    end) == 3
    @test (@match (1,(2,3), 3) begin
      (x, (x,:nope) || (2,x), 3) => x
      _ => :ok
    end) == :ok
    @test (@match (3,(2,3), 3) begin
      (x, (x,:nope) || (2,x), x) => x
    end) == 3
    @test (@match (3,(2,3), 1) begin
      (x, (x,:nope) || (2,x), x) => x
      _ => :ok
    end) == :ok

    # conjunction
    @test (@match (1,(2,3)) begin
        (1, a && (2,b)) => (a,b)
    end) == ((2,3),3)
    @test_throws MatchFailure (@match (1,(2,3)) begin
        (1, a && (1,b)) => (a,b)
    end) == ((2,3),3)

    # only vars that exist in all branches can be accessed
    @test_throws UndefVarError @eval @match (1,(2,3)) begin
      (1, (x,:nope) || (2,y)) => y
    end
end

@testset "Splats" begin
    # splats
    test0(x) = @match x begin
        [a] => [a]
        [a,b,c...] => [a,b,c]
        (a,) => (a,)
        (a...,b,c,d) => (a,b,c,d)
        (a,b...,c) => (a,b,c)
    end
    @test test0([1]) == [1]
    @test test0([1,2]) == [1,2,[]]
    @test test0([1,2,3]) == [1,2,[3]]
    @test test0([1,2,3,4]) == [1,2,[3,4]]
    @test test0((1,)) == (1,)
    @test test0((1,2)) == (1, (), 2)
    @test test0((1,2,3)) == ((), 1, 2, 3)
    @test test0((1,2,3,4)) == ((1,), 2, 3, 4)
    @test test0((1,2,3,4,5)) == ((1,2), 3, 4, 5)

    # no splats allowed in structs (would be nice, but need to implement getfield(struct, range))
    @test_throws assertion_error @eval @match foo begin
        Foo(x...) => :nope
    end

    # at most one splat in tuples/arrays
    @test_throws assertion_error @eval @match [1,2,3] begin
        [a...,b,c...] => :nope
    end
    @test_throws assertion_error @eval @match [1,2,3] begin
        (a...,b,c...) => :nope
    end

    # inference for splats
    infer1(x) = @match x begin
        (a, b..., c) => a
    end
    @test @code_typed(infer1((:ok,2,3,4)))[2] == Symbol
    infer2(x) = @match x begin
        (a, b..., c) => c
    end

    if VERSION >= v"0.7.0-DEV"
        @test @code_typed(infer2((1,2,3,:ok)))[2] == Symbol
    else
        # can't infer x[4-0] - fixed in Julia 0.7
        @test_broken @code_typed(infer2((1,2,3,:ok)))[2] == Symbol
    end
end

@testset "Inference in branches" begin
    # inference in branches
    infer3(foo) = @match foo begin
        Foo(_,y::Symbol) => y
        Foo(x::Symbol,_) => x
    end
    @test @code_typed(infer3(Foo(1,2)))[2] == Symbol
    infer4(foo) = @match foo begin
        Foo(x,y::Symbol) => y
        Foo(x::Symbol,y) => x
    end
    # TODO should we `let` in branches rather than exporting variables?
    @test_broken @code_typed(infer4(Foo(1,2)))[2] == Symbol
end

@testset "Nested Guards" begin
    # nested guards can use earlier bindings
    @test (@match [1,2] begin
      [x, y where y > x] => (x,y)
    end) == (1,2)
    @test_throws MatchFailure @match [2,1] begin
      [x, y where y > x] => (x,y)
    end

    # nested guards can't use later bindings
    @test_throws UndefVarError @eval @match [2,1] begin
      [x where y > x, y ] => (x,y)
    end
end

@testset "structs matching all fields" begin
    # detect incorrect numbers of fields
    @test_throws ErrorException @match Foo(x) = Foo(1,2)
    @test_throws ErrorException @match Foo(x,y,z) = Foo(1,2)

    # ...even if the pattern is not reached
    @test_throws ErrorException (@match Foo(1,2) begin
        Foo(x,y) => :ok
        Foo(x) => :nope
    end)
end

@testset "Miscellanea" begin
    # match against fiddly symbols (https://github.com/kmsquire/Match.jl/issues/32)
    if VERSION >= v"0.7.0-DEV"
        @test (@match :(@when a < b) begin
               Expr(_, [Symbol("@when"), _, _]) => :ok
               Expr(_, [other, _, _]) => other
               end) == :ok
    else
        @test (@match :(@when a < b) begin
               Expr(_, [Symbol("@when"), _], _) => :ok
               Expr(_, [other, _], _) => other
               end) == :ok
    end

    # test repeated variables (https://github.com/kmsquire/Match.jl/issues/27)
    @test (@match (x,x) = (1,1)) == (1,1)
    @test_throws MatchFailure @match (x,x) = (1,2)

    # match against single tuples (https://github.com/kmsquire/Match.jl/issues/43)
    @test (@match (:x,) begin
      (:x,) => :ok
    end) == :ok

    # match against empty structs (https://github.com/kmsquire/Match.jl/issues/43)
    @eval struct True end
    e = (True(), 1)
    @test (@match e begin
        (True(), x) => x
    end) == 1

    # symbols are not interpreted as variables (https://github.com/kmsquire/Match.jl/issues/45)
    let x = 42
        @test (@match (:x,) begin
          (:x,) => x
        end) == 42
    end

    # allow & and | for conjunction/disjunction (https://github.com/RelationalAI-oss/Rematch.jl/issues/1)
    @test (@match (1,(2,3)) begin
      (1, (x,:nope) | (2,x)) => x
    end) == 3
    @test (@match (1,(2,3)) begin
        (1, a & (2,b)) => (a,b)
    end) == ((2,3),3)

    # don't treat infix operators like structs
    @test_throws assertion_error @eval @match a + b = x
end

@testset "Interpolated Values" begin
    # match against interpolated values
    let outer = 2, b = nothing, c = nothing
        @test (@match [1, $outer] = [1,2]) == [1,2]
        @test (@match (1, $outer, b..., c) = (1,2,3,4,5)) == (1,2,3,4,5)
        @test b == (3,4)
        @test c == 5
    end
    test_interp_pattern = let a=1, b=2, c=3,
                              arr=[10,20,30], tup=(100,200,300)
        _t(x) = @match x begin
            # scalars
            [$a,$b,$c,out] => out
            [fronts..., $a,$b,$c, back] => [fronts...,back]
            # arrays & tuples
            [fronts..., $arr, back] => [fronts...,back]
            [fronts..., $tup, back] => [fronts...,back]
            # complex expressions
            [$(a+b+c), out] => out
            # splatting existing values
            [fronts..., $(arr...), back] => [fronts...,back]
        end
    end
    # scalars
    @test test_interp_pattern([1,2,3,4]) == 4
    @test test_interp_pattern([4,3,2,1, 1,2,3, 4]) == [4,3,2,1,4]
    # arrays & tuples
    @test test_interp_pattern([0,1, [10,20,30], 2]) == [0,1,2]
    @test test_interp_pattern([0,1, (100,200,300), 2]) == [0,1,2]
    # complex expressions
    @test test_interp_pattern([6,1]) == 1
    # TODO: splatting existing values into pattern isn't suported yet.
    @test_broken test_interp_pattern([0,1, 10,20,30, 2]) == [0,1,2]
end

# --- tests from Match.jl ---

@testset "Tests imported from Match.jl" begin

    # Type matching
    test1(item) = @match item begin
        n::Int                       => "Integers are awesome!"
        str::AbstractString          => "Strings are the best"
        m::Dict{Int,AbstractString}  => "Ints for Strings?"
        d::Dict                      => "A Dict! Looking up a word?"
        _                            => "Something unexpected"
    end

    d = Dict{Int,AbstractString}(1 => "a", 2 => "b")

    @test test1(66)     == "Integers are awesome!"
    @test test1("abc")  == "Strings are the best"
    @test test1(d)      == "Ints for Strings?"
    @test test1(Dict()) == "A Dict! Looking up a word?"
    @test test1(2.0)    == "Something unexpected"

    @eval struct Address
        street::AbstractString
        city::AbstractString
        zip::AbstractString
    end

    @eval struct Person
        firstname::AbstractString
        lastname::AbstractString
        address::Address
    end

    test2(person) = @match person begin
        Person("Julia", lastname,  _) => "Found Julia $lastname"
        Person(firstname, "Julia", _) => "$firstname Julia was here!"
        Person(firstname, lastname, Address(_, "Cambridge", zip)) => "$firstname $lastname lives in zip $zip"
        _::Person  => "Unknown person!"
    end

    @test test2(Person("Julia", "Robinson", Address("450 Serra Mall", "Stanford", "94305")))         == "Found Julia Robinson"
    @test test2(Person("Gaston", "Julia",   Address("1 rue Victor Cousin", "Paris", "75005")))       == "Gaston Julia was here!"
    @test test2(Person("Edwin", "Aldrin",   Address("350 Memorial Dr", "Cambridge", "02139")))       == "Edwin Aldrin lives in zip 02139"
    @test test2(Person("Linus", "Pauling",  Address("1200 E California Blvd", "Pasadena", "91125"))) == "Unknown person!"  # Really?

    @eval abstract type Term end

    @eval struct Var <: Term
        name::AbstractString
    end

    @eval struct Fun <: Term
        arg::AbstractString
        body::Term
    end

    @eval struct App <: Term
        f::Term
        v::Term
    end

    function test_show(io::IO, term::Term)
        @match term begin
           Var(n)    => print(io, n)
           Fun(x, b) => begin
                            print(io, "^$x.")
                            test_show(io, b)
                        end
           App(f, v) => begin
                            print(io, "(")
                            test_show(io, f)
                            print(io, " ")
                            test_show(io, v)
                            print(io, ")")
                        end
        end
    end

    function is_identity_fun(term::Term)
       @match term begin
         Fun(x, Var(y)) where x == y => true
         _ => false
       end
    end

    id = Fun("x", Var("x"))
    t = Fun("x", Fun("y", App(Var("x"), Var("y"))))

    let io = IOBuffer()
        test_show(io, id)
        @test String(take!(io)) == "^x.x"
        test_show(io, t)
        @test String(take!(io)) == "^x.^y.(x y)"
        @test is_identity_fun(id)
        @test !is_identity_fun(t)
    end

    myisodd(x::Int) = @match(x, i => i % 2 == 1)
    @test filter(myisodd, 1:10) == filter(isodd, 1:10) == [1, 3, 5, 7, 9]

    function parse_arg(arg::AbstractString, value::Any=nothing)
       @match (arg, value) begin
          ("-l",              lang) where lang != nothing => "Language set to $lang"
          ("-o" || "--optim", n::Int) where 0 < n <= 5 => "Optimization level set to $n"
          ("-o" || "--optim", n::Int)                         => "Illegal optimization level $(n)!"
          ("-h" || "--help",  nothing)                        => "Help!"
          bad                                                 => "Unknown argument: $bad"
       end
    end

    @test parse_arg("-l", "eng")  == "Language set to eng"
    @test parse_arg("-l")         == "Unknown argument: (\"-l\", nothing)"
    @test parse_arg("-o", 4)      == "Optimization level set to 4"
    @test parse_arg("--optim", 5) == "Optimization level set to 5"
    @test parse_arg("-o", 0)      == "Illegal optimization level 0!"
    @test parse_arg("-o", 1.0)    == "Unknown argument: (\"-o\", 1.0)"

    @test parse_arg("-h") == parse_arg("--help") == "Help!"

    function fizzbuzz(range::AbstractRange)
        io = IOBuffer()
        for n in range
            @match (n % 3, n % 5) begin
                (0, 0) => print(io, "fizzbuzz ")
                (0, _) => print(io, "fizz ")
                (_, 0) => print(io, "buzz ")
                (_, _) => print(io, n, ' ')
            end
        end
        String(take!(io))
    end

    @test fizzbuzz(1:15) == "1 2 fizz 4 buzz fizz 7 8 fizz buzz 11 fizz 13 14 fizzbuzz "

    @eval abstract type RBTree end

    @eval struct Leaf <: RBTree
    end

    @eval struct Red <: RBTree
        value
        left::RBTree
        right::RBTree
    end

    @eval struct Black <: RBTree
        value
        left::RBTree
        right::RBTree
    end

    function balance(tree::RBTree)
        @match tree begin
            (Black(z, Red(y, Red(x, a, b), c), d)
             || Black(z, Red(x, a, Red(y, b, c)), d)
             || Black(x, a, Red(z, Red(y, b, c), d))
             || Black(x, a, Red(y, b, Red(z, c, d)))) => Red(y, Black(x, a, b),
                                                             Black(z, c, d))
            _ => tree
        end
    end

    @test balance(Black(1, Red(2, Red(3, Leaf(), Leaf()), Leaf()), Leaf())) ==
                Red(2, Black(3, Leaf(), Leaf()),
                    Black(1, Leaf(), Leaf()))

    function num_match(n)
        @match n begin
            0      => "zero"
            1 || 2 => "one or two"
            # 3:10   => "three to ten"
            _      => "something else"
        end
    end

    @test num_match(0) == "zero"
    @test num_match(2) == "one or two"
    # @test num_match(4) == "three to ten"
    @test num_match(12) == "something else"
    @test num_match("hi") == "something else"
    @test num_match('c') == "something else"

    # Interpolation of matches in quoted expressions
    test_interp(item) = @match item begin
        [a, b] => :($a + $b)
    end
    @test test_interp([1, 2]) == :(1 + 2)
end


text:
using BTCParser
using Test

using Ripemd
using SHA
using Base58

files = readdir(".")

# use only files that are named test_*.jl and start with the newest

filter!(x -> occursin(r"^test_.*\.jl$", x), files)
sort!(files, by = x -> stat(x).mtime, rev = true)

for f in files
    include(f)
end


text:
module TypeInfer

using ..AExpr

"Perform type inference on `aex`"
function typeinfer(aex::AExpr)
  # Explore graph and built graph
  # Propagate information abour graph until convergence

end

function join end
function meet end

\squaresubsetwq

end


text:
module Brillouin

using Reexport
using Requires
using StaticArrays
# ---------------------------------------------------------------------------------------- #
const AVec = AbstractVector
const BasisLike{D} = AVec{<:SVector{D,<:Real}}
const SHOWDIGITS = 6
# ---------------------------------------------------------------------------------------- #
# defines a a module `CrystallineBravaisVendor` with a few functions that are simply copies
# of equivalent functions in Crystalline (i.e. trying to avoid a full dependence...)
include("CrystallineBravaisVendor.jl")
# ---------------------------------------------------------------------------------------- #
@enum BasisEnum CARTESIAN LATTICE

"""
    setting(x::Union{KPath, KPathInterpolant, Cell})

Return the basis setting of coordinates in `x`. The returned value is a member of the
[`BasisEnum`](@ref) enum with member values `LATTICE` (i.e. coordinates in the basis of the
lattice vectors) or `CARTESIAN` (i.e. coordinates in the Cartesian basis).
By default, methods in Brillouin will return coordinates in the `LATTICE` setting.
"""
setting(x) = x.setting[]

set_setting!(x, new_setting) = (x.setting[] = new_setting)

# ---------------------------------------------------------------------------------------- #
function latticize! end
latticize(v::AVec{<:Real}, basismatrix::AbstractMatrix{<:Real}) = basismatrix\v
latticize(v::AVec{<:Real}, basis::AVec{<:AVec{<:Real}}) = latticize(v, hcat(basis...))
latticize(x) = (setting(x) === CARTESIAN ? latticize!(deepcopy(x)) : deepcopy(x))

function cartesianize! end
cartesianize(v::AVec{<:Real}, basis::AVec{<:AVec{<:Real}}) = v'basis
cartesianize(x) = (setting(x) === LATTICE ? cartesianize!(deepcopy(x)) : deepcopy(x))

"""
    basis(x::Union{KPath, KPathInterpolant, Cell})

Return the (reciprocal or direct) lattice basis associated with `x`, in Cartesian
coordinates.

Methods in Brillouin will by default return points in the lattice basis, i.e., points are
referred to `basis(x)`. This corresponds to the `setting(x) == LATTICE`.
Coordinates may instead be referred to a Cartesian basis, corresponding to
`setting(x) == CARTESIAN` by using [`cartesianize`](@ref). The result of `basis(x)`,
however, is invariant to this and always refers to the lattice basis in Cartesian
coordinates.
"""
basis(x) = x.basis

export latticize!, latticize,
    cartesianize!, cartesianize,
    basis, setting
# ---------------------------------------------------------------------------------------- #

# MAIN FUNCTIONALITY

include("KPaths.jl")
@reexport using .KPaths

include("WignerSeitz.jl")
@reexport using .WignerSeitz

# ---------------------------------------------------------------------------------------- #

function __init__()
    # plotting extensions on GLMakie load
    @require AbstractPlotting="537997a7-5e4e-5d89-9595-2241ea00577e" begin
        include("requires/abstractplotting_wignerseitz.jl")
    end

    # plotting extensions on PlotlyJS load
    @require PlotlyJS="f0f68f2c-4968-5e81-91da-67840de0976a" begin
        include("requires/plotlyjs_wignerseitz.jl")
        include("requires/plotlyjs_kpaths.jl")
        include("requires/plotlyjs_dispersion.jl")
    end
end

# ---------------------------------------------------------------------------------------- #

end


text:
using Documenter
using Jaynes

makedocs(sitename = "Jaynes.jl",
         pages = ["Introduction" => "index.md",
                  "Traces, choices, and call sites" => "library_api/sites.md",
                  "Execution contexts" => "library_api/contexts.md",
                  "Selection interface" => "library_api/selection_interface.md",
                  "Inference" => ["Importance sampling" => "inference/is.md",
                                  "Metropolis-Hastings" => "inference/mh.md",
                                  "Hamiltonian Monte Carlo" => "inference/hmc.md",
                                  "Particle filtering" => "inference/pf.md",
                                  "Automatic differentiation variational inference" => "inference/vi.md"],
                  "Foreign model interface" => "library_api/fmi.md",
                  "Differentiable programming" => "library_api/diff_prog.md",
                 ],
         format = Documenter.HTML(prettyurls = true,
                                  assets = ["assets/favicon.ico"]),
         clean = true,
         doctest = true,
         build = "franklin/library_api"
         )


text:
function plot_image(image, spacing; perc=98, cmap="Greys", o=(0, 0),
    interp="hanning", aspect=nothing, d_scale=1.5,
    name=nothing, units="km", new_fig=true, save=nothing, a=nothing,start_grid=nothing,alpha=1,labelsize=12)
nx, nz = size(image)
dx, dz = spacing
ox, oz = o
depth = range(oz, oz + (nz - 1)*spacing[2], length=nz).^d_scale

scaled = image .* depth'
if isnothing(a)
    a = quantile(abs.(vec(scaled)), perc/100)
end
start_x = start_z = 1
if !isnothing(start_grid)
    start_x = start_grid[1]
    start_z = start_grid[2]
end
extent = [(start_x-1)*dx/1f3+ox/1f3, (start_x-1)*dx/1f3+(ox+ (nx-1)*dx)/1f3, (start_z-1)*dz/1f3+(oz+(nz-1)*dz)/1f3, (start_z-1)*dz/1f3+oz/1f3]
isnothing(aspect) && (aspect = .5 * nx/nz)

if new_fig
figure()
end
PyPlot.rc("font", family="serif"); PyPlot.rc("xtick", labelsize=labelsize); PyPlot.rc("ytick", labelsize=labelsize)
imshow(scaled', vmin=-a, vmax=a, cmap=cmap, aspect=aspect,
interpolation=interp, extent=extent,alpha=alpha)
xlabel("X [$units]", fontsize=labelsize)
ylabel("Z [$units]", fontsize=labelsize)
if !isnothing(name)
    title("$name")
end

if ~isnothing(save)
save == True ? filename=name : filename=save
savefig(filename, bbox_inches="tight", dpi=150)
end
return a
end

function plot_data(data, dt; perc=98, cmap="seismic",
    interp="hanning", aspect=nothing,
    name="shot record", units="s", new_fig=true, save=nothing, a=nothing,labelsize=12)
    nt, nrec = size(data)

if isnothing(a)
    a = quantile(abs.(vec(data)), perc/100)
end
extent = [1, nrec, (nt-1)*dt/1f3,0]
isnothing(aspect) && (aspect = 2*nrec/((nt-1)*dt/1f3))

if new_fig
figure()
end
PyPlot.rc("font", family="serif"); PyPlot.rc("xtick", labelsize=labelsize); PyPlot.rc("ytick", labelsize=labelsize)
imshow(data, vmin=-a, vmax=a, cmap=cmap, aspect=aspect,
interpolation=interp, extent=extent)
xlabel("Receiver no.", fontsize=labelsize)
ylabel("Time [$(units)]", fontsize=labelsize)
title("$name")

if ~isnothing(save)
save == True ? filename=name : filename=save
savefig(filename, bbox_inches="tight", dpi=150)
end
return a
end


text:
using WiltonInts84
using StaticArrays
using Test

#include("num_quad.jl")

if !@isdefined record
    record = false
end

v1 = SVector(4.12, 1.74, 1.8)
v2 = SVector(2.04, 3.47, -3.5)
v3 = SVector(-4.21, 3.2, 0.08)
tn = cross(v1-v2, v1-v3);
tn = tn / norm(tn)
lv = v2-v1
observationPoint = v1 + 2.84 * lv+0.0000001 * tn;
I, J = wiltonints(v1,v2,v3,observationPoint,Val{0})

using JLD2
fn = joinpath(dirname(@__FILE__),"issue1-2.jld2")

if record == true
    K, L = dblquadints1(v1, v2, v3, observationPoint, Val{0})
    K = [k for k in K]
    L = [L[d][i] for i in 1:3, d in eachindex(L)]
    jldopen(fn, "w") do file
        write(file, "K", K)
        write(file, "L", L)
    end
else
    K, L = jldopen(fn,"r") do file
        read(file, "K"),
        read(file, "L")
    end
end

for d in eachindex(K)
    @eval @test nearlyequal(I[$d], K[$d], 10e-8)
    for i in 1:3
        @eval @test nearlyequal(J[$d][$i], L[$i,$d], 10e-8)
    end
end


text:
module RocketSumOperatorTest

using Test
using Rocket

include("../test_helpers.jl")

@testset "operator: sum()" begin

    println("Testing: operator sum()")

    run_proxyshowcheck("Sum", sum())

    run_testset([
        (
            source = from(1:42) |> sum(),
            values = @ts([ 903, c ]),
            source_type = Union{Nothing, Int}
        ),
        (
            source = from(1:42) |> sum(from = 97),
            values = @ts([ 1000, c ]),
            source_type = Union{Nothing, Int}
        ),
        (
            source = completed() |> sum(),
            values = @ts([ nothing, c ])
        ),
        (
            source = faulted(1) |> sum(),
            values = @ts(e(1))
        ),
        (
            source = never() |> sum(),
            values = @ts()
        )
    ])

end

end


text:
# ---
# title: 704. Binary Search
# id: problem704
# author: Tian Jun
# date: 2020-10-31
# difficulty: Easy
# categories: Binary Search
# link: <https://leetcode.com/problems/binary-search/description/>
# hidden: true
# ---
#
# Given a **sorted** (in ascending order) integer array `nums` of `n` elements
# and a `target` value, write a function to search `target` in `nums`. If
# `target` exists, then return its index, otherwise return `-1`.
#
#
# **Example 1:**
#
#
#
#     Input: nums = [-1,0,3,5,9,12], target = 9
#     Output: 4
#     Explanation: 9 exists in nums and its index is 4
#
#
#
# **Example 2:**
#
#
#
#     Input: nums = [-1,0,3,5,9,12], target = 2
#     Output: -1
#     Explanation: 2 does not exist in nums so return -1
#
#
#
#
# **Note:**
#
#   1. You may assume that all elements in `nums` are unique.
#   2. `n` will be in the range `[1, 10000]`.
#   3. The value of each element in `nums` will be in the range `[-9999, 9999]`.
#
#
## @lc code=start
using LeetCode

## add your code here:
## @lc code=end