improve tests on the engine

I moved engine/utils.go to a *_test.go file because it's helper functions used only by tools, and it was messing with the code coverage count.