Generalized fluctuation test for deciphering phenotypic switching within cell populations