apply pseudo code on test