Add DecodeWays and a lot unit test case