On 11/25/2015 11:47 PM, David Malcolm wrote:
FWIW, the reason I special-cased the linked list was to avoid any dynamic memory allocation: the ctors run before main, so I wanted to keep them as simple as possible.
Is there any particular reason for this? C++ doesn't disallow memory allocation in global constructors, does it?
Putting the linked list directly into those objects means that running the ctors is a simple case of wiring up some pointers: the memory is already statically allocated. (also, one thing I want to test is vec<> itself [1]).
Ok so use a C++ list instead of a vec. My days of using C++ for personal projects are 15 years in the past so maybe I'm not an authority, but that's how I feel the language is supposed to be used - use provided data structures rather than coding them up over and over.
I do want some level of determinism over test ordering, for the sake of everyone's sanity. It's probably simplest to either hardcode the order, or have priority levels. I favor the former (and right now am leaning towards a very explicit no-magic approach with no auto-registration, given the linker issues I've been seeing with auto-registration).
I guess that works too. Certainly explicit function calls are preferrable over #including other C files as a workaround for such a problem.
I still wish others would chime in on the rest of the issues we've discussed (run to first failure vs. providing elaborate test summaries), I want to make my preference clear but I don't want to dictate it.
Bernd