Convert old debug helpers into unit tests