Unit tests for trace_gen_quad_form.