added unit test for the REPEAT operator unfolding and fixed the
algorithm