Unit test for merge_circuits.