Add gtests for encoder and decoder.