Decide whether a given cubic polynomial is irreducible over the rationals

Decide whether the following two polynomials are irreducible over $\mathbb{Q}$: $p(x) = x^3 - x + 2$ and $q(x) = x^3 - 12x^2 + 44x - 52$.

Note that if a cubic polynomial in $\mathbb{Z}[x]$ is reducible over $\mathbb{Q}$, then it must have a linear factor- that is, it has a root in $\mathbb{Q}$. By the rational root theorem, there are finitely many candidates for this root. If none of these is a root, then the polynomial is irreducible in $\mathbb{Q}[x]$.

By the rational root theorem, if $p(x)$ has a root in $\mathbb{Q}$ it is in the set $\{ \pm 2/\pm 1, \pm 1/\pm 1 \} = \{ 2, -2, 1, -1\}$. Since $p(1) = p(-1) = 2$, $p(2) = 8$, and $p(-2) = -4$, $p(x)$ is irreducible in $\mathbb{Q}[x]$.

Again by the rational root theorem, if $q(x)$ has a root in $\mathbb{Q}$ then it is in the set $\{ \pm 1, \pm 2, \pm 4, \pm 13, \pm 26, \pm 52 \}$. It is easy but rather tedious to see that $q(1) = -19$, $q(-1) = -109$, $q(2) = -4$, $q(-2) = -196$, $q(4) = -4$, $q(-4) = -484$, $q(13) = 689$, $q(-13) = -4849$, $q(26) = 10556$, $q(-26) = -26884$, $q(52) = 110396$, and $q(-52) = -175396$. Thus $q(x)$ is irreducible in $\mathbb{Q}[x]$.