Integration over a discontinuity involving its derivatives (as distributions) Given a discontinuous complex function $\varphi_k$ on the real line written as
$\varphi_k(x) = \theta(-x)u_k(x) + \theta(x)v_k(x)$, where $u_k$ and $v_k$ are smooth and respectively defined on the positive and negative domain and $\theta$ is the Heaviside function, I want to calculate some integrals which are essentially a combination of (complex conjugated) $\varphi^{\star}_{k}(x)$ with its  derivative $\partial_x\varphi_k(x)$ against a test function $f \in \mathcal{C}_{c}^{\infty}(\mathbb{R})$ as
\begin{equation}
\int_{-\infty}^{\infty} \varphi^{\star}_{k'}(x)\partial_x\varphi_k(x)f(x)dx, 
\end{equation}
where $k$ and $k'$ are real, and I will later set a definite value for them.
In particular, one of the terms from the integral above is a combination which I will call L-R (left with right), and it is written like 
$$ \int_{-\infty}^{\infty} \theta(-x)u^{\star}_{k'}(x)\partial_x(\theta(x)v_k(x))f(x)dx = \langle \theta(-x)u^{\star}_{k'}(x)\partial_x(\theta(x)v_k(x)), f  \rangle .$$
If I decide to absorb the left $\theta(-x)$ into the integration limits as
$$ \int_{-\infty}^{0}u^{\star}_{k'}\partial_x(\theta(x)v_k)f(x)dx$$ and use the derivative of the Heaviside multiplied by a smooth function in the distribution sense, I got only one term left (since $\theta$(x) is being integrated outside its support. And whether we define $\theta(0)$ to be zero or one (or half), I think it will be irrelevant at the end):
$$\theta(0)u_{k'}^{\star}(0)v_k(0)f(0).$$
Doing the same process for what I call the R-L term, one should get as result
$$-\theta(0)v_{k'}^{\star}(0)u_k(0)f(0).$$ these two terms would not cancel for $u(0) \neq v(0)$, namely when $\varphi$ has a discontinuity at zero.
1) Are these boundary terms above (evaluated at zero) really presented in the calculations of the integral? Because another way to think about the first integral would be to split it into two pieces, one for only the left bit and one for the right bit. And in that case there would not be any mixing (L-R or L-R) term but only: 
$$ \int_{-\infty}^{0} u_{k'}^{\star}\partial_x u_k f(x) dx + \int_{0}^{\infty} v_{k'}^{\star}\partial_x v_k f(x) dx,$$
which are presented in the calculations with the $\theta$s as well ( when we consider the terms R-R and L-L, roughly speaking).
2) What about if we say from the beginning that $x=0$ is not in the domain of $\varphi$ ? Technically, this would make $\varphi$ to be continuous. Thus, I guess we could not write it in terms of $\theta(x)$ (defined to include the origin in its domain) and would be more natural to say the only relevant integrals are the ones from L-L and R-R, that is
$$ \int_{-\infty}^{0} u_{k'}^{\star}\partial_x u_k f(x) dx + \int_{0}^{\infty} v_{k'}^{\star}\partial_x v_k f(x) dx.$$ 
Is that correct? If so, the answer to the first question would probably be that those extra terms are indeed presented but only when $\varphi$ has the origin in its domain. Is that right? 
3) I've taken a concrete example (a L-R term) and asked WolframAlpha to solve it. In particular, $k'=2, k=1$ and u and v some exponential times some complex number such that the following are the results
$$\int_{-1}^{1} (\theta(-x) exp(-2ix))( \frac{d}{dx}((5+i)\theta(x)\exp(ikx))f(x)dx = (5+i)f(0)\theta(0),$$
$$\int_{-1}^{0} (\theta(-x) exp(-2ix))( \frac{d}{dx}((5+i)\theta(x)\exp(ikx))f(x) dx = 0,$$
where Wolfram probably adopts $\theta(0) = 1$.
These suggest me the extra terms I got before (the ones proportional to $f(0)\theta(0)$) are correct. Is that correct? If not, what is going on? 
4) On the computational/numerical side, how does a code treat (should treat) an integral over a discontinuity? I have seen some libraries which integrate until very close to the discontinuity (from the left and from the right) and skip the interval $(-\epsilon, \epsilon)$. In that case, I think it is only taking into account the R-R and L-L bits I mentioned above i.e removing the origin from the domain and, therefore, excluding the extra terms I have mentioned before. In particular, I have used quadpack in Fortran and it is giving me a numerical result which clearly does not have any extra $\theta(0)f(0)$ term. Shouldn't the discontinuity contribute to the value of the integral numerically (as Wolfram seems to suggest by the symbolic calculations on question 3)? 
5) I know the issue of the Wave front set conditions for the good behaviour of a product of distributions. In particular the Heaviside with its derivative have both the same wavefront set. In the comments above, I absorbed some $\theta$ into the integration limits and seemed to avoid any of this. I also calculated everything keeping the integrals with limits at $(+- \infty)$, and the dangerous terms with product of $\delta(x)$ and $\theta$ have canceled out. Is there any of this issue happening behind which invalidates the above calculations? I do think such terms can appear in the calculations but are artificial since they seem to cancel out.    
 A: No answers yet, so I'll present perhaps a rather dumb answer. Suppose $g(x)$ is a real function with a continuous, positive, bounded first derivative on $(-1,1)$, $g(-1)=0$, and $g(1)=1$. Then let
$$\varphi_{k^{\prime}}(x)=\begin{cases}u_{k^{\prime}}(x)&x\le-\epsilon\\
u_{k^{\prime}}(-\epsilon)+g\left(\frac x{\epsilon}\right)\left(v_{k^{\prime}}(\epsilon)-u_{k^{\prime}}(-\epsilon)\right)&-\epsilon<x<\epsilon\\
v_{k^{\prime}}(x)&\epsilon\le x\end{cases}$$
And similarly
$$\varphi_k(x)=\begin{cases}u_k(x)&x\le-\epsilon\\
u_k(-\epsilon)+g\left(\frac x{\epsilon}\right)\left(v_k(\epsilon)-u_k(-\epsilon)\right)&-\epsilon<x<\epsilon\\
v_k(x)&\epsilon\le x\end{cases}$$
Then
$$\begin{array}{1}\int_{-\infty}^{\infty}\varphi_{k^{\prime}}^*(x)\frac{\partial\varphi_k(x)}{\partial x}f(x)dx=\int_{-\infty}^{-\epsilon}u_{k^{\prime}}^*(x)\frac{\partial u_k(x)}{\partial x}f(x)dx\\
\quad+\int_{-\epsilon}^{\epsilon}\left[u_{k^{\prime}}^*(-\epsilon)+g\left(\frac x{\epsilon}\right)\left(v_{k^{\prime}}^*(\epsilon)-u_{k^{\prime}}^*(-\epsilon)\right)\right]\left[\frac1{\epsilon}g^{\prime}\left(\frac x{\epsilon}\right)\left(v_k(\epsilon)-u_k(-\epsilon)\right)\right]f(x)dx\\
\quad+\int_{\epsilon}^{\infty}v_{k^{\prime}}^*(x)\frac{\partial v_k(x)}{\partial x}f(x)dx\end{array}$$
Because $f(x)$ is continuous it can be replaced by $f(0)$ in the middle integral and
$$\int_{-\epsilon}^{\epsilon}\frac1{\epsilon}g^{\prime}\left(\frac x{\epsilon}\right)dx=1$$
and
$$\int_{-\epsilon}^{\epsilon}\frac1{\epsilon}g^{\prime}\left(\frac x{\epsilon}\right)g\left(\frac x{\epsilon}\right)dx=\left.\frac12\left[g\left(\frac x{\epsilon}\right)\right]^2\right|_{-\epsilon}^{\epsilon}=\frac12$$
So the middle integral works out to
$$\left(u_{k^{\prime}}^*(-\epsilon)+\frac12\left(v_{k^{\prime}}^*(\epsilon)-u_{k^{\prime}}^*(-\epsilon)\right)\right)\left(v_k(\epsilon)-u_k(-\epsilon)\right)=\frac12\left(v_{k^{\prime}}^*(\epsilon)+u_{k^{\prime}}^*(-\epsilon)\right)\left(v_k(\epsilon)-u_k(-\epsilon)\right)$$
Which is in agreement with the Wolfram Alpha result if we assume
$$\theta(0)=\frac12\left(\lim_{x\rightarrow0-}\theta(x)+\lim_{x\rightarrow0+}\theta(x)\right)=\frac12$$
