Factorization of polynomials over a finite field and irreducibility tests