refactor tests to use macros and shared examples