Yes the battle test at Lumiose city to record the stats at lvl 50.
Enter the lvl 50 stats with the nature in this calculator:
http://psypokes.com/dex/iv.php
It always gives you a range like 30~31 or 17~18.
You can always double check at the IV judge at Kiloude city:
If the calculator gives you a range of '30~31', and the judge says that the stat 'can't be beat', it means that the '30~31' is actually 31 and it's a perfect IV.
If the judge doesn't mention the stat, it means that the IV is exactly 30 (almost perfect).