Added algorithm run and result save in test function.