tests: Add more test cases from bug #598