Summarise all cases of variants, and give each of them a test case. Then debug based on those test cases.