Add guards that check the existence of mex files used in tests

Added guards that check the existence of mex files used in tests. Fixes #369.