OS X has a hardware test tool built in that can be launched after rebooting the machine. It checks the internal hardware components such as logic board, memory and wireless components.
Intel-based Macs: Using Apple Hardware Test
Press the power button to turn on your computer.
Press and hold the D key before the gray startup screen appears. If Apple Hardware Test does not start up, see the Additional Information section at the end of this article.
It takes a minute or so for Apple Hardware Test to start up and inspect your hardware configuration. While this is taking place, an icon appears on the screen:
To perform all of the basic tests, click the Test button or press the "T" key or the Return key. To perform a more thorough diagnostic test, select the "Perform extended testing" checkbox under the Test button before you click the Test button.
You can also verify the SMART status of the hard drive by opening Disk Utility, then click Info after selecting the boot volume. It'll also show an error count that could be an indicator of a failing hard drive.