add test code for tomask function