refactored tests to generalise encoder/decoder test utility functions