Add unit tests for metrics support functions