Solution (source code)

= Solution

Under $H_0$,
$$
\sqrt n\,\overline X\sim N(0,1).
$$
Let $z_{1-\alpha/2}=\Phi^{-1}(1-\alpha/2)$. The standard two-sided level-$\alpha$ test rejects exactly when
$$
\boxed{|\sqrt n\,\overline X|>z_{1-\alpha/2}}.
$$
For the observed value $\overline X=\overline x$, its <two-sided Gaussian p-value> is
$$
\boxed{
p(\overline x)=2\left[1-\Phi(\sqrt n\,|\overline x|)\right]}.
$$