Suggestion:
Create a array of BOPOMOFO_TONE_# and test if code in the that array.