Test for flags optimization.

According to JustArchi's suggestions.