added unittests, which the addcotnact and sort pass