splited test function into decoder and encoder