Homing switch issue

How do you know your Z switch is fine?
The reason I ask is that if there’s a problem the Z switch, you’d see exactly what you’re describing.