Improve the q_str macro and add tests for quantity construction