Add test cases for NB.encode and NB.decode family of routines