Quaternion group associativity
One idea that saves some work, but still might make your eyes cross is to realize that negatives work as expected, so you don't need to test associativity with 1, -1, or any of the negative i,j,k. That leaves only $\{i,j,k\}^3$ which is 27 tests, each requiring 4 very easy multiplications, 108 easy lookups. If you notice that $i \mapsto j \mapsto k$ is an automorphism, then you can say that $a=i$ in $a(bc) \stackrel{?}{=} (ab)c$ reducing it to 9 checks, 36 easy multiplications.
However, a method with more fringe benefits is to find matrices that multiply as expected. It is easiest if you know complex numbers, since $i$ and $j$ are both like $\sqrt{-1}$, but they don't commute.
Hopefully you can discover the matrices by yourself, but maybe it is tricky without a lot of experience. Here are matrices that work ($\sqrt{-1}$ is any fixed square root of $-1$ in a field of characteristic not 2, say $\mathbb{C}$ for instance; take 1 to be the identity matrix, and if $a$ corresponds to the matrix $A$, then $-a$ corresponds to $-A$, so that negatives work just like expected).
$$i = \begin{bmatrix} \sqrt{-1} & 0 \\ 0 & -\sqrt{-1} \end{bmatrix}, \qquad j = \begin{bmatrix} 0 & 1 \\ -1 & 0 \end{bmatrix}, \qquad k = \begin{bmatrix} 0 & \sqrt{-1} \\ \sqrt{-1} & 0 \end{bmatrix}$$