Three identical iron bars A, B and C are kept on a table, out of which two bars are magnet. Bar B is a magnet whose north-south poles are marked. How will you find out which one of the remaining two bars is a magnet?
The poles of the magnet B will attract both the ends when brought near the iron bar. Whereas it will repel one end when brought near the magnet.
So repulsion test is the appropriate test to find out the magnetic bar between A and C.