On Wed, Jun 2, 2021 at 8:04 PM Ethan Furman <ethan@stoneleaf.us> wrote:

Thank you everyone for your ideas!  Instead of adding another single-purpose decorator, I'm toying with the idea of
adding a general purpose decorator that accepts instructions.  Something along the lines of:

I had a couple comments. First, are these checks going to run at import time? The reason I ask is that, in cases where the enums aren't generated dynamically, it seems like it could make sense for efficiency to have the option of running them instead during tests. The decorator would still be useful because it could tell the test harness what checks to run.

My other comment is whether this design would permit checks that take arguments. For example, in the case of the "continuous" check, one might want to be able to say, "this Flag enum should span the first N bits" as opposed to using the highest occurring bit as the N. That way you can be sure you didn't leave off any flags at the end.