win checking logic passing tests