util: Convert cache test to use gtest
Replace a bunch of helper functions for checking results with ones from GTest.
And also use ralloc for strings in cache test -- which as a side-effect avoids previous warnings about asprintf result not being checked.