Convert most constraint assertions to use a type-safe macro

Travis seems to be testing in an environment that's more picky about types. This change converts most tests to use a single macro, which casts its parameters to appropriate types.