Unit test for MG_FLATTEN.