North Korea tests nuclear device