Verifying a stiffness matrix isn’t too hard. See the following PDF file. Otherwise, once a stiffness matrix have been verified, the mass matrix can be too with a few lines more code.

Instead of a Poisson problem, discretize the heat equation such that the steady state is our Poisson problem with an easy time stepper (say Euler). Note that we will have to invert our mass matrix at each step and have a mass matrix multiply. Then we should see that the solution dotted with the force vector approaches the same value as above.