When to test for pregnancy?

How long after unprotected sex can you test for pregnancy? My cycles are irregular so not exactly sure when I ovulate..