Add tests for APEv2 codec

Also fixes some issues with operator precedence in a called function