test calculatePosition