Add more test cases, use more general way to process the internal index comparison