Fixed bug in type casting tester

The previous implementation forgot to cast inputs back to original type before testing on original type (!).