Add unit tests for statistics code
We still lack unit tests for most of the statistics code in Tor. The recent changes in the course of allowing *Statistics options to be enabled or disabled while Tor is running are a first step in writing good unit tests. We should further refactor the statistics code, e.g., so that it doesn't depend on get_options() and separates generating statistics output from writing it to disk.
Branch stats-tests in my public repository has the refactorings and unit tests for exit port statistics.
I'd like to know if the refactorings are correct and if the tests make sense. If so, let's merge these, and I'll do the same for the other statistics code.