Changed the order of Asserts to first check the output and then the
algorithm