Unit test and decode implementation