Test cases and implementation for compose_rev() operation