HPs (like only a minority of computer manufacturers) come with comprehensive hardware diagnostics that verify every function inside every IC. Either locate that diagnostic on another disk drive partition. Or download it from the HP web site.
Best time to first run a diagnostic is when everything works OK. Then, if problems do exist, one knows how to execute it and what good hardware looks like.
I get most everyone to buy their next computer from the fewer who actually provide that and other features. That avoid or eliminate computer problems faster.
In one case, her computer was crashing only once or twice a week. She finally told me. The comprehensive hardware diagnostic reported a defective memory location inside CPU 4. It failed only with unique values stored there. Fortunately she said something a week before the warranty expired. CPU replaced under warranty. That computer has now worked uninterrupted for over five years.