Fix pool tests (and provide utility to fix other similar issues as well)

This fixes the pool tests which were discovered to be broken in pull #535, and is an alternative to pull #549.

The basic premise is, if we pre-allocate Edges, then we can use them in pointer order during the manifest parse phase, which should solve the sorting issue on all platforms.

The one thing I don't like about this is that it introduces a set<>::empty() call into the main parsing path for non-tests, but that should be quite fast. I toyed with the idea of using templates to eliminate this branch at compile time, but I think the complexity in the code might not be worth it (basically make ManifestParser templatize State (with State being the default class type), then do a non-virtual subclass of State for tests and override AddEdge and add a pre-allocation pool). I'm still open to this option.

I also tried reworking the tests, but they became pretty complex to reason about and even more complex to actually read.