Spectral characterization of terahertz quantum cascade lasers by heterodyne and homodyne mixing