Start adding tests for pseudo-boolean resolve stuff

This required splitting out some functionality into separate functions to make
it easier to test.