fix optimize condition and assign to enum test