Add codegen test

Related to #849