Add BoolEncoder and a test for it