Don't know if this is the right place for this?Or even if this makes any sense.....

Is there a sketch or something that can check is a controller is working like it should?

Let me explain......I want to buy a bunch of atmega48, 88, 168 and 328 from my supplier. I'm not going to use the all at once (I will use them over time). So when I get them I would like to test them out? Are they all doing all they should? And if any are not 100% I can send them back.

Are they all doing all they should? And if any are not 100% I can send them back.

That's a pretty tall order to require 100% functionality validation. The AVR chips have lots on internal hardware features (timers, usart, SPI, etc) that would be testable only with proper software loaded into them.

I would think if you can burn the bootloader, upload a sketch that then toggles all the I/O pins with some kind of test bed that has leds (with resistors!) wired to the I/O pins, that would be as pratical to a full functional test that one could expect. Even that is going to be pretty time consuming if you need to check a large batch at one time?