extra: add tests for test::MetricMap, MetricDiff, ratchet.
auto merge of #7731 : graydon/rust/test-for-test-ratchet, r=cmr

This is just a followup to #7623 which adds some tests to the code in that PR (and picks out a bug). Only the final changeset in this series is new past that PR.