encoder: Add tests; Updates #7