Encode object with function, first test