Add ASSERT macro to macros.h and implement in tests