Add test cases and docs